1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/annotations/AnnotationTypeElementModifiers.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,46 @@ 1.4 +/* 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 8028428 1.7 + * @summary Test that only 'public' and 'abstract' elements compile 1.8 + * @compile/fail/ref=AnnotationTypeElementModifiers.out -XDrawDiagnostics AnnotationTypeElementModifiers.java 1.9 + */ 1.10 + 1.11 +public @interface AnnotationTypeElementModifiers { 1.12 + // First 4 should work 1.13 + public int A(); 1.14 + public int AA() default 1; 1.15 + 1.16 + abstract int B(); 1.17 + abstract int BB() default 1; 1.18 + 1.19 + // These shouldn't work 1.20 + private int C(); 1.21 + private int CC() default 1; 1.22 + 1.23 + protected int D(); 1.24 + protected int DD() default 1; 1.25 + 1.26 + static int E(); 1.27 + static int EE() default 1; 1.28 + 1.29 + final int F(); 1.30 + final int FF() default 1; 1.31 + 1.32 + synchronized int H(); 1.33 + synchronized int HH() default 1; 1.34 + 1.35 + volatile int I(); 1.36 + volatile int II() default 1; 1.37 + 1.38 + transient int J(); 1.39 + transient int JJ() default 1; 1.40 + 1.41 + native int K(); 1.42 + native int KK() default 1; 1.43 + 1.44 + strictfp float L(); 1.45 + strictfp float LL() default 0.1f; 1.46 + 1.47 + default int M(); 1.48 + default int MM() default 1; 1.49 +}