mcimadamore@120: /* ohair@554: * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. mcimadamore@120: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@120: * mcimadamore@120: * This code is free software; you can redistribute it and/or modify it mcimadamore@120: * under the terms of the GNU General Public License version 2 only, as mcimadamore@120: * published by the Free Software Foundation. mcimadamore@120: * mcimadamore@120: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@120: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@120: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@120: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@120: * accompanied this code). mcimadamore@120: * mcimadamore@120: * You should have received a copy of the GNU General Public License version mcimadamore@120: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@120: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@120: * 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@120: */ mcimadamore@120: mcimadamore@120: /* mcimadamore@120: * @test mcimadamore@120: * @bug 6500343 mcimadamore@120: * @summary compiler generates bad code when translating conditional expressions mcimadamore@120: * @author Maurizio Cimadamore mcimadamore@120: * mcimadamore@120: */ mcimadamore@120: mcimadamore@120: public class T6500343a { mcimadamore@120: static class Base {} mcimadamore@120: static interface I {} mcimadamore@120: static class A1 extends Base implements I {} mcimadamore@120: static class A2 extends Base implements I {} mcimadamore@120: mcimadamore@120: static Object crash(I i, A1 a1, A2 a2, boolean b1, boolean b2) { mcimadamore@120: return b1 ? i : b2 ? a2 : a1; mcimadamore@120: // lub(I, lub(A1, A2)) ==> lub(I, Base&I) ==> I (doesn't compile on 1.4 ok >1.5) mcimadamore@120: } mcimadamore@120: mcimadamore@120: public static void main(String[] args) { mcimadamore@120: T6500343a.crash(new A1(), new A1(), new A2(), true, false); mcimadamore@120: T6500343a.crash(new A1(), new A1(), new A2(), false, true); mcimadamore@120: T6500343a.crash(new A1(), new A1(), new A2(), false, false); mcimadamore@120: T6500343a.crash(new A1(), new A1(), new A2(), true, true); mcimadamore@120: } mcimadamore@120: } mcimadamore@120: