Tue, 03 Jun 2008 13:26:47 -0700
4075303: Use javap to enquire aboput a specific inner class
4348375: Javap is not internationalized
4459541: "javap -l" shows line numbers as signed short; they should be unsigned
4501660: change diagnostic of -help as 'print this help message and exit'
4776241: unused source file in javap...
4870651: javap should recognize generics, varargs, enum
4876942: javap invoked without args does not print help screen
4880663: javap could output whitespace between class name and opening brace
4975569: javap doesn't print new flag bits
6271787: javap dumps LocalVariableTypeTable attribute in hex, needs to print a table
6305779: javap: support annotations
6439940: Clean up javap implementation
6469569: wrong check of searchpath in JavapEnvironment
6474890: javap does not open .zip files in -classpath
6587786: Javap throws error : "ERROR:Could not find <classname>" for JRE classes
6622215: javap ignores certain relevant access flags
6622216: javap names some attributes incorrectly
6622232: javap gets whitespace confused
6622260: javap prints negative bytes incorrectly in hex
Reviewed-by: ksrini
1 /*
2 * Copyright 2003-2004 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 */
24 /*
25 * @test
26 * @bug 4869233 4872709 4868735 4921949 4921209 4965701 4934916 4975565 4974939
27 * @summary Boxing/unboxing positive unit and regression tests
28 * @author gafter
29 *
30 * @compile -source 1.5 Boxing1.java
31 * @run main Boxing1
32 */
34 public class Boxing1 {
36 static Boolean _Boolean = true;
37 static boolean _boolean = _Boolean;
39 static Byte _Byte = (byte)3;
40 static byte _byte = _Byte;
42 static Character _Character = 'a';
43 static char _char = _Character;
45 static Short _Short = (short)4;
46 static short _short = _Short;
48 static Integer _Integer = 5;
49 static int _int = _Integer;
51 static Long _Long = 12L;
52 static long _long = _Long;
54 static Float _Float = 1.2f;
55 static float _float = _Float;
57 static Double _Double = 1.34;
58 static double _double = _Double;
60 public static void main(String[] args) {
61 _Double = _Integer + _Integer + 0.0d;
62 if (_Double != 10) throw new Error();
64 _Integer = 2;
65 _float = _Integer;
66 if (_float != 2.0f) throw new Error();
68 _int = 12;
69 _Float = _int + 0.0f;
70 if (_Float != 12.0f) throw new Error();
72 _Integer = 8;
73 _float = (float)_Integer;
74 if (_float != 8.0f) throw new Error();
76 _int = 9;
77 _Float = (Float)(_int + 0.0f);
78 if (_Float != 9.0f) throw new Error();
80 if (_Boolean) ; else throw new Error();
81 if (!_Boolean) throw new Error();
83 if (_Integer >= _Long) throw new Error();
85 _Character = 'a';
86 String s1 = ("_" + _Character + "_").intern();
87 if (s1 != "_a_") throw new Error(s1);
89 /* assignment operators don't work; see 4921209 */
90 if (_Integer++ != 8) throw new Error();
91 if (_Integer++ != 9) throw new Error();
92 if (++_Integer != 11) throw new Error();
93 if ((_Integer += 3) != 14) throw new Error();
94 if ((_Integer -= 3) != 11) throw new Error();
96 Integer i = 0;
97 i = i + 2;
98 i += 2;
99 if (i != 4) throw new Error();
101 int j = 0;
102 j += i;
103 if (j != 4) throw new Error();
105 Integer a[] = new Integer[1];
106 a[0] = 3;
107 a[0] += 3;
108 if (a[0] != 6) throw new Error();
110 Froobie x = new Froobie();
111 Froobie y = new Froobie();
112 x.next = y;
113 x.next.i = 4;
114 x.next.i += 4;
115 if (--x.next.i != 7) throw new Error();
116 if (x.next.i-- != 7) throw new Error();
117 if (x.next.i != 6) throw new Error();
119 boxIndex();
120 boxArray();
121 }
123 static void boxIndex() {
124 String[] a = { "hello", "world" };
125 Integer i = 0;
126 System.out.println(a[i]);
127 }
129 static void boxArray() {
130 Integer[] a2 = { 0, 1, 2, 3 };
131 for (int i : a2)
132 System.out.println(i);
133 }
135 static class Froobie {
136 Froobie next = null;
137 Integer i = 1;
138 }
140 static class Scott {
141 Integer i[];
142 Integer j[];
143 Integer k;
145 int q = i[j[k]]++;
146 }
148 class T4974939 {
149 void f() {
150 Byte b = 12;
151 Byte c = 'a';
153 Short s = 'b';
154 Short t = 12;
156 Character d = 12;
157 }
158 }
159 }