diff -r 0384683c64be -r ddb4a2bfcd82 test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java Tue May 14 15:04:06 2013 -0700 @@ -0,0 +1,19 @@ +/* + * @test /nodynamiccopyright/ + * @bug 1234567 + * @summary ensure that declaration annotations are not allowed on + * new array expressions + * @author Werner Dietl + * @compile/fail/ref=DeclarationAnnotation.out -XDrawDiagnostics DeclarationAnnotation.java + */ +class DeclarationAnnotation { + Object e1 = new @DA int[5]; + Object e2 = new @DA String[42]; + Object e3 = new @DA Object(); + + // The declaration annotation is only allowed for + // an anonymous class creation. + Object ok = new @DA Object() { }; +} + +@interface DA { }