test/tools/javac/multicatch/Neg03.java

Thu, 04 Nov 2010 12:57:48 +0000

author
mcimadamore
date
Thu, 04 Nov 2010 12:57:48 +0000
changeset 735
f2048d9c666e
parent 550
a6f2911a7c55
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6993963: Project Coin: Use precise exception analysis for effectively final catch parameters
Summary: More precise rethrow analysis should be extended to effectively-final exception parameters. Multicatch parameters should be made implicitly final.
Reviewed-by: jjg, darcy

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

mercurial