blob: fbaf338887a7ffda2afdec643b3f6c9dbf8f3050 (
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
|
import org.aspectj.testing.Tester;
public class ComputedThrows {
public static void main(String[] args) { test(); }
public static void test() {
new ComputedThrows().bar();
Tester.check("ran bar");
Tester.check("caught Exception");
}
void bar() throws Exception {
Tester.note("ran bar");
throw new Exception();
}
}
aspect Aspect {
pointcut Foo(): within(ComputedThrows) && call(* ComputedThrows.bar(..));
declare soft: Exception: Foo();
void around(): Foo() {
try {
proceed();
} catch (Exception e) {
Tester.note("caught Exception");
}
}
}
|