blob: 998087ac4207057c1f90dea9c904f0d7e2351c26 (
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
|
public class Driver {
public static void main(String[]argv) {
new A().mone();
new A().mtwo();
new A().mone();
new A().mtwo();
new A().mone();
new A().mtwo();
}
}
class A {
public void mone() {}
public void mtwo() {}
}
aspect X pertypewithin(*) {
int[] state = new int[5];
before(): execution(* A.*(..)) {
int id = thisJoinPointStaticPart.getId();
System.out.println("At "+thisJoinPoint.getSignature()+" id="+id+" state="+state[id]);
state[id]++;
}
}
|