test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java

Fri, 03 May 2013 09:56:56 -0700

author
jjg
date
Fri, 03 May 2013 09:56:56 -0700
changeset 1721
abd153854f16
parent 1521
71f35e4b93a5
child 2103
b1b4a6dcc282
permissions
-rw-r--r--

8012728: Normalize @ignore comments on langtools tests
Reviewed-by: vromero, mcimadamore

jjg@1521 1 /*
jjg@1521 2 * @test /nodynamiccopyright/
jjg@1521 3 * @bug 8006733 8006775
jjg@1721 4 * @ignore 8013409: test failures for type annotations
jjg@1521 5 * @summary A static outer class cannot be annotated.
jjg@1521 6 * @author Werner Dietl
jjg@1521 7 * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
jjg@1521 8 */
jjg@1521 9
jjg@1521 10 import java.util.List;
jjg@1521 11 import java.lang.annotation.*;
jjg@1521 12
jjg@1521 13 class CantAnnotateStaticClass {
jjg@1521 14 @Target(ElementType.TYPE_USE)
jjg@1521 15 @interface A {}
jjg@1521 16
jjg@1521 17 static class Outer {
jjg@1521 18 class Inner {}
jjg@1521 19 }
jjg@1521 20
jjg@1521 21 // 8 errors:
jjg@1521 22 @A Outer.Inner f1;
jjg@1521 23 @A Outer.Inner f1r() { return null; }
jjg@1521 24 void f1p(@A Outer.Inner p) { }
jjg@1521 25 void f1c(Object o) {
jjg@1521 26 Object l = (@A Outer.Inner) o;
jjg@1521 27 }
jjg@1521 28
jjg@1521 29 List<@A Outer.Inner> f2;
jjg@1521 30 List<@A Outer.Inner> f2r() { return null; }
jjg@1521 31 void f2p(List<@A Outer.Inner> p) { }
jjg@1521 32 void f2c(Object o) {
jjg@1521 33 Object l = (List<@A Outer.Inner>) o;
jjg@1521 34 }
jjg@1521 35
jjg@1521 36 // OK:
jjg@1521 37 @A Outer g1;
jjg@1521 38 List<@A Outer> g2;
jjg@1521 39 Outer. @A Inner g3;
jjg@1521 40 List<Outer. @A Inner> g4;
jjg@1521 41 }

mercurial