test/tools/javac/multicatch/Neg03.java

changeset 550
a6f2911a7c55
child 735
f2048d9c666e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/multicatch/Neg03.java	Mon May 03 17:12:59 2010 -0700
     1.3 @@ -0,0 +1,27 @@
     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 mcimadamore
    1.10 + * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
    1.11 + *
    1.12 + */
    1.13 +
    1.14 +class Neg03 {
    1.15 +    static class A extends Exception {}
    1.16 +    static class B extends Exception {}
    1.17 +
    1.18 +    void m() {
    1.19 +        try {
    1.20 +            if (true) {
    1.21 +                throw new A();
    1.22 +            }
    1.23 +            else {
    1.24 +                throw new B();
    1.25 +            }
    1.26 +        } catch (final A | B ex) {
    1.27 +            ex = new B();
    1.28 +        }
    1.29 +    }
    1.30 +}

mercurial