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

Georgiy Rakov georgiy.rakov at oracle.com
Mon Mar 13 14:45:39 UTC 2017


Hi Maurizio,

this example can be considered as a new test which resulted from 
correcting existing test stemmed from Dan's comment in JDK-8133936. This 
behavior is reproduced on JDK build 160.

As it follows from your reply it's likely to be a javac issue, so I've 
filed a bug: JDK-8176577.

Thanks,

Georgiy.


On 11.03.2017 0:46, Maurizio Cimadamore wrote:
> 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