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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Dec 11 18:44:40 UTC 2015



On 11/12/15 18:14, Robert Field wrote:
> If others think I should just get over it, I'll push as is.
I think this fix is a stable point in the design space - the treatment 
of complex types is as simple as possible:

* captured vars are 'erased' using wildcard info
* intersection types are erased to Object

If you want to use the upper bound of a captured variable in a safe way 
you need to:

* check as to whether the bound is not recursive i.e. X extends 
Comparable<X>
* do something for intersection types, as declared bounds can be 
intersection types

This means TypePrinter will start doing subtyping tests and other 
similar stuff - which right now it's not the case.

While it might be worthwhile to explore that direction further, I 
believe that in the short term, the right thing to do is the 
conservative fix Shinya has put together. The fact that the regression 
test used to pass is more an accident than a feature; there are multiple 
variations of that test that won't work.

Maurizio


More information about the kulla-dev mailing list