langtools/test/tools/javac/annotations/AnnotationTypeElementModifiers.java
changeset 21895 2afdc45dcc5b
equal deleted inserted replaced
21894:3535c1819067 21895:2afdc45dcc5b
       
     1 /*
       
     2  * @test /nodynamiccopyright/
       
     3  * @bug 8028428
       
     4  * @summary Test that only 'public' and 'abstract' elements compile
       
     5  * @compile/fail/ref=AnnotationTypeElementModifiers.out -XDrawDiagnostics AnnotationTypeElementModifiers.java
       
     6  */
       
     7 
       
     8 public @interface AnnotationTypeElementModifiers {
       
     9     // First 4 should work
       
    10     public int A();
       
    11     public int AA() default  1;
       
    12 
       
    13     abstract int B();
       
    14     abstract int BB() default  1;
       
    15 
       
    16     // These shouldn't work
       
    17     private int C();
       
    18     private int CC() default  1;
       
    19 
       
    20     protected int D();
       
    21     protected int DD() default  1;
       
    22 
       
    23     static int E();
       
    24     static int EE() default  1;
       
    25 
       
    26     final int F();
       
    27     final int FF() default  1;
       
    28 
       
    29     synchronized int H();
       
    30     synchronized int HH() default  1;
       
    31 
       
    32     volatile int I();
       
    33     volatile int II() default  1;
       
    34 
       
    35     transient int J();
       
    36     transient int JJ() default  1;
       
    37 
       
    38     native int K();
       
    39     native int KK() default  1;
       
    40 
       
    41     strictfp float L();
       
    42     strictfp float LL() default  0.1f;
       
    43 
       
    44     default int M();
       
    45     default int MM() default  1;
       
    46 }