jjg@1521: /* jjg@1521: * @test /nodynamiccopyright/ jjg@1521: * @bug 8006733 8006775 jjg@1721: * @ignore 8013409: test failures for type annotations jjg@1521: * @summary A static outer class cannot be annotated. jjg@1521: * @author Werner Dietl jjg@1521: * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java jjg@1521: */ jjg@1521: jjg@1521: import java.util.List; jjg@1521: import java.lang.annotation.*; jjg@1521: jjg@1521: class CantAnnotateStaticClass { jjg@1521: @Target(ElementType.TYPE_USE) jjg@1521: @interface A {} jjg@1521: jjg@1521: static class Outer { jjg@1521: class Inner {} jjg@1521: } jjg@1521: jjg@1521: // 8 errors: jjg@1521: @A Outer.Inner f1; jjg@1521: @A Outer.Inner f1r() { return null; } jjg@1521: void f1p(@A Outer.Inner p) { } jjg@1521: void f1c(Object o) { jjg@1521: Object l = (@A Outer.Inner) o; jjg@1521: } jjg@1521: jjg@1521: List<@A Outer.Inner> f2; jjg@1521: List<@A Outer.Inner> f2r() { return null; } jjg@1521: void f2p(List<@A Outer.Inner> p) { } jjg@1521: void f2c(Object o) { jjg@1521: Object l = (List<@A Outer.Inner>) o; jjg@1521: } jjg@1521: jjg@1521: // OK: jjg@1521: @A Outer g1; jjg@1521: List<@A Outer> g2; jjg@1521: Outer. @A Inner g3; jjg@1521: List g4; jjg@1521: }