Sat, 13 Apr 2013 12:25:44 +0100
8010659: Javac Crashes while building OpenJFX
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com
jjg@1521 | 1 | /* |
jjg@1521 | 2 | * @test /nodynamiccopyright/ |
jjg@1521 | 3 | * @bug 8006733 8006775 |
jjg@1521 | 4 | * @ignore |
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 | } |