mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-14 02:10:40 +02:00
27 lines
714 B
Java
27 lines
714 B
Java
import org.aspectj.testing.*;
|
|
|
|
/**
|
|
* -usejavac mode: no error
|
|
* not -usejavac mode: VerifyError
|
|
*/
|
|
public class ConstructorExecInit {
|
|
public static void main(String[] args) {
|
|
new ConstructorExecInit();
|
|
Tester.checkAllEvents();
|
|
}
|
|
static {
|
|
Tester.expectEvent("execution");
|
|
Tester.expectEvent("initialization");
|
|
}
|
|
}
|
|
|
|
/** @testcase after returning from initialization and after executing constructor */
|
|
aspect A {
|
|
after (Object target) : execution(*.new(..)) && target(target) && !within(A) {
|
|
Tester.event("execution");
|
|
}
|
|
after () returning (Object target) : initialization(new(..)) && !this(A) {
|
|
Tester.event("initialization");
|
|
}
|
|
}
|