blob: e042f10ff5137011609933b8941d37139cc93432 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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");
}
}
|