CantAnnotatePackages.java revision 2962:c6f2ffcc44b9
137535Sdes/*
237535Sdes * @test /nodynamiccopyright/
337535Sdes * @bug 8026564 8074346
437535Sdes * @summary The parts of a fully-qualified type can't be annotated.
537535Sdes * @author Werner Dietl
637535Sdes * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
737535Sdes */
837535Sdes
937535Sdes
1037535Sdesimport java.lang.annotation.*;
1137535Sdesimport java.util.List;
1237535Sdes
1337535Sdesclass CantAnnotatePackages {
1437535Sdes    // Before a package component:
1537535Sdes    @TA java.lang.Object of1;
1637535Sdes
1737535Sdes    // These result in a different error.
1837535Sdes    // TODO: should this be unified?
1937535Sdes
2037535Sdes    List<@TA java.lang.Object> of2;
2137535Sdes    java. @TA lang.Object of3;
2237535Sdes    List<java. @TA lang.Object> of4;
2337535Sdes
2437535Sdes    List<@CantAnnotatePackages_TB java.lang.Object> of5; // test that we do reasonable things for missing types.
2537535Sdes
2637535Sdes    // TODO: also note the order of error messages.
2737535Sdes}
2840975Sdes
2937535Sdes@Target(ElementType.TYPE_USE)
3037535Sdes@interface TA { }
3140975Sdes