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

changeset 2134
b0c086cd4520
parent 1521
71f35e4b93a5
child 2525
2eb010b6cb22
equal deleted inserted replaced
2133:19e8eebfbe52 2134:b0c086cd4520
3 * @bug 6843077 8006775 3 * @bug 6843077 8006775
4 * @summary static field access isn't a valid location 4 * @summary static field access isn't a valid location
5 * @author Mahmood Ali 5 * @author Mahmood Ali
6 * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java 6 * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java
7 */ 7 */
8 import java.lang.annotation.*;
9
8 class C { 10 class C {
9 int f; 11 static int f;
12 // static block
13 static {
14 @A C.f = 1;
15 }
16 // static ref
10 int a = @A C.f; 17 int a = @A C.f;
18 // static method
19 static int f() { return @A C.f; }
20 // main
21 public static void main(String... args) {
22 int a = @A C.f;
23 }
11 } 24 }
12 25
26 @Target(ElementType.TYPE_USE)
13 @interface A { } 27 @interface A { }

mercurial