< prev index next >

test/langtools/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.java

Print this page

 1 /**
 2  * @test    /nodynamiccopyright/
 3  * @bug     8044196
 4  * @summary Make sure repeatable annotations can't be erroneously applied to a cast type
 5  * @compile/fail/ref=InvalidRepAnnoOnCast.out -XDrawDiagnostics InvalidRepAnnoOnCast.java
 6  */
 7 
 8 import java.lang.annotation.*;
 9 
10 class InvalidRepAnnoOnCast {
11 
12     @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
13     @Repeatable(TC.class)
14     @interface T { int value(); }
15 
16     @Target(ElementType.TYPE_PARAMETER)
17     @interface TC { T[] value(); }
18 
19     String s = (@T(1) @T(2) String) new Object();
20 }

 1 /**
 2  * @test    /nodynamiccopyright/
 3  * @bug     8044196
 4  * @summary Make sure repeatable annotations can't be erroneously applied to a cast type
 5  * @compile/fail/ref=InvalidRepAnnoOnCast.out -XDrawDiagnostics InvalidRepAnnoOnCast.java
 6  */
 7 
 8 import java.lang.annotation.*;
 9 
10 class InvalidRepAnnoOnCast {
11 
12     @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
13     @Repeatable(TC.class)
14     @interface T { int value(); }
15 
16     @Target(ElementType.TYPE_PARAMETER)
17     @interface TC { T[] value(); }
18 
19     String s = (@T(1) @T(2) String) new Object() {};
20 }
< prev index next >