2002-12-16 19:51:06 +01:00
|
|
|
|
|
|
|
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");
|
2004-01-28 01:36:05 +01:00
|
|
|
I i = new C();
|
|
|
|
|
|
|
|
Tester.checkEqual(i.i, 2, "i.i");
|
|
|
|
|
2002-12-16 19:51:06 +01:00
|
|
|
Tester.checkAllEvents();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I {}
|
|
|
|
|
|
|
|
class C implements I {
|
|
|
|
C() {
|
|
|
|
Tester.event("constructor");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aspect A {
|
|
|
|
int I.i;
|
2004-01-28 01:36:05 +01:00
|
|
|
after(I i) returning: this(i) && initialization(I.new(..)) {
|
|
|
|
i.i = 2;
|
2002-12-16 19:51:06 +01:00
|
|
|
}
|
2004-01-28 01:36:05 +01:00
|
|
|
after() returning: initialization(I.new(..)) {
|
2002-12-16 19:51:06 +01:00
|
|
|
Tester.event("advice");
|
|
|
|
}
|
|
|
|
}
|