blob: d456c0a0528289c1fdbe3958c3c6d87fca182c07 (
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
31
32
33
34
35
36
37
38
39
|
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.*;
public class Code {
public static void main(String []argv) {
try {
foo();
} catch (Throwable t) {
System.out.println("Caught "+t);
}
}
public static void foo() {
print1("abc");
print2("def");
print1("ghi");
}
public static void print1(String s) {
System.out.println(s);
}
public static void print2(String s) {
System.out.println(s);
}
}
@Aspect
class Azpect {
@Around("call(* print2(..))")
public Object one(ProceedingJoinPoint pjp) {
return pjp.proceed();
}
@Around("call(* print2(..))")
public Object two(ProceedingJoinPoint pjp) {
//return pjp.proceed();
throw new IllegalStateException("");
}
}
|