1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java Tue May 14 15:04:06 2013 -0700 1.3 @@ -0,0 +1,19 @@ 1.4 +/* 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 1234567 1.7 + * @summary ensure that declaration annotations are not allowed on 1.8 + * new array expressions 1.9 + * @author Werner Dietl 1.10 + * @compile/fail/ref=DeclarationAnnotation.out -XDrawDiagnostics DeclarationAnnotation.java 1.11 + */ 1.12 +class DeclarationAnnotation { 1.13 + Object e1 = new @DA int[5]; 1.14 + Object e2 = new @DA String[42]; 1.15 + Object e3 = new @DA Object(); 1.16 + 1.17 + // The declaration annotation is only allowed for 1.18 + // an anonymous class creation. 1.19 + Object ok = new @DA Object() { }; 1.20 +} 1.21 + 1.22 +@interface DA { }