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 { } |