blob: 4c26cd196b4143b5837710e872a4f171ba6328dd (
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: * Code2.someField: -@Anno;
@Anno
public int Code2.someField;
}
public class Code2 {
public static void main(String[]argv) throws Exception {
Object o = Code2.class.getDeclaredField("someField").getAnnotation(Anno.class);
System.out.println(o==null?"no annotation":"has annotation");
}
}
|