Anonymous class instance creation expression with diamond compatibility constraint is reduced to anonymous class type?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Mar 10 21:46:19 UTC 2017


Hi Georgiy - thanks for the report. Just so that I understand - is this 
a regression or is it a new test and that's the behavior you are seeing 
with the latest build? I'm asking because I don't recall recent changes 
in this area.

That said, I think your analysis looks correct - the spec draft calls 
for the anonymous inner class non-denotable type to be 'normalized'.

Maurizio

On 10/03/17 20:02, Georgiy Rakov wrote:
> class MyType<T> {}
>
> class MyList<T> {
>     MyList<T> copyThis() { return null; }
> }
>
> class Foo<T> {
>     Foo(MyType<String> a){ }
> }
>
> public class Test26  {
>     public static void main(String argv[]) {
>         MyList<Foo> l1 = new MyList<>();
>         m2(l1, m1(
>                    new Foo<>(new MyType()){ }
>                  ).copyThis());
>     }
>     public static <T> MyList<T> m2(MyList<T> l1, MyList<T> l2) { 
> return null; }
>     public static <U> MyList<U> m1(U item) { return null; }
> } 



More information about the compiler-dev mailing list