blob: a756c2e23915327e341c2f4543d49cd6e9a11888 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@interface Anno {
String foo();
}
public aspect WithValues {
@Anno(foo="anc")
int i;
declare @field: int i: -@Anno;
public static void main(String[] args) throws Exception {
if (WithValues.class.getDeclaredField("i").getAnnotation(Anno.class)==null) {
System.out.println("not there");
} else {
System.out.println("failed");
}
}
}
|