0N/A/*
0N/A * @test /nodynamiccopyright/
0N/A * @bug 7039822
0N/A * @summary Verify typing of lub of exception parameter w.r.t getClass
0N/A * @author Joseph D. Darcy
0N/A * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java
0N/A */
0N/A
0N/Apublic class Neg07 {
0N/A private static void test(int i) {
0N/A try {
0N/A thrower(i);
0N/A } catch (SonException | DaughterException e) {
0N/A Class<? extends HasFoo> clazz2 = e.getClass(); // Rejected!
0N/A HasFoo m = e;
0N/A e.foo();
0N/A }
0N/A }
0N/A
0N/A private static interface HasFoo {
0N/A void foo();
0N/A }
0N/A
0N/A static void thrower(int i) throws SonException, DaughterException {
0N/A if (i == 0)
0N/A throw new SonException();
0N/A else
0N/A throw new DaughterException();
0N/A }
0N/A
0N/A private static class ParentException extends RuntimeException {}
0N/A
0N/A private static class SonException
0N/A extends ParentException
0N/A implements HasFoo {
0N/A
0N/A public void foo() {
0N/A System.out.println("SonException.foo");
0N/A }
0N/A }
0N/A
0N/A private static class DaughterException
0N/A extends ParentException
0N/A implements HasFoo {
0N/A
0N/A public void foo() {
0N/A System.out.println("DaughterException.foo");
0N/A }
0N/A }
0N/A}
0N/A