Neg20.java revision 2904:1f483cea54fb
1/* 2 * @test /nodynamiccopyright/ 3 * @bug 8078592 4 * @summary Compiler fails to reject erroneous use of diamond with anonymous classes involving "fresh" type variables. 5 * @compile/fail/ref=Neg20.out Neg20.java -XDrawDiagnostics 6 */ 7import java.lang.annotation.ElementType; 8import java.lang.annotation.Target; 9 10public class Neg20 { 11 static class Foo<E extends B<E>> { 12 public Foo<E> complexMethod(E a) { 13 return this; 14 } 15 } 16 17 static class Goo<@T E> { 18 public Goo<E> complexMethod(E a) { 19 return this; 20 } 21 } 22 23 static class B<V> { 24 } 25 26 @Target(ElementType.TYPE_USE) 27 static @interface T { 28 } 29 30 public static void check() { 31 Foo<?> t4 = new Foo<>() { 32 }; 33 Goo<?> g4 = new Goo<>() { 34 }; 35 } 36} 37