test/tools/javac/multicatch/Neg03.java

Thu, 31 Aug 2017 15:17:03 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:17:03 +0800
changeset 2525
2eb010b6cb22
parent 735
f2048d9c666e
parent 0
959103a6100f
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * @test /nodynamiccopyright/
aoqi@0 3 * @bug 6943289
aoqi@0 4 *
aoqi@0 5 * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
aoqi@0 6 * @author mcimadamore
aoqi@0 7 * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
aoqi@0 8 *
aoqi@0 9 */
aoqi@0 10
aoqi@0 11 class Neg03 {
aoqi@0 12
aoqi@0 13 static class A extends Exception { public void m() {}; public Object f;}
aoqi@0 14 static class B1 extends A {}
aoqi@0 15 static class B2 extends A {}
aoqi@0 16
aoqi@0 17 void m() throws B1, B2 {
aoqi@0 18 try {
aoqi@0 19 if (true) {
aoqi@0 20 throw new B1();
aoqi@0 21 }
aoqi@0 22 else {
aoqi@0 23 throw new B2();
aoqi@0 24 }
aoqi@0 25 } catch (Exception ex) {
aoqi@0 26 ex = new B2(); //effectively final analysis disabled!
aoqi@0 27 throw ex;
aoqi@0 28 }
aoqi@0 29 }
aoqi@0 30 }

mercurial