RFR 8144903: JShell: determine incorrectly the type of the expression which is array type of captured type

Robert Field robert.field at oracle.com
Tue Dec 8 20:28:22 UTC 2015


[Jan, I'd like your opinion]

Thank you for seeing this and drilling into where the problem is.  This is important to fix.

I see that this would address the problem.  However, I am squeamish about the solution as it unwraps to match the result of layers of underlying super class behavior.  Looking at it further, I believe the problem is in the pre-existing typeToPrint, my bad!  I don't think the approach I took is right.  Stepping back, we want upper bound unless the type is embedded in a type that takes generic types, class types.  That suggests to me replacing typeToPrint with a boolean useWildCard = false, which would be changed by visitClassType().  But alas this is recursive and this visitor does not have state that passes through the recursion, so it would be global -- in this case that should work, but ugly.

Ah! Really the problem is that we want the top-level type to be erased.  But that means holding an instance of Types.  Deeper integration with javac.  Hmmmm....

-Robert

> On Dec 8, 2015, at 1:10 AM, ShinyaYoshida <bitterfoxc at gmail.com> wrote:
> 
> Hi Robert,
> Could you review my patch for
> "JShell: determine incorrectly the type of the expression which is array type of captured type"?
> https://bugs.openjdk.java.net/browse/JDK-8144903 <https://bugs.openjdk.java.net/browse/JDK-8144903>
> 
> webrev: http://cr.openjdk.java.net/~shinyafox/kulla/8144903/webrev.00/ <http://cr.openjdk.java.net/~shinyafox/kulla/8144903/webrev.00/>
> 
> Regards,
> shinyafox(Shinya Yoshida)



More information about the kulla-dev mailing list