blob: 11413e801fb2ac1e28da5cb79cafe60922d74665 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public aspect Wibble {
declare @field: (@III *) Song.*: @Foo;
before(): get((@III *) Song.*) {
System.out.println();
}
public static void main(String []argv) throws Exception {
System.out.println(Song.class.getDeclaredField("i").getAnnotation(Foo.class));
}
}
@III
class XX {
}
class Song {
XX i;
void foo() {
System.out.println(i);
}
}
@Retention(RetentionPolicy.RUNTIME)
@interface III {}
@Retention(RetentionPolicy.RUNTIME)
@interface Foo {}
|