blob: d62ce000257144d420e939ec47d68bfaa4a0ba94 (
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
|
package mypackage;
aspect Azpect {
pointcut pc(Object o) : this(o) && execution(* (Code).n*(..));
after(Object o) throwing(Exception e) : pc(o) {
System.out.println("caught it");
// e.printStackTrace();
}
}
public class Code {
// anotherCaughtMethod is NOT advised -- <<< ERROR <<< this should be advised
public void n() { throw new RuntimeException("n"); }
public static void main(String[]argv) {
try {
new Code().n();
} catch (Exception e) {
}
System.out.println("done");
}
}
|