test/tools/javac/annotations/typeAnnotations/failures/Scopes.java

changeset 2134
b0c086cd4520
parent 1521
71f35e4b93a5
child 2525
2eb010b6cb22
     1.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java	Tue Oct 15 22:15:35 2013 +0200
     1.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java	Tue Oct 15 15:57:13 2013 -0700
     1.3 @@ -1,17 +1,16 @@
     1.4  /*
     1.5   * @test /nodynamiccopyright/
     1.6   * @bug 6843077 8006775
     1.7 - * @summary check that A is accessible in the class type parameters
     1.8 + * @summary Unqualified inner type annotation not in scope.
     1.9   * @author Mahmood Ali
    1.10   * @compile/fail/ref=Scopes.out -XDrawDiagnostics Scopes.java
    1.11   */
    1.12 -class Scopes<T extends @UniqueInner Object> {
    1.13 -  // UniqueInner is not visible in the type parameters.
    1.14 -  // One has to use Scopes.UniqueInner.
    1.15 -  // Annotations with the default @Target are not allowed there,
    1.16 -  // so we also get the second error about the invalid location.
    1.17 -  // Adding the target here doesn't matter, as we don't resolve
    1.18 -  // the annotation type.
    1.19 -  // @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
    1.20 -  @interface UniqueInner { };
    1.21 +import java.lang.annotation.*;
    1.22 +
    1.23 +@InnerTA
    1.24 +class Scopes<@InnerTA T extends @InnerTA Object> {
    1.25 +    // The simple name TA is not in scope on header of class.
    1.26 +    // One has to use @Scopes.TA.
    1.27 +    @Target(ElementType.TYPE_USE)
    1.28 +    @interface InnerTA { };
    1.29  }

mercurial