Thu, 03 Feb 2011 09:36:28 +0000
5017953: spurious cascaded diagnostics when name not found
Summary: when an operator is applied to one or more erroneous operands, spurious diagnostics are generated
Reviewed-by: jjg
mcimadamore@735 | 1 | /* |
mcimadamore@735 | 2 | * @test /nodynamiccopyright/ |
mcimadamore@735 | 3 | * @bug 6943289 |
mcimadamore@735 | 4 | * |
mcimadamore@735 | 5 | * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') |
mcimadamore@735 | 6 | * @author mcimadamore |
mcimadamore@735 | 7 | * @compile/fail/ref=Neg05.out -XDrawDiagnostics Neg05.java |
mcimadamore@735 | 8 | * |
mcimadamore@735 | 9 | */ |
mcimadamore@735 | 10 | |
mcimadamore@735 | 11 | class Neg02 { |
mcimadamore@735 | 12 | |
mcimadamore@735 | 13 | static class Foo<X> { |
mcimadamore@735 | 14 | Foo(X x) {} |
mcimadamore@735 | 15 | } |
mcimadamore@735 | 16 | |
mcimadamore@735 | 17 | static interface Base<X> {} |
mcimadamore@735 | 18 | static class A extends Exception implements Base<String> {} |
mcimadamore@735 | 19 | static class B extends Exception implements Base<Integer> {} |
mcimadamore@735 | 20 | |
mcimadamore@735 | 21 | void m() { |
mcimadamore@735 | 22 | try { |
mcimadamore@735 | 23 | if (true) { |
mcimadamore@735 | 24 | throw new A(); |
mcimadamore@735 | 25 | } |
mcimadamore@735 | 26 | else { |
mcimadamore@735 | 27 | throw new B(); |
mcimadamore@735 | 28 | } |
mcimadamore@735 | 29 | } catch (A | B ex) { |
mcimadamore@735 | 30 | Foo<?> f = new Foo<>(ex); |
mcimadamore@735 | 31 | } |
mcimadamore@735 | 32 | } |
mcimadamore@735 | 33 | } |