mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-14 02:10:40 +02:00
6cceb1b9c3
duplicate warning or second join point for constructor-execution
34 lines
711 B
Java
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");
|
|
}
|
|
}
|