--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Mon Nov 25 17:42:28 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Tue Nov 26 13:33:33 2013 +0100
@@ -293,7 +293,7 @@
ExtendedStandardFlags = (long)StandardFlags | DEFAULT,
ModifierFlags = ((long)StandardFlags & ~INTERFACE) | DEFAULT,
InterfaceMethodMask = ABSTRACT | STATIC | PUBLIC | STRICTFP | DEFAULT,
- AnnotationTypeElementMask = FINAL | ABSTRACT | PUBLIC | STRICTFP,
+ AnnotationTypeElementMask = ABSTRACT | PUBLIC,
LocalVarFlags = FINAL | PARAMETER;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/AnnotationTypeElementModifiers.java Tue Nov 26 13:33:33 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8028428
+ * @summary Test that only 'public' and 'abstract' elements compile
+ * @compile/fail/ref=AnnotationTypeElementModifiers.out -XDrawDiagnostics AnnotationTypeElementModifiers.java
+ */
+
+public @interface AnnotationTypeElementModifiers {
+ // First 4 should work
+ public int A();
+ public int AA() default 1;
+
+ abstract int B();
+ abstract int BB() default 1;
+
+ // These shouldn't work
+ private int C();
+ private int CC() default 1;
+
+ protected int D();
+ protected int DD() default 1;
+
+ static int E();
+ static int EE() default 1;
+
+ final int F();
+ final int FF() default 1;
+
+ synchronized int H();
+ synchronized int HH() default 1;
+
+ volatile int I();
+ volatile int II() default 1;
+
+ transient int J();
+ transient int JJ() default 1;
+
+ native int K();
+ native int KK() default 1;
+
+ strictfp float L();
+ strictfp float LL() default 0.1f;
+
+ default int M();
+ default int MM() default 1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/AnnotationTypeElementModifiers.out Tue Nov 26 13:33:33 2013 +0100
@@ -0,0 +1,21 @@
+AnnotationTypeElementModifiers.java:17:17: compiler.err.mod.not.allowed.here: private
+AnnotationTypeElementModifiers.java:18:17: compiler.err.mod.not.allowed.here: private
+AnnotationTypeElementModifiers.java:20:19: compiler.err.mod.not.allowed.here: protected
+AnnotationTypeElementModifiers.java:21:19: compiler.err.mod.not.allowed.here: protected
+AnnotationTypeElementModifiers.java:23:16: compiler.err.mod.not.allowed.here: static
+AnnotationTypeElementModifiers.java:24:16: compiler.err.mod.not.allowed.here: static
+AnnotationTypeElementModifiers.java:26:15: compiler.err.mod.not.allowed.here: final
+AnnotationTypeElementModifiers.java:27:15: compiler.err.mod.not.allowed.here: final
+AnnotationTypeElementModifiers.java:29:22: compiler.err.mod.not.allowed.here: synchronized
+AnnotationTypeElementModifiers.java:30:22: compiler.err.mod.not.allowed.here: synchronized
+AnnotationTypeElementModifiers.java:32:18: compiler.err.mod.not.allowed.here: volatile
+AnnotationTypeElementModifiers.java:33:18: compiler.err.mod.not.allowed.here: volatile
+AnnotationTypeElementModifiers.java:35:19: compiler.err.mod.not.allowed.here: transient
+AnnotationTypeElementModifiers.java:36:19: compiler.err.mod.not.allowed.here: transient
+AnnotationTypeElementModifiers.java:38:16: compiler.err.mod.not.allowed.here: native
+AnnotationTypeElementModifiers.java:39:16: compiler.err.mod.not.allowed.here: native
+AnnotationTypeElementModifiers.java:41:20: compiler.err.mod.not.allowed.here: strictfp
+AnnotationTypeElementModifiers.java:42:20: compiler.err.mod.not.allowed.here: strictfp
+AnnotationTypeElementModifiers.java:44:17: compiler.err.mod.not.allowed.here: default
+AnnotationTypeElementModifiers.java:45:17: compiler.err.mod.not.allowed.here: default
+20 errors