blob: 245d7d500a9183f905132e65bcc2d377aecf4695 (
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
40
41
42
43
44
|
import org.aspectj.testing.Tester;
/**
* PR#544 the formals passed to advice should behave just like
* any other method formal
*/
public class AdviceFormalsCp {
public static void main(String[] args) {
Tester.checkEqual(new C().m("bye"), "foo");
Tester.checkEqual(new C().mi(2.), 1);
}
}
class C {
public String m(Object p) {
return "foo";
}
public int mi(double p) {
return 1;
}
}
aspect A {
after(Object p) returning(Object o): call(* C.m*(*)) && args(p) {
p = Boolean.TRUE;
o = Boolean.TRUE;
Tester.checkEqual(p, Boolean.TRUE);
Tester.checkEqual(o, Boolean.TRUE);
}
Object around(Object p, Object o): call(* C.m*(*)) && args(p) && target(o) {
Object ret = proceed(p, o);
p = Boolean.TRUE;
o = Boolean.TRUE;
Tester.checkEqual(p, Boolean.TRUE);
Tester.checkEqual(o, Boolean.TRUE);
return ret;
}
}
|