8028428: strictfp allowed as annotation element modifier

Reviewed-by: jjg
This commit is contained in:
Joel Borggrén-Franck 2013-11-26 13:33:33 +01:00
parent 7f2246bbef
commit 979151dfa9
3 changed files with 68 additions and 1 deletions

View File

@ -293,7 +293,7 @@ public class Flags {
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;

View File

@ -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;
}

View File

@ -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