blob: 0a8f7a739fc2e566fad5b49679df0c32728207bd (
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
|
public class MultiCatchWithHandler2 {
public static void main(String[] args) {
try {
foo("ta");
} catch (ExceptionA | ExceptionB ex) {
bar(ex);
}
}
public static void bar(Exception ea) {
}
public static void foo(String s) throws ExceptionA, ExceptionB {
if (s.equals("ta")) {
throw new ExceptionA();
} else {
throw new ExceptionB();
}
}
}
@SuppressWarnings("serial")
class ExceptionA extends Exception {
}
@SuppressWarnings("serial")
class ExceptionB extends Exception {
}
aspect X {
before(ExceptionA ea): handler(ExceptionA) && args(ea) {
System.out.println("advice");
}
}
|