test/tools/javac/conditional/6500343/T6500343b.java

Mon, 29 Sep 2008 11:34:43 +0100

author
mcimadamore
date
Mon, 29 Sep 2008 11:34:43 +0100
changeset 120
ddd110646d21
child 554
9d9f26857129
permissions
-rw-r--r--

6500343: compiler generates bad code when translating conditional expressions
Summary: TransTypes needs to deal with intersection types coming from conditional expressions
Reviewed-by: jjg

mcimadamore@120 1 /*
mcimadamore@120 2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@120 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@120 4 *
mcimadamore@120 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@120 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@120 7 * published by the Free Software Foundation.
mcimadamore@120 8 *
mcimadamore@120 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@120 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@120 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@120 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@120 13 * accompanied this code).
mcimadamore@120 14 *
mcimadamore@120 15 * You should have received a copy of the GNU General Public License version
mcimadamore@120 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@120 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@120 18 *
mcimadamore@120 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@120 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@120 21 * have any questions.
mcimadamore@120 22 */
mcimadamore@120 23
mcimadamore@120 24 /*
mcimadamore@120 25 * @test
mcimadamore@120 26 * @bug 6500343
mcimadamore@120 27 * @summary compiler generates bad code when translating conditional expressions
mcimadamore@120 28 * @author Maurizio Cimadamore
mcimadamore@120 29 *
mcimadamore@120 30 */
mcimadamore@120 31
mcimadamore@120 32 public class T6500343b {
mcimadamore@120 33
mcimadamore@120 34 final static int i1 = 0;
mcimadamore@120 35 final static int i2 = 1;
mcimadamore@120 36
mcimadamore@120 37 static void crash(int i) {
mcimadamore@120 38 switch (i) {
mcimadamore@120 39 case (true ? 0 : 1):
mcimadamore@120 40 case (i1 == 5 ? 1 : 2):
mcimadamore@120 41 case (i1 == i2 ? 2 : 3):
mcimadamore@120 42 }
mcimadamore@120 43 }
mcimadamore@120 44
mcimadamore@120 45 public static void main(String[] args) {
mcimadamore@120 46 T6500343b.crash(0);
mcimadamore@120 47 }
mcimadamore@120 48 }

mercurial