/*
* @test /nodynamiccopyright/
* @bug 7039822
* @summary Verify typing of lub of exception parameter w.r.t getClass
* @author Joseph D. Darcy
* @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java
*/
public class Neg07 {
private static void test(int i) {
try {
thrower(i);
} catch (SonException | DaughterException e) {
HasFoo m = e;
e.foo();
}
}
private static interface HasFoo {
void foo();
}
if (i == 0)
throw new SonException();
else
throw new DaughterException();
}
private static class SonException
extends ParentException
implements HasFoo {
public void foo() {
}
}
private static class DaughterException
extends ParentException
implements HasFoo {
public void foo() {
}
}
}