blob: 3e852a9596df795540800788f49d0eb2a37e4382 (
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
34
35
36
37
38
39
|
// Annotated ITD (field) being matched upon and extracted
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
public aspect BindingWithDeclaredAnnotationItds2 {
int A.i;
private String A.j;
public boolean[] A.k;
public static void main(String[]argv) {
A a = new A();
a.i = 5;
a.j = "hello";
a.k = new boolean[]{true,false};
}
}
class A { }
aspect X {
declare @field: int A.i: @Fruit("orange");
declare @field: String A.j: @Fruit("banana");
declare @field: boolean[] A.k: @Fruit("apple");
before(Fruit f): set(* *) && @annotation(f) {
System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
" ("+thisJoinPoint.getSourceLocation()+")");
}
}
|