test/tools/javac/multicatch/Neg05.java

Fri, 28 Jan 2011 12:01:07 +0000

author
mcimadamore
date
Fri, 28 Jan 2011 12:01:07 +0000
changeset 844
2088e674f0e0
parent 735
f2048d9c666e
permissions
-rw-r--r--

6910550: javac 1.5.0_17 fails with incorrect error message
Summary: multiple clashing members declared in same class should be added to the class' scope in order to avoid downstream spurious diagnostics
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 }

mercurial