Local Variable Type Inference - prototype

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Mar 10 23:39:16 UTC 2016

On 10/03/16 22:13, Remi Forax wrote:
> The issue is that the inferred type is something like:
>    Number & Comparable<? extends Number & Comparable<?> & Serailizable> & Serializable
> because
>    Integer implements Comparable<Integer> and
>    Double implements Comparable<Double>
> so types like Number or Comparable<?> are valid substitute of T with no obvious most specific types, here
Right - and intersection types are the only kind (together with union 
types - which are kind of treated as intersections by Java language) 
which are not supported by LVTI. The problem with intersection types is 
that in the general case, when you have a type like C & I1 & I2 ... & 
In, how do you pick the 'best' type?


More information about the platform-jep-discuss mailing list