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

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/target/Constructor.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,37 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 6843077 8006775
     1.7 + * @summary test invalid location of TypeUse
     1.8 + * @author Mahmood Ali
     1.9 + * @compile/fail/ref=Constructor.out -XDrawDiagnostics Constructor.java
    1.10 + */
    1.11 +
    1.12 +import java.lang.annotation.Target;
    1.13 +import java.lang.annotation.ElementType;
    1.14 +
    1.15 +class Constructor {
    1.16 +  // Constructor result type use annotation
    1.17 +  @A Constructor() { }
    1.18 +
    1.19 +  // Not type parameter annotation
    1.20 +  @B Constructor(int x) { }
    1.21 +
    1.22 +  // TODO add err: no "this" receiver parameter for constructors
    1.23 +  // Constructor(@A Constructor this, Object o) { }
    1.24 +
    1.25 +  // TODO: support Outer.this.
    1.26 +}
    1.27 +
    1.28 +class Constructor2 {
    1.29 +  class Inner {
    1.30 +    // OK
    1.31 +    @A Inner() { }
    1.32 +  }
    1.33 +}
    1.34 +
    1.35 +@Target(ElementType.TYPE_USE)
    1.36 +@interface A { }
    1.37 +
    1.38 +@Target(ElementType.TYPE_PARAMETER)
    1.39 +@interface B { }
    1.40 +

mercurial