< prev index next >

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

Print this page


   1 /*
   2  * @test /nodynamiccopyright/
   3  * @bug 8138822
   4  * @summary test that only Java 8+ allows repeating annotations
   5  * @compile WrongVersion.java
   6  * @compile -Xlint:-options -source 8 WrongVersion.java
   7  * @compile/fail/ref=WrongVersion7.out -XDrawDiagnostics -Xlint:-options -source 7 WrongVersion.java
   8  * @compile/fail/ref=WrongVersion6.out -XDrawDiagnostics -Xlint:-options -source 6 WrongVersion.java
   9  */
  10 import java.lang.annotation.Repeatable;
  11 
  12 @Ann(1) @Ann(2)
  13 class C {
  14 }
  15 
  16 @Repeatable(AnnContainer.class)
  17 @interface Ann {
  18     int value();
  19 }
  20 
  21 @interface AnnContainer {
  22     Ann[] value();
  23 }
   1 /*
   2  * @test /nodynamiccopyright/
   3  * @bug 8138822
   4  * @summary test that only Java 8+ allows repeating annotations
   5  * @compile WrongVersion.java
   6  * @compile -Xlint:-options -source 8 WrongVersion.java
   7  * @compile/fail/ref=WrongVersion7.out -XDrawDiagnostics -Xlint:-options -source 7 WrongVersion.java

   8  */
   9 import java.lang.annotation.Repeatable;
  10 
  11 @Ann(1) @Ann(2)
  12 class C {
  13 }
  14 
  15 @Repeatable(AnnContainer.class)
  16 @interface Ann {
  17     int value();
  18 }
  19 
  20 @interface AnnContainer {
  21     Ann[] value();
  22 }
< prev index next >