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

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

mercurial