0N/A/*
553N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A * @test
0N/A * @bug 4869233 4872709 4868735 4921949 4921209 4965701 4934916 4975565 4974939
0N/A * @summary Boxing/unboxing positive unit and regression tests
0N/A * @author gafter
0N/A */
0N/A
0N/Apublic class Boxing1 {
0N/A
0N/A static Boolean _Boolean = true;
0N/A static boolean _boolean = _Boolean;
0N/A
0N/A static Byte _Byte = (byte)3;
0N/A static byte _byte = _Byte;
0N/A
0N/A static Character _Character = 'a';
0N/A static char _char = _Character;
0N/A
0N/A static Short _Short = (short)4;
0N/A static short _short = _Short;
0N/A
0N/A static Integer _Integer = 5;
0N/A static int _int = _Integer;
0N/A
0N/A static Long _Long = 12L;
0N/A static long _long = _Long;
0N/A
0N/A static Float _Float = 1.2f;
0N/A static float _float = _Float;
0N/A
0N/A static Double _Double = 1.34;
0N/A static double _double = _Double;
0N/A
0N/A public static void main(String[] args) {
0N/A _Double = _Integer + _Integer + 0.0d;
0N/A if (_Double != 10) throw new Error();
0N/A
0N/A _Integer = 2;
0N/A _float = _Integer;
0N/A if (_float != 2.0f) throw new Error();
0N/A
0N/A _int = 12;
0N/A _Float = _int + 0.0f;
0N/A if (_Float != 12.0f) throw new Error();
0N/A
0N/A _Integer = 8;
0N/A _float = (float)_Integer;
0N/A if (_float != 8.0f) throw new Error();
0N/A
0N/A _int = 9;
0N/A _Float = (Float)(_int + 0.0f);
0N/A if (_Float != 9.0f) throw new Error();
0N/A
0N/A if (_Boolean) ; else throw new Error();
0N/A if (!_Boolean) throw new Error();
0N/A
0N/A if (_Integer >= _Long) throw new Error();
0N/A
0N/A _Character = 'a';
0N/A String s1 = ("_" + _Character + "_").intern();
0N/A if (s1 != "_a_") throw new Error(s1);
0N/A
0N/A /* assignment operators don't work; see 4921209 */
0N/A if (_Integer++ != 8) throw new Error();
0N/A if (_Integer++ != 9) throw new Error();
0N/A if (++_Integer != 11) throw new Error();
0N/A if ((_Integer += 3) != 14) throw new Error();
0N/A if ((_Integer -= 3) != 11) throw new Error();
0N/A
0N/A Integer i = 0;
0N/A i = i + 2;
0N/A i += 2;
0N/A if (i != 4) throw new Error();
0N/A
0N/A int j = 0;
0N/A j += i;
0N/A if (j != 4) throw new Error();
0N/A
0N/A Integer a[] = new Integer[1];
0N/A a[0] = 3;
0N/A a[0] += 3;
0N/A if (a[0] != 6) throw new Error();
0N/A
0N/A Froobie x = new Froobie();
0N/A Froobie y = new Froobie();
0N/A x.next = y;
0N/A x.next.i = 4;
0N/A x.next.i += 4;
0N/A if (--x.next.i != 7) throw new Error();
0N/A if (x.next.i-- != 7) throw new Error();
0N/A if (x.next.i != 6) throw new Error();
0N/A
0N/A boxIndex();
0N/A boxArray();
0N/A }
0N/A
0N/A static void boxIndex() {
0N/A String[] a = { "hello", "world" };
0N/A Integer i = 0;
0N/A System.out.println(a[i]);
0N/A }
0N/A
0N/A static void boxArray() {
0N/A Integer[] a2 = { 0, 1, 2, 3 };
0N/A for (int i : a2)
0N/A System.out.println(i);
0N/A }
0N/A
0N/A static class Froobie {
0N/A Froobie next = null;
0N/A Integer i = 1;
0N/A }
0N/A
0N/A static class Scott {
0N/A Integer i[];
0N/A Integer j[];
0N/A Integer k;
0N/A
0N/A int q = i[j[k]]++;
0N/A }
0N/A
0N/A class T4974939 {
0N/A void f() {
0N/A Byte b = 12;
0N/A Byte c = 'a';
0N/A
0N/A Short s = 'b';
0N/A Short t = 12;
0N/A
0N/A Character d = 12;
0N/A }
0N/A }
0N/A}