test/tools/javac/multicatch/8071291/T8071291.java

Mon, 26 Oct 2015 13:23:30 -0700

author
asaha
date
Mon, 26 Oct 2015 13:23:30 -0700
changeset 2999
683b3e7e05a7
parent 2904
14891e981af0
permissions
-rw-r--r--

Added tag jdk8u76-b00 for changeset 10ffafaf5340

robm@2904 1 /*
robm@2904 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
robm@2904 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
robm@2904 4 *
robm@2904 5 * This code is free software; you can redistribute it and/or modify it
robm@2904 6 * under the terms of the GNU General Public License version 2 only, as
robm@2904 7 * published by the Free Software Foundation.
robm@2904 8 *
robm@2904 9 * This code is distributed in the hope that it will be useful, but WITHOUT
robm@2904 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
robm@2904 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
robm@2904 12 * version 2 for more details (a copy is included in the LICENSE file that
robm@2904 13 * accompanied this code).
robm@2904 14 *
robm@2904 15 * You should have received a copy of the GNU General Public License version
robm@2904 16 * 2 along with this work; if not, write to the Free Software Foundation,
robm@2904 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
robm@2904 18 *
robm@2904 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
robm@2904 20 * or visit www.oracle.com if you need additional information or have any
robm@2904 21 * questions.
robm@2904 22 */
robm@2904 23
robm@2904 24 /*
robm@2904 25 * @test
robm@2904 26 * @bug 8071291
robm@2904 27 * @summary Compiler crashes trying to cast UnionType to IntersectionClassType
robm@2904 28 * @compile T8071291.java
robm@2904 29 */
robm@2904 30
robm@2904 31 class T8071291 {
robm@2904 32
robm@2904 33 interface A { }
robm@2904 34 class Exception1 extends Exception implements A { }
robm@2904 35 class Exception2 extends Exception implements A { }
robm@2904 36
robm@2904 37 void test(boolean cond) {
robm@2904 38 try {
robm@2904 39 if (cond) {
robm@2904 40 throw new Exception1();
robm@2904 41 } else {
robm@2904 42 throw new Exception2();
robm@2904 43 }
robm@2904 44 }
robm@2904 45 catch (Exception1|Exception2 x) {
robm@2904 46 if (x instanceof Exception1) { }
robm@2904 47 }
robm@2904 48 }
robm@2904 49 }

mercurial