test/tools/javac/multicatch/Neg01eff_final.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/multicatch/Neg01eff_final.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,28 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 6943289
     1.7 + *
     1.8 + * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
     1.9 + * @author darcy
    1.10 + * @compile/fail/ref=Neg01eff_final.out -XDrawDiagnostics Neg01eff_final.java
    1.11 + * @compile -source 6 -XDrawDiagnostics Neg01eff_final.java
    1.12 + *
    1.13 + */
    1.14 +
    1.15 +class Neg01eff_final {
    1.16 +    static class A extends Exception {}
    1.17 +    static class B1 extends A {}
    1.18 +    static class B2 extends A {}
    1.19 +
    1.20 +    class Test {
    1.21 +        void m() throws A {
    1.22 +            try {
    1.23 +                throw new B1();
    1.24 +            } catch (A ex1) {
    1.25 +                try {
    1.26 +                    throw ex1; // used to throw A, now throws B1!
    1.27 +                } catch (B2 ex2) { }//unreachable
    1.28 +            }
    1.29 +        }
    1.30 +    }
    1.31 +}

mercurial