langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java
author sadayapalam
Tue, 16 Jun 2015 09:39:59 +0530
changeset 31212 edf65e25e066
parent 26532 aa84b6606229
child 31560 3a71b9271010
permissions -rw-r--r--
8074346: Type annotation on a qualified type causes spurious 'cannot find symbol' errors Summary: Issue clear diagostic when package names in a qualified type name are illegally annotated Reviewed-by: mcimadamore, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     1
/*
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
31212
edf65e25e066 8074346: Type annotation on a qualified type causes spurious 'cannot find symbol' errors
sadayapalam
parents: 26532
diff changeset
     3
 * @bug 8026564 8074346
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     4
 * @summary The parts of a fully-qualified type can't be annotated.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     5
 * @author Werner Dietl
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     6
 * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     7
 */
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
     8
31212
edf65e25e066 8074346: Type annotation on a qualified type causes spurious 'cannot find symbol' errors
sadayapalam
parents: 26532
diff changeset
     9
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    10
import java.lang.annotation.*;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    11
import java.util.List;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    12
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    13
class CantAnnotatePackages {
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    14
    // Before a package component:
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    15
    @TA java.lang.Object of1;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    16
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    17
    // These result in a different error.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    18
    // TODO: should this be unified?
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    19
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    20
    List<@TA java.lang.Object> of2;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    21
    java. @TA lang.Object of3;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    22
    List<java. @TA lang.Object> of4;
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    23
31212
edf65e25e066 8074346: Type annotation on a qualified type causes spurious 'cannot find symbol' errors
sadayapalam
parents: 26532
diff changeset
    24
    List<@CantAnnotatePackages_TB java.lang.Object> of5; // test that we do reasonable things for missing types.
edf65e25e066 8074346: Type annotation on a qualified type causes spurious 'cannot find symbol' errors
sadayapalam
parents: 26532
diff changeset
    25
21041
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    26
    // TODO: also note the order of error messages.
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    27
}
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    28
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    29
@Target(ElementType.TYPE_USE)
99f5e5e97425 8026564: import changes from type-annotations forest
jjg
parents:
diff changeset
    30
@interface TA { }