mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-14 02:10:40 +02:00
5834de9783
Erroneous exception conversion and Bugzilla Bug 34206 before():execution(new(..)) does not throw NoAspectBoundException All exceptions that occur during the static intialization of a persingleton aspect will be swallowed. When using that aspect (via aspectOf()) a NoAspectBoundException will be thrown with the original exception from the staitc initializer as the cause.
31 lines
895 B
Java
31 lines
895 B
Java
import org.aspectj.testing.*;
|
|
import org.aspectj.lang.*;
|
|
|
|
/**
|
|
* -usejavac mode: no error
|
|
* not -usejavac mode: VerifyError
|
|
*/
|
|
public class ConstructorExecInitFails {
|
|
public static void main(String[] args) {
|
|
try {
|
|
new ConstructorExecInitFails();
|
|
} catch (NoAspectBoundException e) {
|
|
|
|
Tester.check(e.getCause() instanceof NoAspectBoundException,
|
|
"Expected NoAspectBoundException, found " + e.getCause());
|
|
return;
|
|
}
|
|
Tester.checkFailed("shouldn't be able to run");
|
|
}
|
|
}
|
|
|
|
/** @testcase after returning from initialization and after executing constructor */
|
|
aspect A {
|
|
after (Object target) : execution(*.new(..)) && target(target) {
|
|
Tester.checkFailed("shouldn't be able to run");
|
|
}
|
|
after () returning (Object target) : initialization(new(..)) {
|
|
Tester.checkFailed("shouldn't be able to run");
|
|
}
|
|
}
|