mcimadamore@550: /* ohair@554: * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. mcimadamore@550: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@550: * mcimadamore@550: * This code is free software; you can redistribute it and/or modify it mcimadamore@550: * under the terms of the GNU General Public License version 2 only, as mcimadamore@550: * published by the Free Software Foundation. mcimadamore@550: * mcimadamore@550: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@550: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@550: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@550: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@550: * accompanied this code). mcimadamore@550: * mcimadamore@550: * You should have received a copy of the GNU General Public License version mcimadamore@550: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@550: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@550: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. mcimadamore@550: */ mcimadamore@550: mcimadamore@550: /* mcimadamore@550: * @test mcimadamore@550: * @bug 6943289 mcimadamore@550: * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') mcimadamore@550: * @compile Pos03.java mcimadamore@550: */ mcimadamore@550: mcimadamore@550: class Pos03 { mcimadamore@550: mcimadamore@550: static class A extends Exception { public void m() {}; public Object f;} mcimadamore@550: static class B1 extends A {} mcimadamore@550: static class B2 extends A {} mcimadamore@550: mcimadamore@550: void m() { mcimadamore@550: try { mcimadamore@550: if (true) { mcimadamore@550: throw new B1(); mcimadamore@550: } mcimadamore@550: else { mcimadamore@550: throw new B2(); mcimadamore@550: } mcimadamore@550: } catch (final B1 | B2 ex) { mcimadamore@550: ex.m(); mcimadamore@550: System.out.println(ex.f); mcimadamore@550: } mcimadamore@550: } mcimadamore@550: }