15385
|
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 |
*/
|
21041
|
8 |
import java.lang.annotation.*;
|
|
9 |
|
15385
|
10 |
class C {
|
21041
|
11 |
static int f;
|
|
12 |
// static block
|
|
13 |
static {
|
|
14 |
@A C.f = 1;
|
|
15 |
}
|
|
16 |
// static ref
|
15385
|
17 |
int a = @A C.f;
|
21041
|
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 |
}
|
15385
|
24 |
}
|
|
25 |
|
21041
|
26 |
@Target(ElementType.TYPE_USE)
|
15385
|
27 |
@interface A { }
|