blob: f16f563bf05cd5572000db10ec49fd47504a130b (
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
|
import org.aspectj.testing.Tester;
/** @testcase PR#889 after returning advice on interface constructor */
public class AfterReturningInterfaceConstructor {
public static void main (String[] args) {
Tester.expectEvent("constructor");
Tester.expectEvent("advice");
I i = new C();
Tester.checkEqual(i.i, 2, "i.i");
Tester.checkAllEvents();
}
}
interface I {}
class C implements I {
C() {
Tester.event("constructor");
}
}
aspect A {
int I.i;
after(I i) returning: this(i) && initialization(I.new(..)) {
i.i = 2;
}
after() returning: initialization(I.new(..)) {
Tester.event("advice");
}
}
|