test/tools/javac/multicatch/Neg03.java

changeset 735
f2048d9c666e
parent 550
a6f2911a7c55
child 2525
2eb010b6cb22
equal deleted inserted replaced
731:fadc6d3e63f4 735:f2048d9c666e
7 * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java 7 * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
8 * 8 *
9 */ 9 */
10 10
11 class Neg03 { 11 class Neg03 {
12 static class A extends Exception {}
13 static class B extends Exception {}
14 12
15 void m() { 13 static class A extends Exception { public void m() {}; public Object f;}
14 static class B1 extends A {}
15 static class B2 extends A {}
16
17 void m() throws B1, B2 {
16 try { 18 try {
17 if (true) { 19 if (true) {
18 throw new A(); 20 throw new B1();
19 } 21 }
20 else { 22 else {
21 throw new B(); 23 throw new B2();
22 } 24 }
23 } catch (final A | B ex) { 25 } catch (Exception ex) {
24 ex = new B(); 26 ex = new B2(); //effectively final analysis disabled!
27 throw ex;
25 } 28 }
26 } 29 }
27 } 30 }

mercurial