blob: d84e4ef3278e3a343d634df9c38eecb012c520b1 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import org.aspectj.testing.Tester;
/**
* PR#527 bug in 1.0beta1 but not HEAD as of 9/24/01
* @testcase compile error using pcd if() with advice on introduced methods.
*/
public class PR527 {
public static void main(String[] args) {
new C().run();
Tester.checkAllEvents();
}
static {
Tester.expectEvent("run");
Tester.expectEvent("test");
// Tester.expectEvent("trigger"); replaced in around
Tester.expectEvent("after");
Tester.expectEvent("callback");
Tester.expectEvent("around");
}
}
class C {
public void run() {
Tester.event("run");
}
}
aspect A {
interface I {
}
public boolean I.test() {
Tester.event("test");
return true;
}
public void I.trigger() {
Tester.event("trigger"); // should not run
}
public void I.callback() {
Tester.event("callback");
}
declare parents: C implements I;
after (C c) : target(c) && execution(public void C.run()) {
Tester.event("after");
((I) c).trigger();
}
void around(I i)
: target(i)
&& execution(public void I.trigger())
&& if(i.test()) {
Tester.event("around");
i.callback();
}
}
|