langtools/test/tools/javac/generics/diamond/neg/Neg20.java
changeset 30403 c904bbdc5ec1
equal deleted inserted replaced
30073:989253a902c3 30403:c904bbdc5ec1
       
     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  */
       
     7 import java.lang.annotation.ElementType;
       
     8 import java.lang.annotation.Target;
       
     9 
       
    10 public 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 }