1 /*
2  * @test /nodynamiccopyright/
3  * @bug 8026564
4  * @summary The parts of a fully-qualified type can't be annotated.
5  * @author Werner Dietl
6  * @ignore 8057679 clarify error messages trying to annotate scoping
7  * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
8  */
9 
10 import java.lang.annotation.*;
11 import java.util.List;
12 
13 class CantAnnotatePackages {
14     // Before a package component:
15     @TA java.lang.Object of1;
16 
17     // These result in a different error.
18     // TODO: should this be unified?
19 
20     List<@TA java.lang.Object> of2;
21     java. @TA lang.Object of3;
22     List<java. @TA lang.Object> of4;
23 
24     // TODO: also note the order of error messages.
25 }
26 
27 @Target(ElementType.TYPE_USE)
28 @interface TA { }
29