blob: 133c602492366c357a96d7951c7f8bc3d1121069 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@interface Anno {}
aspect Foo {
declare @field: * Code.someField: -@Anno;
}
public class Code {
@Anno
public static int someField;
public static void main(String[]argv) throws Exception {
Object o = Code.class.getDeclaredField("someField").getAnnotation(Anno.class);
System.out.println(o==null?"no annotation":"has annotation");
}
}
|