blob: bec3b7ff56bb2e6515daa27d5a7ccacb56f4c981 (
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
|
import org.aspectj.testing.Tester;
public class ObjectForInt {
public static void main(String[] args){
new Test().go();
Tester.checkEqual(Test.a, 10, "Test.a");
Tester.checkEqual(A.beforeA.intValue(), 4, "beforeA");
}
}
class Test {
public static int a = -1;
void go(){
foo(4);
}
void foo(int a){
Test.a = a;
}
}
aspect A {
public static Integer beforeA = null;
pointcut fooCut(Object i):
target(Test) && args(i) && call(void f*(*));
before(Object o): fooCut(o){
beforeA = (Integer)o;
}
void around(Object o): fooCut(o){
proceed(new Integer(10));
}
}
|