langtools/test/tools/javac/multicatch/Neg05.java
changeset 8635 383a416a2bdf
parent 8634 222829aedfe4
child 8636 baa2c3dffe9b
equal deleted inserted replaced
8634:222829aedfe4 8635:383a416a2bdf
     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=Neg05.out -XDrawDiagnostics Neg05.java
       
     8  *
       
     9  */
       
    10 
       
    11 class Neg02 {
       
    12 
       
    13     static class Foo<X> {
       
    14        Foo(X x) {}
       
    15     }
       
    16 
       
    17     static interface Base<X> {}
       
    18     static class A extends Exception implements Base<String> {}
       
    19     static class B extends Exception implements Base<Integer> {}
       
    20 
       
    21     void m() {
       
    22         try {
       
    23             if (true) {
       
    24                 throw new A();
       
    25             }
       
    26             else {
       
    27                 throw new B();
       
    28             }
       
    29         } catch (A | B ex) {
       
    30             Foo<?> f = new Foo<>(ex);
       
    31         }
       
    32     }
       
    33 }