aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs170/language/MultiCatchWithHandler2.java
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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { col
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 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");
  }
}