test/tools/javac/boxing/T6816548.java

Wed, 25 Mar 2009 10:28:52 +0000

author
mcimadamore
date
Wed, 25 Mar 2009 10:28:52 +0000
changeset 253
6ce39250fa88
child 554
9d9f26857129
permissions
-rw-r--r--

6816548: Uninitialized register when performing casting + auto(un)boxing
Summary: Constant value of final variable is lost during lowering
Reviewed-by: jjg

mcimadamore@253 1 /*
mcimadamore@253 2 * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@253 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@253 4 *
mcimadamore@253 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@253 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@253 7 * published by the Free Software Foundation.
mcimadamore@253 8 *
mcimadamore@253 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@253 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@253 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@253 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@253 13 * accompanied this code).
mcimadamore@253 14 *
mcimadamore@253 15 * You should have received a copy of the GNU General Public License version
mcimadamore@253 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@253 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@253 18 *
mcimadamore@253 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@253 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@253 21 * have any questions.
mcimadamore@253 22 */
mcimadamore@253 23
mcimadamore@253 24 /*
mcimadamore@253 25 * @test
mcimadamore@253 26 * @bug 6816548
mcimadamore@253 27 * @summary Uninitialized register when performing casting + auto(un)boxing
mcimadamore@253 28 * @author mcimadamore
mcimadamore@253 29 */
mcimadamore@253 30 public class T6816548 {
mcimadamore@253 31
mcimadamore@253 32 public static void main(String[] args) {
mcimadamore@253 33 testInt();
mcimadamore@253 34 testShort();
mcimadamore@253 35 testByte();
mcimadamore@253 36 testChar();
mcimadamore@253 37 }
mcimadamore@253 38
mcimadamore@253 39 public static void testInt() {
mcimadamore@253 40 final int fi = 0;
mcimadamore@253 41 Byte b = fi;
mcimadamore@253 42 Short s = fi;
mcimadamore@253 43 Character c = fi;
mcimadamore@253 44 }
mcimadamore@253 45
mcimadamore@253 46 public static void testShort() {
mcimadamore@253 47 final short fs = 0;
mcimadamore@253 48 Byte b = fs;
mcimadamore@253 49 Short s = fs;
mcimadamore@253 50 Character c = fs;
mcimadamore@253 51 }
mcimadamore@253 52
mcimadamore@253 53 public static void testByte() {
mcimadamore@253 54 final byte fb = 0;
mcimadamore@253 55 Byte b = fb;
mcimadamore@253 56 Short s = fb;
mcimadamore@253 57 Character c = fb;
mcimadamore@253 58 }
mcimadamore@253 59
mcimadamore@253 60 public static void testChar() {
mcimadamore@253 61 final char fc = '0';
mcimadamore@253 62 Byte b = fc;
mcimadamore@253 63 Short s = fc;
mcimadamore@253 64 Character c = fc;
mcimadamore@253 65 }
mcimadamore@253 66 }

mercurial