blob: 476b2adec1b85733c9d9f89445f8898086a10428 (
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
|
public class ExceptionCheckCE {
void go() {
try {
String s = new String("hello");
} catch (RuntimeException e) { // CW 8: pointcut works, but can't throw Exceptions
// body of handler here
if (null == e) {
throw new Error("never happens");
}
}
}
}
/** @testcase PR#37898 advice on handler join points should not throw unpermitted checked exceptions */
aspect A {
pointcut goHandler() :
handler(RuntimeException) && withincode(void go());
declare warning : goHandler() : "expected warning"; // just verifying pointcut
before() throws Exception : goHandler() { // CE 25 can't throw from handler
throw new Exception("bad");
}
}
|