org.aspectj/tests/new/AfterReturningInterfaceConstructor.java
jhugunin 6cceb1b9c3 fix for Bugzilla Bug 49295
duplicate warning or second join point for constructor-execution
2004-01-28 00:36:05 +00:00

34 lines
711 B
Java

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");
}
}