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

Print this page


   1 /*
   2  * @test /nodynamiccopyright/
   3  * @bug 6843077 8006775
   4  * @summary static field access isn't a valid location
   5  * @author Mahmood Ali
   6  * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java
   7  */


   8 class C {
   9   int f;
  10   int a = @A C.f;
  11 }
  12 

  13 @interface A { }
   1 /*
   2  * @test /nodynamiccopyright/
   3  * @bug 6843077 8006775
   4  * @summary static field access isn't a valid location
   5  * @author Mahmood Ali
   6  * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java
   7  */
   8 import java.lang.annotation.*;
   9 
  10 class C {
  11   int f;
  12   int a = @A C.f;
  13 }
  14 
  15 @Target(ElementType.TYPE_USE)
  16 @interface A { }