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

/*
 * @test /nodynamiccopyright/
 * @bug 8026564 8074346
 * @summary The parts of a fully-qualified type can't be annotated.
 * @author Werner Dietl
 * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
 */


import java.lang.annotation.*;
import java.util.List;

class CantAnnotatePackages {
    // Before a package component:
    @TA java.lang.Object of1;

    // These result in a different error.
    // TODO: should this be unified?

    List<@TA java.lang.Object> of2;
    java. @TA lang.Object of3;
    List<java. @TA lang.Object> of4;

    List<@CantAnnotatePackages_TB java.lang.Object> of5; // test that we do reasonable things for missing types.

    // TODO: also note the order of error messages.
}

@Target(ElementType.TYPE_USE)
@interface TA { }