test/tools/javac/annotations/typeAnnotations/failures/target/Constructor.java

Wed, 21 Aug 2013 16:13:50 -0700

author
jjg
date
Wed, 21 Aug 2013 16:13:50 -0700
changeset 1969
7de231613e4a
parent 0
959103a6100f
permissions
-rw-r--r--

8023515: import type-annotations updates
Reviewed-by: jjg
Contributed-by: wdietl@gmail.com

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 6843077 8006775
     4  * @summary test invalid location of TypeUse
     5  * @author Mahmood Ali
     6  * @compile/fail/ref=Constructor.out -XDrawDiagnostics Constructor.java
     7  */
     9 import java.lang.annotation.Target;
    10 import java.lang.annotation.ElementType;
    12 class Constructor {
    13   // Constructor result type use annotation
    14   @A Constructor() { }
    16   // Not type parameter annotation
    17   @B Constructor(int x) { }
    19   // TODO add err: no "this" receiver parameter for constructors
    20   // Constructor(@A Constructor this, Object o) { }
    22   // TODO: support Outer.this.
    23 }
    25 class Constructor2 {
    26   class Inner {
    27     // OK
    28     @A Inner() { }
    29   }
    30 }
    32 @Target(ElementType.TYPE_USE)
    33 @interface A { }
    35 @Target(ElementType.TYPE_PARAMETER)
    36 @interface B { }

mercurial