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