1 /*******************************************************************************
2  * Copyright (c) 2003, 2014 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.jdt.core.tests.compiler.regression;
15 
16 import java.io.File;
17 
18 import junit.framework.Test;
19 
20 import org.eclipse.jdt.core.ToolFactory;
21 import org.eclipse.jdt.core.tests.util.Util;
22 import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
23 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
24 import org.eclipse.jdt.internal.compiler.env.ClassSignature;
25 import org.eclipse.jdt.internal.compiler.env.EnumConstantSignature;
26 import org.eclipse.jdt.internal.compiler.impl.BooleanConstant;
27 import org.eclipse.jdt.internal.compiler.impl.ByteConstant;
28 import org.eclipse.jdt.internal.compiler.impl.CharConstant;
29 import org.eclipse.jdt.internal.compiler.impl.Constant;
30 import org.eclipse.jdt.internal.compiler.impl.DoubleConstant;
31 import org.eclipse.jdt.internal.compiler.impl.FloatConstant;
32 import org.eclipse.jdt.internal.compiler.impl.IntConstant;
33 import org.eclipse.jdt.internal.compiler.impl.LongConstant;
34 import org.eclipse.jdt.internal.compiler.impl.ShortConstant;
35 import org.eclipse.jdt.internal.compiler.impl.StringConstant;
36 import org.eclipse.jdt.internal.compiler.problem.ShouldNotImplement;
37 
38 @SuppressWarnings({ "rawtypes" })
39 public class ConstantTest extends AbstractRegressionTest {
40 
ConstantTest(String name)41 public ConstantTest(String name) {
42 	super(name);
43 }
44 // Use this static initializer to specify subset for tests
45 // All specified tests which does not belong to the class are skipped...
46 static {
47 //	TESTS_PREFIX = "testBug95521";
48 //	TESTS_NAMES = new String[] { "testBug83127a" };
49 //	TESTS_NUMBERS = new int[] { 21 };
50 //	TESTS_RANGE = new int[] { 23, -1 };
51 }
suite()52 public static Test suite() {
53 	return buildAllCompliancesTestSuite(testClass());
54 }
test001()55 public void test001() {
56 	this.runConformTest(new String[] {
57 		"p/X.java",
58 		"package p;\n" +
59 		"public class  X { \n" +
60 		"public static void main (String args []) {\n" +
61 		"  foo(); \n" +
62 		"}\n" +
63 		"public static void foo() {\n" +
64 		"  if(55f!=00000000000000000000055F)      // HERE VA/Java detects an unexpected error\n" +
65 		"  {\n" +
66 		"System.out.println(\"55f!=00000000000000000000055F\");\n" +
67 		"  }\n" +
68 		"  else\n" +
69 		"  {\n" +
70 		"System.out.println(\"55f==00000000000000000000055F\");\n" +
71 		"  }\n" +
72 		" }      \n" +
73 		"}\n",
74 	});
75 }
76 
test002()77 public void test002() {
78 	this.runConformTest(new String[] {
79 		"p/X.java",
80 		"package p;\n" +
81 		"public class X {\n" +
82 		"  public static void main (String args []) {\n" +
83 		"    foo();\n" +
84 		"  }\n" +
85 		"  public static void foo() {\n" +
86 		"    if(55f!=00000000000000000000055F)      // HERE VA/Java detects an unexpected error\n" +
87 		"      {\n" +
88 		"      System.out.println(\"55f!=00000000000000000000055F\");\n" +
89 		"    }\n" +
90 		"    else\n" +
91 		"    {\n" +
92 		"      System.out.println(\"55f==00000000000000000000055F\");\n" +
93 		"    }\n" +
94 		"  }      \n" +
95 		"}\n",
96 	});
97 }
98 
test003()99 public void test003() {
100 	this.runConformTest(new String[] {
101 		"p/Z.java",
102 		"package p;\n" +
103 		"public class Z {\n" +
104 		"  public static void main(String[] cargs) throws Exception {\n" +
105 		"    System.out.println(System.getProperty(\"java.vm.info\", \"J9\"));\n" +
106 		"    System.out.write((byte) 0x89);\n" +
107 		"    System.out.println();\n" +
108 		"    System.out.println(\"\u00E2?\u00B0\");\n" +
109 		"    System.out.println(Integer.toHexString(\"\u00E2?\u00B0\".charAt(0)));\n" +
110 		"  }\n" +
111 		"}\n",
112 	});
113 }
114 
test004()115 public void test004() {
116 	this.runConformTest(
117 		new String[] {
118 			"TempClassFormat.java",
119 			"/**\n" +
120 			" * Insert the type's description here.\n" +
121 			" * Creation date: (02/28/01 2:58:07 PM)\n" +
122 			" * @author: Administrator\n" +
123 			" */\n" +
124 			"public class TempClassFormat {\n" +
125 			"		// ERROR NUMBERS\n" +
126 			"\n" +
127 			"	// Blank field error numbers\n" +
128 			"	private static final String PERSON_ID_BLANK = \"2\";\n" +
129 			"	private static final String DEMOGRAPHIC_TYPE_BLANK = \"3\";\n" +
130 			"	private static final String EMPLOYEE_NUMBER_BLANK = \"23\";\n" +
131 			"	private static final String WORK_PHONE_AREA_CODE_BLANK = \"25\";\n" +
132 			"	private static final String WORK_PHONE1_BLANK = \"26\";\n" +
133 			"	private static final String WORK_PHONE2_BLANK = \"27\";\n" +
134 			"	private static final String WORK_ADDRESS1_BLANK = \"28\";\n" +
135 			"	private static final String WORK_CITY_BLANK = \"29\";\n" +
136 			"	private static final String WORK_STATE_BLANK = \"30\";\n" +
137 			"	private static final String WORK_ZIP5_BLANK = \"31\";\n" +
138 			"	private static final String BENEFITS_SALARY_BLANK = \"32\";\n" +
139 			"	private static final String TRUE_SALARY_BLANK = \"33\";\n" +
140 			"	private static final String PAY_FREQUENCY_BLANK = \"34\";\n" +
141 			"	private static final String WORK_HOURS_BLANK = \"35\";\n" +
142 			"	private static final String LOCATION_ID_BLANK = \"36\";\n" +
143 			"	private static final String SALARY_GRADE_BLANK = \"37\";\n" +
144 			"	private static final String DATE_OF_HIRE_BLANK = \"38\";\n" +
145 			"	private static final String RETIRE_VEST_PERCENT_BLANK = \"39\";\n" +
146 			"	private static final String JOB_CODE_BLANK = \"40\";\n" +
147 			"	private static final String UNION_FLAG_BLANK = \"41\";\n" +
148 			"	private static final String OFFICER_FLAG_BLANK = \"42\";\n" +
149 			"	private static final String PIN_USER_ID_BLANK = \"43\";\n" +
150 			"	private static final String VENDOR_EMPLOYEE_ID_BLANK = \"44\";\n" +
151 			"	private static final String MODIFIED_BY_BLANK = \"8\";\n" +
152 			"	private static final String MODIFIED_DATE_BLANK = \"9\";\n" +
153 			"	\n" +
154 			"	\n" +
155 			"	// Invalid field error numbers\n" +
156 			"	private static final String DEMOGRAPHIC_TYPE_INVALID = \"54\";\n" +
157 			"	private static final String EMPLOYER_ID_INVALID = \"22\";\n" +
158 			"	private static final String WORK_STATE_INVALID = \"70\";\n" +
159 			"	private static final String PAY_FREQUENCY_INVALID = \"138\";\n" +
160 			"	private static final String WORK_HOURS_TOO_SMALL = \"140\";\n" +
161 			"	private static final String DATE_OF_HIRE_INVALID = \"75\";\n" +
162 			"	private static final String DATE_OF_HIRE_AFTER_TODAY = \"137\";\n" +
163 			"	private static final String RETIRE_VEST_PERCENT_TOO_LARGE = \"77\";\n" +
164 			"	private static final String RETIRE_VEST_PERCENT_TOO_SMALL = \"139\";\n" +
165 			"	private static final String UNION_FLAG_INVALID = \"78\";\n" +
166 			"	private static final String OFFICER_FLAG_INVALID = \"79\";\n" +
167 			"	private static final String BENEFIT_GROUP_ID_INVALID = \"45\";\n" +
168 			"	private static final String LAST_PERSON_SEQ_NUMBER_INVALID = \"80\";\n" +
169 			"\n" +
170 			"	// Field not numeric error numbers\n" +
171 			"	private static final String WORK_PHONE_AREA_CODE_NOT_NUMERIC = \"67\";\n" +
172 			"	private static final String WORK_PHONE1_NOT_NUMERIC = \"68\";\n" +
173 			"	private static final String WORK_PHONE2_NOT_NUMERIC = \"69\";\n" +
174 			"	private static final String WORK_PHONE_EXTENSION_NOT_NUMERIC = \"109\";\n" +
175 			"	private static final String WORK_ZIP5_NOT_NUMERIC = \"71\";\n" +
176 			"	private static final String WORK_ZIP4_NOT_NUMERIC = \"46\";\n" +
177 			"	private static final String BENEFITS_SALARY_NOT_NUMERIC = \"72\";\n" +
178 			"	private static final String TRUE_SALARY_NOT_NUMERIC = \"73\";\n" +
179 			"	private static final String WORK_HOURS_NOT_NUMERIC = \"74\";\n" +
180 			"	private static final String RETIRE_VEST_PERCENT_NOT_NUMERIC = \"76\";\n" +
181 			"	\n" +
182 			"	// Field too short error numbers\n" +
183 			"	private static final String WORK_PHONE_AREA_CODE_TOO_SHORT = \"110\";\n" +
184 			"	private static final String WORK_PHONE1_TOO_SHORT = \"111\";\n" +
185 			"	private static final String WORK_PHONE2_TOO_SHORT = \"112\";\n" +
186 			"	private static final String WORK_STATE_TOO_SHORT = \"113\";\n" +
187 			"	private static final String WORK_ZIP5_TOO_SHORT = \"114\";\n" +
188 			"	private static final String WORK_ZIP4_TOO_SHORT = \"115\";\n" +
189 			"\n" +
190 			"	// Field too long error numbers\n" +
191 			"	private static final String PERSON_ID_TOO_LONG = \"82\";\n" +
192 			"	private static final String EMPLOYEE_NUMBER_TOO_LONG = \"116\";\n" +
193 			"	private static final String WORK_PHONE_AREA_CODE_TOO_LONG = \"117\";\n" +
194 			"	private static final String WORK_PHONE1_TOO_LONG = \"118\";\n" +
195 			"	private static final String WORK_PHONE2_TOO_LONG = \"119\";\n" +
196 			"	private static final String WORK_PHONE_EXTENSION_TOO_LONG = \"120\";\n" +
197 			"	private static final String WORK_ADDRESS1_TOO_LONG = \"121\";\n" +
198 			"	private static final String WORK_ADDRESS2_TOO_LONG = \"122\";\n" +
199 			"	private static final String WORK_CITY_TOO_LONG = \"123\";\n" +
200 			"	private static final String WORK_STATE_TOO_LONG = \"124\";\n" +
201 			"	private static final String WORK_ZIP5_TOO_LONG = \"125\";\n" +
202 			"	private static final String WORK_ZIP4_TOO_LONG = \"126\";\n" +
203 			"	private static final String BENEFITS_SALARY_TOO_LONG = \"127\";\n" +
204 			"	private static final String TRUE_SALARY_TOO_LONG = \"128\";\n" +
205 			"	private static final String WORK_HOURS_TOO_LONG = \"129\";\n" +
206 			"	private static final String LOCATION_ID_TOO_LONG = \"130\";\n" +
207 			"	private static final String SALARY_GRADE_TOO_LONG = \"131\";\n" +
208 			"	private static final String RETIRE_VEST_PERCENT_TOO_LONG = \"132\";\n" +
209 			"	private static final String JOB_CODE_TOO_LONG = \"133\";\n" +
210 			"	private static final String PIN_USER_ID_TOO_LONG = \"134\";\n" +
211 			"	private static final String VENDOR_EMPLOYEE_ID_TOO_LONG = \"135\";\n" +
212 			"	private static final String MODIFIED_BY_TOO_LONG = \"86\";\n" +
213 			"\n" +
214 			"	// Administrator approval error numbers\n" +
215 			"	private static final String EMPLOYER_ID_REQ_APPR = \"623\";\n" +
216 			"	private static final String EMPLOYEE_NUMBER_REQ_APPR = \"624\";\n" +
217 			"	private static final String STATUS_FLAG_REQ_APPR = \"625\";\n" +
218 			"	private static final String WORK_PHONE_AREA_CODE_REQ_APPR = \"626\";\n" +
219 			"	private static final String WORK_PHONE1_REQ_APPR = \"627\";\n" +
220 			"	private static final String WORK_PHONE2_REQ_APPR = \"628\";\n" +
221 			"	private static final String WORK_PHONE_EXTENSION_REQ_APPR = \"629\";\n" +
222 			"	private static final String WORK_ADDRESS1_REQ_APPR = \"630\";\n" +
223 			"	private static final String WORK_ADDRESS2_REQ_APPR = \"631\";\n" +
224 			"	private static final String WORK_CITY_REQ_APPR = \"632\";\n" +
225 			"	private static final String WORK_STATE_REQ_APPR = \"633\";\n" +
226 			"	private static final String WORK_ZIP5_REQ_APPR = \"634\";\n" +
227 			"	private static final String WORK_ZIP4_REQ_APPR = \"635\";\n" +
228 			"	private static final String BENEFITS_SALARY_REQ_APPR = \"636\";\n" +
229 			"	private static final String TRUE_SALARY_REQ_APPR = \"637\";\n" +
230 			"	private static final String PAY_FREQUENCY_REQ_APPR = \"638\";\n" +
231 			"	private static final String WORK_HOURS_REQ_APPR = \"639\";\n" +
232 			"	private static final String LOCATION_ID_REQ_APPR = \"640\";\n" +
233 			"	private static final String SALARY_GRADE_REQ_APPR = \"641\";\n" +
234 			"	private static final String DATE_OF_HIRE_REQ_APPR = \"642\";\n" +
235 			"	private static final String RETIRE_VEST_PERCENT_REQ_APPR = \"643\";\n" +
236 			"	private static final String JOB_CODE_REQ_APPR = \"644\";\n" +
237 			"	private static final String UNION_FLAG_REQ_APPR = \"645\";\n" +
238 			"	private static final String OFFICER_FLAG_REQ_APPR = \"646\";\n" +
239 			"	private static final String PIN_USER_ID_REQ_APPR = \"647\";\n" +
240 			"	private static final String VENDOR_EMPLOYEE_ID_REQ_APPR = \"648\";\n" +
241 			"	private static final String BENEFIT_GROUP_ID_REQ_APPR = \"649\";\n" +
242 			"	private static final String LAST_PERSON_SEQ_NBR_REQ_APPR = \"650\";\n" +
243 			"	\n" +
244 			"public static void main(String[] args) {\n" +
245 			"		System.out.println(\"Success\");\n" +
246 			"}\n" +
247 			"}"
248 		},
249 		"Success");
250 }
251 
test005()252 public void test005() {
253 	this.runConformTest(
254 		new String[] {
255 			"Code.java",
256 			"public class Code {\n" +
257 			"  public static final String s = \"<clinit>\";\n" +
258 			"  public static final String s2 = \"()V\";\n" +
259 			"  public Code(int i) {\n" +
260 			"  }\n" +
261 			"public static void main(String[] args) {\n" +
262 			"  System.out.print(s.length());\n" +
263 			"  System.out.println(s2.length());\n" +
264 			"}\n" +
265 			"}"
266 		},
267 		"83");
268 }
269 
test006()270 public void test006() {
271 	this.runConformTest(
272 		new String[] {
273 			"p1/X.java",
274 			"package p1;	\n" +
275 			"public class X {	\n" +
276 			"	X otherX;	\n" +
277 			"	static String STR = \"SUCCESS\";	\n" +
278 			"	public static void main(String args[]) {	\n" +
279 			"		try {	\n" +
280 			"			System.out.println(new X().otherX.STR);	\n" +
281 			"		} catch(NullPointerException e){	\n" +
282 			"			System.out.println(\"FAILED\");	\n" +
283 			"		}	\n" +
284 			"	}	\n" +
285 			"}	\n",
286 		},
287 		"SUCCESS");
288 }
289 
290 /*
291  * null is not a constant
292  * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26585
293  */
test007()294 public void test007() {
295 	this.runConformTest(
296 		new String[] {
297 			"X.java",
298 			"public class X {	\n"+
299 			"    public static final boolean F = false;	\n"+
300 			"    public static final String Str = F ? \"dummy\" : null;	\n"+
301 			"    public static void main(String[] args) {	\n"+
302 			"        if (Str == null)	\n"+
303 			"        	System.out.println(\"SUCCESS\");	\n"+
304 			"       	else	\n"+
305 			"        	System.out.println(\"FAILED\");	\n"+
306 			"    }	\n"+
307 			"}	\n",
308 		},
309 		"SUCCESS");
310 }
311 
312 /*
313  * null is not a constant
314  * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138
315  */
test008()316 public void test008() {
317 	this.runConformTest(
318 		new String[] {
319 			"X.java",
320 			"public class X {	\n"+
321 			"    public static void main(String[] args) {	\n"+
322 			"      	System.out.println(\"SUCCESS\");	\n"+
323 			"	} 	\n"+
324 			"	void foo(){	\n"+
325 			"		while (null == null);	//not an inlinable constant\n"+
326 			"		System.out.println(\"unreachable but shouldn't be flagged\");	\n" +
327 			"	}	\n"+
328 			"}	\n",
329 		},
330 		"SUCCESS");
331 }
332 
333 /*
334  * null is not a constant
335  * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138
336  */
337 /*
338  * null is not a constant
339  * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138
340  */
test009()341 public void test009() throws Exception {
342 	this.runConformTest(
343 		new String[] {
344 			"X.java",
345 			"public class X {	\n" +
346 			"    public static void main(String[] args) {	\n" +
347 			"        if (null == null) System.out.print(\"1\");	\n" +
348 			"        if ((null==null ? null:null) == (null==null ? null:null))	\n" +
349 			"        	System.out.print(\"2\");	\n" +
350 			"		boolean b = (\"[\" + null + \"]\") == \"[null]\";  // cannot inline	\n" +
351 			"		System.out.print(\"3\");	\n" +
352 			"		final String s = (String) null;	\n" +
353 			"		if (s == null) System.out.print(\"4\");	\n" +
354 			"		final String s2 = (String) \"aaa\";	\n" +
355 			"		if (s2 == \"aaa\") System.out.println(\"5\");	\n" +
356 			"    }	\n" +
357 			"}",
358 		},
359 		"12345");
360 
361 	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
362 	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator  +"X.class"));
363 	String actualOutput =
364 		disassembler.disassemble(
365 			classFileBytes,
366 			"\n",
367 			ClassFileBytesDisassembler.DETAILED);
368 
369 	String expectedOutput =
370 			"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
371 			"  // Stack: 3, Locals: 4\n" +
372 			"  public static void main(java.lang.String[] args);\n" +
373 			"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
374 			"     3  ldc <String \"1\"> [22]\n" +
375 			"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
376 			"     8  aconst_null\n" +
377 			"     9  aconst_null\n" +
378 			"    10  if_acmpne 21\n" +
379 			"    13  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
380 			"    16  ldc <String \"2\"> [30]\n" +
381 			"    18  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
382 			"    21  new java.lang.StringBuffer [32]\n" +
383 			"    24  dup\n" +
384 			"    25  ldc <String \"[\"> [34]\n" +
385 			"    27  invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" +
386 			"    30  aconst_null\n" +
387 			"    31  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" +
388 			"    34  ldc <String \"]\"> [42]\n" +
389 			"    36  invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" +
390 			"    39  invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" +
391 			"    42  ldc <String \"[null]\"> [51]\n" +
392 			"    44  if_acmpne 51\n" +
393 			"    47  iconst_1\n" +
394 			"    48  goto 52\n" +
395 			"    51  iconst_0\n" +
396 			"    52  istore_1 [b]\n" +
397 			"    53  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
398 			"    56  ldc <String \"3\"> [53]\n" +
399 			"    58  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
400 			"    61  aconst_null\n" +
401 			"    62  astore_2 [s]\n" +
402 			"    63  aload_2 [s]\n" +
403 			"    64  ifnonnull 75\n" +
404 			"    67  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
405 			"    70  ldc <String \"4\"> [55]\n" +
406 			"    72  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
407 			"    75  ldc <String \"aaa\"> [57]\n" +
408 			"    77  astore_3 [s2]\n" +
409 			"    78  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
410 			"    81  ldc <String \"5\"> [59]\n" +
411 			"    83  invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
412 			"    86  return\n" +
413 			"      Line numbers:\n" +
414 			"        [pc: 0, line: 3]\n" +
415 			"        [pc: 8, line: 4]\n" +
416 			"        [pc: 13, line: 5]\n" +
417 			"        [pc: 21, line: 6]\n" +
418 			"        [pc: 53, line: 7]\n" +
419 			"        [pc: 61, line: 8]\n" +
420 			"        [pc: 63, line: 9]\n" +
421 			"        [pc: 75, line: 10]\n" +
422 			"        [pc: 78, line: 11]\n" +
423 			"        [pc: 86, line: 12]\n" +
424 			"      Local variable table:\n" +
425 			"        [pc: 0, pc: 87] local: args index: 0 type: java.lang.String[]\n" +
426 			"        [pc: 53, pc: 87] local: b index: 1 type: boolean\n" +
427 			"        [pc: 63, pc: 87] local: s index: 2 type: java.lang.String\n" +
428 			"        [pc: 78, pc: 87] local: s2 index: 3 type: java.lang.String\n";
429 
430 	String expectedOutput15 =
431 			"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
432 			"  // Stack: 3, Locals: 4\n" +
433 			"  public static void main(java.lang.String[] args);\n" +
434 			"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
435 			"     3  ldc <String \"1\"> [22]\n" +
436 			"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
437 			"     8  aconst_null\n" +
438 			"     9  aconst_null\n" +
439 			"    10  if_acmpne 21\n" +
440 			"    13  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
441 			"    16  ldc <String \"2\"> [30]\n" +
442 			"    18  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
443 			"    21  new java.lang.StringBuilder [32]\n" +
444 			"    24  dup\n" +
445 			"    25  ldc <String \"[\"> [34]\n" +
446 			"    27  invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" +
447 			"    30  aconst_null\n" +
448 			"    31  invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" +
449 			"    34  ldc <String \"]\"> [42]\n" +
450 			"    36  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" +
451 			"    39  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" +
452 			"    42  ldc <String \"[null]\"> [51]\n" +
453 			"    44  if_acmpne 51\n" +
454 			"    47  iconst_1\n" +
455 			"    48  goto 52\n" +
456 			"    51  iconst_0\n" +
457 			"    52  istore_1 [b]\n" +
458 			"    53  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
459 			"    56  ldc <String \"3\"> [53]\n" +
460 			"    58  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
461 			"    61  aconst_null\n" +
462 			"    62  astore_2 [s]\n" +
463 			"    63  aload_2 [s]\n" +
464 			"    64  ifnonnull 75\n" +
465 			"    67  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
466 			"    70  ldc <String \"4\"> [55]\n" +
467 			"    72  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
468 			"    75  ldc <String \"aaa\"> [57]\n" +
469 			"    77  astore_3 [s2]\n" +
470 			"    78  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
471 			"    81  ldc <String \"5\"> [59]\n" +
472 			"    83  invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
473 			"    86  return\n" +
474 			"      Line numbers:\n" +
475 			"        [pc: 0, line: 3]\n" +
476 			"        [pc: 8, line: 4]\n" +
477 			"        [pc: 13, line: 5]\n" +
478 			"        [pc: 21, line: 6]\n" +
479 			"        [pc: 53, line: 7]\n" +
480 			"        [pc: 61, line: 8]\n" +
481 			"        [pc: 63, line: 9]\n" +
482 			"        [pc: 75, line: 10]\n" +
483 			"        [pc: 78, line: 11]\n" +
484 			"        [pc: 86, line: 12]\n" +
485 			"      Local variable table:\n" +
486 			"        [pc: 0, pc: 87] local: args index: 0 type: java.lang.String[]\n" +
487 			"        [pc: 53, pc: 87] local: b index: 1 type: boolean\n" +
488 			"        [pc: 63, pc: 87] local: s index: 2 type: java.lang.String\n" +
489 			"        [pc: 78, pc: 87] local: s2 index: 3 type: java.lang.String\n";
490 
491 	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
492 		int index = actualOutput.indexOf(expectedOutput15);
493 		if (index == -1 || expectedOutput15.length() == 0) {
494 			System.out.println(Util.displayString(actualOutput, 2));
495 		}
496 		if (index == -1) {
497 			assertEquals("Wrong contents", expectedOutput15, actualOutput);
498 		}
499 	} else {
500 		int index = actualOutput.indexOf(expectedOutput);
501 		if (index == -1 || expectedOutput.length() == 0) {
502 			System.out.println(Util.displayString(actualOutput, 2));
503 		}
504 		if (index == -1) {
505 			assertEquals("Wrong contents", expectedOutput, actualOutput);
506 		}
507 	}
508 }
509 
510 /*
511  * null is not a constant
512  * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138
513  */
test010()514 public void test010() throws Exception {
515 	this.runConformTest(
516 		new String[] {
517 			"X.java",
518 			"public class X {	\n" +
519 			"    public static void main(String[] args) {	\n" +
520 			"       if (null == null) {\n"+
521 			"			System.out.print(\"SUCCESS\");	\n" +
522 			"			return;	\n" +
523 			"		}	\n" +
524 			"		System.out.print(\"SHOULDN'T BE GENERATED\");	\n" +
525 			"    }	\n" +
526 			"}	\n",
527 		},
528 		"SUCCESS");
529 
530 	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
531 	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator  +"X.class"));
532 	String actualOutput =
533 		disassembler.disassemble(
534 			classFileBytes,
535 			"\n",
536 			ClassFileBytesDisassembler.DETAILED);
537 
538 	String expectedOutput =
539 		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
540 		"  // Stack: 2, Locals: 1\n" +
541 		"  public static void main(java.lang.String[] args);\n" +
542 		"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
543 		"     3  ldc <String \"SUCCESS\"> [22]\n" +
544 		"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
545 		"     8  return\n" +
546 		"     9  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
547 		"    12  ldc <String \"SHOULDN\'T BE GENERATED\"> [30]\n" +
548 		"    14  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
549 		"    17  return\n" +
550 		"      Line numbers:\n" +
551 		"        [pc: 0, line: 4]\n" +
552 		"        [pc: 8, line: 5]\n" +
553 		"        [pc: 9, line: 7]\n" +
554 		"        [pc: 17, line: 8]\n" +
555 		"      Local variable table:\n" +
556 		"        [pc: 0, pc: 18] local: args index: 0 type: java.lang.String[]\n";
557 	int index = actualOutput.indexOf(expectedOutput);
558 	if (index == -1 || expectedOutput.length() == 0) {
559 		System.out.println(Util.displayString(actualOutput, 2));
560 	}
561 	if (index == -1) {
562 		assertEquals("Wrong contents", expectedOutput, actualOutput);
563 	}
564 }
565 
566 //http://bugs.eclipse.org/bugs/show_bug.cgi?id=30704
test011()567 public void test011() {
568 	this.runConformTest(
569 		new String[] {
570 			"A.java",
571 			"public class A {\n" +
572 			"    public static void main(String[] args) {\n" +
573 			"		System.out.print((01.f == 1) && (01e0f == 1));	\n" +
574 			"    }\n" +
575 			"}",
576 		},
577 		"true");
578 }
579 
580 //http://bugs.eclipse.org/bugs/show_bug.cgi?id=79545
test012()581 public void test012() {
582 	this.runConformTest(
583 		new String[] {
584 			"X.java",
585 			"public class X {\n" +
586 			"	public static String C = \"\" + +\' \';\n" +
587 			"    public static String I = \"\" + +32;\n" +
588 			"\n" +
589 			"    public static void main(String[] args) {\n" +
590 			"        System.out.print(C);\n" +
591 			"        System.out.print(I);\n" +
592 			"    }\n" +
593 			"}",
594 		},
595 		"3232");
596 }
597 //http://bugs.eclipse.org/bugs/show_bug.cgi?id=97190
test013()598 public void test013() {
599 	this.runNegativeTest(
600 		new String[] {
601 			"X.java",
602 			"public class X {\n" +
603 			"	public static void main(String[] args) {\n" +
604 			"		System.out.println(-9223372036854775809L); // KO\n" +
605 			"		System.out.println(9223372036854775809L); // KO\n" +
606 			"		System.out.println(9223372036854775808L); // KO\n" +
607 			"		System.out.println(23092395825689123986L); // KO\n" +
608 			"		System.out.println(-9223372036854775808L); // OK\n" +
609 			"		System.out.println(9223372036854775807L); // OK\n" +
610 			"		System.out.println(2309239582568912398L); // OK\n" +
611 			"	}\n" +
612 			"}",
613 		},
614 		"----------\n" +
615 		"1. ERROR in X.java (at line 3)\n" +
616 		"	System.out.println(-9223372036854775809L); // KO\n" +
617 		"	                    ^^^^^^^^^^^^^^^^^^^^\n" +
618 		"The literal 9223372036854775809L of type long is out of range \n" +
619 		"----------\n" +
620 		"2. ERROR in X.java (at line 4)\n" +
621 		"	System.out.println(9223372036854775809L); // KO\n" +
622 		"	                   ^^^^^^^^^^^^^^^^^^^^\n" +
623 		"The literal 9223372036854775809L of type long is out of range \n" +
624 		"----------\n" +
625 		"3. ERROR in X.java (at line 5)\n" +
626 		"	System.out.println(9223372036854775808L); // KO\n" +
627 		"	                   ^^^^^^^^^^^^^^^^^^^^\n" +
628 		"The literal 9223372036854775808L of type long is out of range \n" +
629 		"----------\n" +
630 		"4. ERROR in X.java (at line 6)\n" +
631 		"	System.out.println(23092395825689123986L); // KO\n" +
632 		"	                   ^^^^^^^^^^^^^^^^^^^^^\n" +
633 		"The literal 23092395825689123986L of type long is out of range \n" +
634 		"----------\n");
635 }
636 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182
test014()637 public void test014() throws Exception {
638 	if (this.complianceLevel > ClassFileConstants.JDK1_5) return;
639 	this.runConformTest(
640 		new String[] {
641 			"X.java",
642 			"public class X {\n" +
643 			"	X fx;\n" +
644 			"	final static boolean DBG = false;\n" +
645 			"	void foo1(X x) {\n" +
646 			"		if (x.DBG) {\n" +
647 			"			boolean b = x.DBG;\n" +
648 			"		}\n" +
649 			"		boolean bb;\n" +
650 			"		if (bb = x.DBG) {\n" +
651 			"			boolean b = x.DBG;\n" +
652 			"		}\n" +
653 			"	}\n" +
654 			"	void foo2(X x) {\n" +
655 			"		while (x.DBG) {\n" +
656 			"			boolean b = x.DBG;\n" +
657 			"		}\n" +
658 			"	}\n" +
659 			"	void foo3(X x) {\n" +
660 			"		for (;x.DBG;) {\n" +
661 			"			boolean b = x.DBG;\n" +
662 			"		}\n" +
663 			"	}\n" +
664 			"	void foo4(X x) {\n" +
665 			"		boolean b = x.DBG ? x == null : x.DBG;\n" +
666 			"	}\n" +
667 			"	void foo5() {\n" +
668 			"		if (this.fx.DBG) {\n" +
669 			"			boolean b = this.fx.DBG;\n" +
670 			"		}\n" +
671 			"	}\n" +
672 			"	void foo6() {\n" +
673 			"		while (this.fx.DBG) {\n" +
674 			"			boolean b = this.fx.DBG;\n" +
675 			"		}\n" +
676 			"	}\n" +
677 			"	void foo7() {\n" +
678 			"		for (;this.fx.DBG;) {\n" +
679 			"			boolean b = this.fx.DBG;\n" +
680 			"		}\n" +
681 			"	}\n" +
682 			"	void foo8() {\n" +
683 			"		boolean b = this.fx.DBG ? this.fx == null : this.fx.DBG;\n" +
684 			"	}\n" +
685 			"}\n",
686 		},
687 		"");
688 	// ensure boolean codegen got optimized (optimizedBooleanConstant)
689 	String expectedOutput =
690 		"  // Method descriptor #20 (LX;)V\n" +
691 		"  // Stack: 2, Locals: 4\n" +
692 		"  void foo1(X x);\n" +
693 		"    0  iconst_0\n" +
694 		"    1  dup\n" +
695 		"    2  istore_2 [bb]\n" +
696 		"    3  ifeq 8\n" +
697 		"    6  iconst_0\n" +
698 		"    7  istore_3\n" +
699 		"    8  return\n" +
700 		"      Line numbers:\n" +
701 		"        [pc: 0, line: 9]\n" +
702 		"        [pc: 6, line: 10]\n" +
703 		"        [pc: 8, line: 12]\n" +
704 		"      Local variable table:\n" +
705 		"        [pc: 0, pc: 9] local: this index: 0 type: X\n" +
706 		"        [pc: 0, pc: 9] local: x index: 1 type: X\n" +
707 		"        [pc: 3, pc: 9] local: bb index: 2 type: boolean\n" +
708 		"  \n" +
709 		"  // Method descriptor #20 (LX;)V\n" +
710 		"  // Stack: 0, Locals: 2\n" +
711 		"  void foo2(X x);\n" +
712 		"    0  return\n" +
713 		"      Line numbers:\n" +
714 		"        [pc: 0, line: 17]\n" +
715 		"      Local variable table:\n" +
716 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
717 		"        [pc: 0, pc: 1] local: x index: 1 type: X\n" +
718 		"  \n" +
719 		"  // Method descriptor #20 (LX;)V\n" +
720 		"  // Stack: 0, Locals: 2\n" +
721 		"  void foo3(X x);\n" +
722 		"    0  return\n" +
723 		"      Line numbers:\n" +
724 		"        [pc: 0, line: 22]\n" +
725 		"      Local variable table:\n" +
726 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
727 		"        [pc: 0, pc: 1] local: x index: 1 type: X\n" +
728 		"  \n" +
729 		"  // Method descriptor #20 (LX;)V\n" +
730 		"  // Stack: 1, Locals: 3\n" +
731 		"  void foo4(X x);\n" +
732 		"    0  iconst_0\n" +
733 		"    1  istore_2 [b]\n" +
734 		"    2  return\n" +
735 		"      Line numbers:\n" +
736 		"        [pc: 0, line: 24]\n" +
737 		"        [pc: 2, line: 25]\n" +
738 		"      Local variable table:\n" +
739 		"        [pc: 0, pc: 3] local: this index: 0 type: X\n" +
740 		"        [pc: 0, pc: 3] local: x index: 1 type: X\n" +
741 		"        [pc: 2, pc: 3] local: b index: 2 type: boolean\n" +
742 		"  \n" +
743 		"  // Method descriptor #12 ()V\n" +
744 		"  // Stack: 0, Locals: 1\n" +
745 		"  void foo5();\n" +
746 		"    0  return\n" +
747 		"      Line numbers:\n" +
748 		"        [pc: 0, line: 30]\n" +
749 		"      Local variable table:\n" +
750 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
751 		"  \n" +
752 		"  // Method descriptor #12 ()V\n" +
753 		"  // Stack: 0, Locals: 1\n" +
754 		"  void foo6();\n" +
755 		"    0  return\n" +
756 		"      Line numbers:\n" +
757 		"        [pc: 0, line: 35]\n" +
758 		"      Local variable table:\n" +
759 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
760 		"  \n" +
761 		"  // Method descriptor #12 ()V\n" +
762 		"  // Stack: 0, Locals: 1\n" +
763 		"  void foo7();\n" +
764 		"    0  return\n" +
765 		"      Line numbers:\n" +
766 		"        [pc: 0, line: 40]\n" +
767 		"      Local variable table:\n" +
768 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
769 		"  \n" +
770 		"  // Method descriptor #12 ()V\n" +
771 		"  // Stack: 1, Locals: 2\n" +
772 		"  void foo8();\n" +
773 		"    0  iconst_0\n" +
774 		"    1  istore_1 [b]\n" +
775 		"    2  return\n" +
776 		"      Line numbers:\n" +
777 		"        [pc: 0, line: 42]\n" +
778 		"        [pc: 2, line: 43]\n" +
779 		"      Local variable table:\n" +
780 		"        [pc: 0, pc: 3] local: this index: 0 type: X\n" +
781 		"        [pc: 2, pc: 3] local: b index: 1 type: boolean\n";
782 
783 	File f = new File(OUTPUT_DIR + File.separator + "X.class");
784 	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
785 	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
786 	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
787 	int index = result.indexOf(expectedOutput);
788 	if (index == -1 || expectedOutput.length() == 0) {
789 		System.out.println(Util.displayString(result, 3));
790 	}
791 	if (index == -1) {
792 		assertEquals("Wrong contents", expectedOutput, result);
793 	}
794 
795 }
796 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182 - variation
test015()797 public void test015() throws Exception {
798 	if(this.complianceLevel > ClassFileConstants.JDK1_5) return;
799 	this.runConformTest(
800 		new String[] {
801 			"X.java",
802 			"public class X {\n" +
803 			"	X fx;\n" +
804 			"	final static boolean DBG = false;\n" +
805 			"	void foo1(X x) {\n" +
806 			"		if (x.DBG) {\n" +
807 			"			boolean b = x.DBG;\n" +
808 			"		}\n" +
809 			"		boolean bb;\n" +
810 			"		if (bb = x.DBG) {\n" +
811 			"			boolean b = x.DBG;\n" +
812 			"		}\n" +
813 			"	}\n" +
814 			"	void foo2(X x) {\n" +
815 			"		while (x.DBG) {\n" +
816 			"			boolean b = x.DBG;\n" +
817 			"		}\n" +
818 			"	}\n" +
819 			"	void foo3(X x) {\n" +
820 			"		for (;x.DBG;) {\n" +
821 			"			boolean b = x.DBG;\n" +
822 			"		}\n" +
823 			"	}\n" +
824 			"	void foo4(X x) {\n" +
825 			"		boolean b = x.DBG ? x == null : x.DBG;\n" +
826 			"	}\n" +
827 			"	void foo5() {\n" +
828 			"		if (this.fx.DBG) {\n" +
829 			"			boolean b = this.fx.DBG;\n" +
830 			"		}\n" +
831 			"	}\n" +
832 			"	void foo6() {\n" +
833 			"		while (this.fx.DBG) {\n" +
834 			"			boolean b = this.fx.DBG;\n" +
835 			"		}\n" +
836 			"	}\n" +
837 			"	void foo7() {\n" +
838 			"		for (;this.fx.DBG;) {\n" +
839 			"			boolean b = this.fx.DBG;\n" +
840 			"		}\n" +
841 			"	}\n" +
842 			"	void foo8() {\n" +
843 			"		boolean b = this.fx.DBG ? this.fx == null : this.fx.DBG;\n" +
844 			"	}\n" +
845 			"}\n",
846 		},
847 		"");
848 	// ensure boolean codegen got optimized (optimizedBooleanConstant)
849 	String expectedOutput =
850 		"  // Method descriptor #20 (LX;)V\n" +
851 		"  // Stack: 2, Locals: 4\n" +
852 		"  void foo1(X x);\n" +
853 		"    0  iconst_0\n" +
854 		"    1  dup\n" +
855 		"    2  istore_2 [bb]\n" +
856 		"    3  ifeq 8\n" +
857 		"    6  iconst_0\n" +
858 		"    7  istore_3\n" +
859 		"    8  return\n" +
860 		"      Line numbers:\n" +
861 		"        [pc: 0, line: 9]\n" +
862 		"        [pc: 6, line: 10]\n" +
863 		"        [pc: 8, line: 12]\n" +
864 		"      Local variable table:\n" +
865 		"        [pc: 0, pc: 9] local: this index: 0 type: X\n" +
866 		"        [pc: 0, pc: 9] local: x index: 1 type: X\n" +
867 		"        [pc: 3, pc: 9] local: bb index: 2 type: boolean\n" +
868 		"  \n" +
869 		"  // Method descriptor #20 (LX;)V\n" +
870 		"  // Stack: 0, Locals: 2\n" +
871 		"  void foo2(X x);\n" +
872 		"    0  return\n" +
873 		"      Line numbers:\n" +
874 		"        [pc: 0, line: 17]\n" +
875 		"      Local variable table:\n" +
876 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
877 		"        [pc: 0, pc: 1] local: x index: 1 type: X\n" +
878 		"  \n" +
879 		"  // Method descriptor #20 (LX;)V\n" +
880 		"  // Stack: 0, Locals: 2\n" +
881 		"  void foo3(X x);\n" +
882 		"    0  return\n" +
883 		"      Line numbers:\n" +
884 		"        [pc: 0, line: 22]\n" +
885 		"      Local variable table:\n" +
886 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
887 		"        [pc: 0, pc: 1] local: x index: 1 type: X\n" +
888 		"  \n" +
889 		"  // Method descriptor #20 (LX;)V\n" +
890 		"  // Stack: 1, Locals: 3\n" +
891 		"  void foo4(X x);\n" +
892 		"    0  iconst_0\n" +
893 		"    1  istore_2 [b]\n" +
894 		"    2  return\n" +
895 		"      Line numbers:\n" +
896 		"        [pc: 0, line: 24]\n" +
897 		"        [pc: 2, line: 25]\n" +
898 		"      Local variable table:\n" +
899 		"        [pc: 0, pc: 3] local: this index: 0 type: X\n" +
900 		"        [pc: 0, pc: 3] local: x index: 1 type: X\n" +
901 		"        [pc: 2, pc: 3] local: b index: 2 type: boolean\n" +
902 		"  \n" +
903 		"  // Method descriptor #12 ()V\n" +
904 		"  // Stack: 0, Locals: 1\n" +
905 		"  void foo5();\n" +
906 		"    0  return\n" +
907 		"      Line numbers:\n" +
908 		"        [pc: 0, line: 30]\n" +
909 		"      Local variable table:\n" +
910 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
911 		"  \n" +
912 		"  // Method descriptor #12 ()V\n" +
913 		"  // Stack: 0, Locals: 1\n" +
914 		"  void foo6();\n" +
915 		"    0  return\n" +
916 		"      Line numbers:\n" +
917 		"        [pc: 0, line: 35]\n" +
918 		"      Local variable table:\n" +
919 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
920 		"  \n" +
921 		"  // Method descriptor #12 ()V\n" +
922 		"  // Stack: 0, Locals: 1\n" +
923 		"  void foo7();\n" +
924 		"    0  return\n" +
925 		"      Line numbers:\n" +
926 		"        [pc: 0, line: 40]\n" +
927 		"      Local variable table:\n" +
928 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
929 		"  \n" +
930 		"  // Method descriptor #12 ()V\n" +
931 		"  // Stack: 1, Locals: 2\n" +
932 		"  void foo8();\n" +
933 		"    0  iconst_0\n" +
934 		"    1  istore_1 [b]\n" +
935 		"    2  return\n" +
936 		"      Line numbers:\n" +
937 		"        [pc: 0, line: 42]\n" +
938 		"        [pc: 2, line: 43]\n" +
939 		"      Local variable table:\n" +
940 		"        [pc: 0, pc: 3] local: this index: 0 type: X\n" +
941 		"        [pc: 2, pc: 3] local: b index: 1 type: boolean\n";
942 
943 	File f = new File(OUTPUT_DIR + File.separator + "X.class");
944 	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
945 	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
946 	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
947 	int index = result.indexOf(expectedOutput);
948 	if (index == -1 || expectedOutput.length() == 0) {
949 		System.out.println(Util.displayString(result, 3));
950 	}
951 	if (index == -1) {
952 		assertEquals("Wrong contents", expectedOutput, result);
953 	}
954 }
955 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182 - variation
test016()956 public void test016() throws Exception {
957 	if(this.complianceLevel > ClassFileConstants.JDK1_5) return;
958 	this.runConformTest(
959 		new String[] {
960 			"X.java",
961 			"public class X {\n" +
962 			"	X fx;\n" +
963 			"	final static boolean DBG = false;\n" +
964 			"	void foo1(X x) {\n" +
965 			"		boolean b;\n" +
966 			"		if (false ? false : x.DBG) {\n" +
967 			"			boolean bb = x.DBG;\n" +
968 			"		}\n" +
969 			"	}\n" +
970 			"	void foo2(X x) {\n" +
971 			"		boolean b;\n" +
972 			"		while (x == null ? x.DBG : x.DBG) {\n" +
973 			"			boolean bb = x.DBG;\n" +
974 			"		}\n" +
975 			"	}\n" +
976 			"	void foo3(X x) {\n" +
977 			"		boolean b;\n" +
978 			"		for (;x == null ? x.DBG : x.DBG;) {\n" +
979 			"			boolean bb = x.DBG;\n" +
980 			"		}\n" +
981 			"	}\n" +
982 			"	void foo4(X x) {\n" +
983 			"		boolean bb = (x == null ? x.DBG :  x.DBG) ? x == null : x.DBG;\n" +
984 			"	}\n" +
985 			"}\n",
986 		},
987 		"");
988 	// ensure boolean codegen got optimized (optimizedBooleanConstant)
989 	String expectedOutput =
990 		"  // Method descriptor #20 (LX;)V\n" +
991 		"  // Stack: 0, Locals: 2\n" +
992 		"  void foo1(X x);\n" +
993 		"    0  return\n" +
994 		"      Line numbers:\n" +
995 		"        [pc: 0, line: 9]\n" +
996 		"      Local variable table:\n" +
997 		"        [pc: 0, pc: 1] local: this index: 0 type: X\n" +
998 		"        [pc: 0, pc: 1] local: x index: 1 type: X\n" +
999 		"  \n" +
1000 		"  // Method descriptor #20 (LX;)V\n" +
1001 		"  // Stack: 1, Locals: 2\n" +
1002 		"  void foo2(X x);\n" +
1003 		"    0  aload_1 [x]\n" +
1004 		"    1  ifnonnull 4\n" +
1005 		"    4  return\n" +
1006 		"      Line numbers:\n" +
1007 		"        [pc: 0, line: 12]\n" +
1008 		"        [pc: 4, line: 15]\n" +
1009 		"      Local variable table:\n" +
1010 		"        [pc: 0, pc: 5] local: this index: 0 type: X\n" +
1011 		"        [pc: 0, pc: 5] local: x index: 1 type: X\n" +
1012 		"  \n" +
1013 		"  // Method descriptor #20 (LX;)V\n" +
1014 		"  // Stack: 1, Locals: 2\n" +
1015 		"  void foo3(X x);\n" +
1016 		"    0  aload_1 [x]\n" +
1017 		"    1  ifnonnull 4\n" +
1018 		"    4  return\n" +
1019 		"      Line numbers:\n" +
1020 		"        [pc: 0, line: 18]\n" +
1021 		"        [pc: 4, line: 21]\n" +
1022 		"      Local variable table:\n" +
1023 		"        [pc: 0, pc: 5] local: this index: 0 type: X\n" +
1024 		"        [pc: 0, pc: 5] local: x index: 1 type: X\n" +
1025 		"  \n" +
1026 		"  // Method descriptor #20 (LX;)V\n" +
1027 		"  // Stack: 1, Locals: 3\n" +
1028 		"  void foo4(X x);\n" +
1029 		"    0  aload_1 [x]\n" +
1030 		"    1  ifnonnull 4\n" +
1031 		"    4  iconst_0\n" +
1032 		"    5  istore_2 [bb]\n" +
1033 		"    6  return\n" +
1034 		"      Line numbers:\n" +
1035 		"        [pc: 0, line: 23]\n" +
1036 		"        [pc: 6, line: 24]\n" +
1037 		"      Local variable table:\n" +
1038 		"        [pc: 0, pc: 7] local: this index: 0 type: X\n" +
1039 		"        [pc: 0, pc: 7] local: x index: 1 type: X\n" +
1040 		"        [pc: 6, pc: 7] local: bb index: 2 type: boolean\n";
1041 
1042 	File f = new File(OUTPUT_DIR + File.separator + "X.class");
1043 	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
1044 	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
1045 	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
1046 	int index = result.indexOf(expectedOutput);
1047 	if (index == -1 || expectedOutput.length() == 0) {
1048 		System.out.println(Util.displayString(result, 3));
1049 	}
1050 	if (index == -1) {
1051 		assertEquals("Wrong contents", expectedOutput, result);
1052 	}
1053 }
1054 //http://bugs.eclipse.org/bugs/show_bug.cgi?id=117495
test017()1055 public void test017() {
1056 	this.runConformTest(
1057 		new String[] {
1058 			"X.java",
1059 			"public class X {\n" +
1060 			"    public static void main(String[] args) {\n" +
1061 			"		int x = 2;\n" +
1062 			"       System.out.println(\"n: \"+(x > 1  ? 2 : 1.0));\n" +
1063 			"    }\n" +
1064 			"}",
1065 		},
1066 		"n: 2.0");
1067 }
1068 //http://bugs.eclipse.org/bugs/show_bug.cgi?id=117495
test018()1069 public void test018() {
1070 	this.runConformTest(
1071 		new String[] {
1072 			"X.java",
1073 			"public class X {\n" +
1074 			"    public static void main(String[] args) {\n" +
1075 			"		System.out.println(\"n: \"+(true ? 2 : 1.0));\n" +
1076 			"    }\n" +
1077 			"}",
1078 		},
1079 		"n: 2.0");
1080 }
1081 
1082 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=154822
1083 // null is not a constant - again
test019()1084 public void test019() {
1085 	this.runConformTest(
1086 		new String[] {
1087 			"X.java",
1088 			"public class X {\n" +
1089 			"    static class Enclosed {\n" +
1090 			"		 static final String constant = \"\";\n" +
1091 			"		 static final String notAConstant;\n" +
1092 			"        static {\n" +
1093 			"		     notAConstant = null;\n" +
1094 			"        }\n" +
1095 			"    }\n" +
1096 			"}",
1097 		},
1098 		"");
1099 }
1100 
1101 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=154822
1102 // null is not a constant - again
test020()1103 public void test020() {
1104 	this.runNegativeTest(
1105 		new String[] {
1106 			"X.java",
1107 			"public class X {\n" +
1108 			"    class Inner {\n" +
1109 			"		 static final String constant = \"\";\n" +
1110 			"		 static final String notAConstant = null;\n" +
1111 			"    }\n" +
1112 			"}",
1113 		},
1114 		"----------\n" +
1115 		"1. ERROR in X.java (at line 4)\n" +
1116 		"	static final String notAConstant = null;\n" +
1117 		"	                    ^^^^^^^^^^^^\n" +
1118 		"The field notAConstant cannot be declared static in a non-static inner type, unless initialized with a constant expression\n" +
1119 		"----------\n");
1120 }
testAllConstants()1121 public void testAllConstants() {
1122 	Constant byteConstant = ByteConstant.fromValue((byte) 1);
1123 	Constant byteConstant2 = ByteConstant.fromValue((byte) 2);
1124 	Constant byteConstant3 = ByteConstant.fromValue((byte) 1);
1125 	Constant charConstant = CharConstant.fromValue('c');
1126 	Constant charConstant2 = CharConstant.fromValue('d');
1127 	Constant charConstant3 = CharConstant.fromValue('c');
1128 	Constant booleanConstant = BooleanConstant.fromValue(true);
1129 	Constant booleanConstant2 = BooleanConstant.fromValue(false);
1130 	Constant booleanConstant3 = BooleanConstant.fromValue(true);
1131 	Constant doubleConstant = DoubleConstant.fromValue(1.0);
1132 	Constant doubleConstant2 = DoubleConstant.fromValue(2.0);
1133 	Constant doubleConstant3 = DoubleConstant.fromValue(1.0);
1134 	Constant floatConstant = FloatConstant.fromValue(1.0f);
1135 	Constant floatConstant2 =  FloatConstant.fromValue(2.0f);
1136 	Constant floatConstant3 =  FloatConstant.fromValue(1.0f);
1137 	Constant intConstant = IntConstant.fromValue(20);
1138 	Constant intConstant2 = IntConstant.fromValue(30);
1139 	Constant intConstant3 = IntConstant.fromValue(20);
1140 	Constant longConstant =  LongConstant.fromValue(3L);
1141 	Constant longConstant2 =  LongConstant.fromValue(4L);
1142 	Constant longConstant3 =  LongConstant.fromValue(3L);
1143 	Constant shortConstant = ShortConstant.fromValue((short) 4);
1144 	Constant shortConstant2 = ShortConstant.fromValue((short) 3);
1145 	Constant shortConstant3 = ShortConstant.fromValue((short) 4);
1146 	Constant stringConstant = StringConstant.fromValue("test");
1147 	Constant stringConstant2 = StringConstant.fromValue("test2");
1148 	Constant stringConstant3 = StringConstant.fromValue("test");
1149 	Constant stringConstant4 = StringConstant.fromValue(null);
1150 	Constant stringConstant5 = StringConstant.fromValue(null);
1151 	ClassSignature classSignature = new ClassSignature("java.lang.Object".toCharArray());
1152 	ClassSignature classSignature2 = new ClassSignature("java.lang.String".toCharArray());
1153 	ClassSignature classSignature3 = new ClassSignature("java.lang.Object".toCharArray());
1154 	EnumConstantSignature enumConstantSignature = new EnumConstantSignature("myEnum".toCharArray(), "C".toCharArray());
1155 	EnumConstantSignature enumConstantSignature2 = new EnumConstantSignature("myEnum".toCharArray(), "A".toCharArray());
1156 	EnumConstantSignature enumConstantSignature3 = new EnumConstantSignature("myEnum".toCharArray(), "C".toCharArray());
1157 	EnumConstantSignature enumConstantSignature4 = new EnumConstantSignature("myEnum2".toCharArray(), "A".toCharArray());
1158 
1159 	verifyConstantEqualsAndHashcode(byteConstant, byteConstant2, byteConstant3, intConstant);
1160 	verifyConstantEqualsAndHashcode(charConstant, charConstant2, charConstant3, byteConstant);
1161 	verifyConstantEqualsAndHashcode(booleanConstant, booleanConstant2, booleanConstant3, byteConstant);
1162 	verifyConstantEqualsAndHashcode(doubleConstant, doubleConstant2, doubleConstant3, byteConstant);
1163 	verifyConstantEqualsAndHashcode(floatConstant, floatConstant2, floatConstant3, byteConstant);
1164 	verifyConstantEqualsAndHashcode(intConstant, intConstant2, intConstant3, stringConstant);
1165 	verifyConstantEqualsAndHashcode(longConstant, longConstant2, longConstant3, byteConstant);
1166 	verifyConstantEqualsAndHashcode(shortConstant, shortConstant2, shortConstant3, byteConstant);
1167 	verifyConstantEqualsAndHashcode(stringConstant, stringConstant2, stringConstant3, byteConstant);
1168 	verifyConstantEqualsAndHashcode(stringConstant, stringConstant4, stringConstant3, byteConstant);
1169 	verifyConstantEqualsAndHashcode(stringConstant4, stringConstant3, stringConstant5, byteConstant);
1170 	verifyConstantEqualsAndHashcode(classSignature, classSignature2, classSignature3, byteConstant);
1171 	verifyConstantEqualsAndHashcode(enumConstantSignature, enumConstantSignature2, enumConstantSignature3, byteConstant);
1172 	verifyConstantEqualsAndHashcode(enumConstantSignature, enumConstantSignature4, enumConstantSignature3, byteConstant);
1173 	assertNotNull(Constant.NotAConstant.toString());
1174 
1175 	verifyValues(byteConstant, charConstant, booleanConstant, doubleConstant, floatConstant, intConstant, longConstant, shortConstant, stringConstant);
1176 	// check equals between to null string constants
1177 	assertTrue(stringConstant4.equals(stringConstant5));
1178 }
verifyValues( Constant byteConstant, Constant charConstant, Constant booleanConstant, Constant doubleConstant, Constant floatConstant, Constant intConstant, Constant longConstant, Constant shortConstant, Constant stringConstant)1179 private void verifyValues(
1180 		Constant byteConstant,
1181 		Constant charConstant,
1182 		Constant booleanConstant,
1183 		Constant doubleConstant,
1184 		Constant floatConstant,
1185 		Constant intConstant,
1186 		Constant longConstant,
1187 		Constant shortConstant,
1188 		Constant stringConstant) {
1189 
1190 	// byteValue()
1191 	byteConstant.byteValue();
1192 	charConstant.byteValue();
1193 	try {
1194 		booleanConstant.byteValue();
1195 		assertTrue(false);
1196 	} catch(ShouldNotImplement e) {
1197 		// ignore
1198 	}
1199 	doubleConstant.byteValue();
1200 	floatConstant.byteValue();
1201 	intConstant.byteValue();
1202 	longConstant.byteValue();
1203 	shortConstant.byteValue();
1204 	try {
1205 		stringConstant.byteValue();
1206 		assertTrue(false);
1207 	} catch(ShouldNotImplement e) {
1208 		// ignore
1209 	}
1210 
1211 	// booleanValue()
1212 	try {
1213 		byteConstant.booleanValue();
1214 		assertTrue(false);
1215 	} catch(ShouldNotImplement e) {
1216 		// ignore
1217 	}
1218 	try {
1219 		charConstant.booleanValue();
1220 		assertTrue(false);
1221 	} catch(ShouldNotImplement e) {
1222 		// ignore
1223 	}
1224 	booleanConstant.booleanValue();
1225 	try {
1226 		doubleConstant.booleanValue();
1227 		assertTrue(false);
1228 	} catch(ShouldNotImplement e) {
1229 		// ignore
1230 	}
1231 	try {
1232 		floatConstant.booleanValue();
1233 		assertTrue(false);
1234 	} catch(ShouldNotImplement e) {
1235 		// ignore
1236 	}
1237 	try {
1238 		intConstant.booleanValue();
1239 		assertTrue(false);
1240 	} catch(ShouldNotImplement e) {
1241 		// ignore
1242 	}
1243 	try {
1244 		longConstant.booleanValue();
1245 		assertTrue(false);
1246 	} catch(ShouldNotImplement e) {
1247 		// ignore
1248 	}
1249 	try {
1250 		shortConstant.booleanValue();
1251 		assertTrue(false);
1252 	} catch(ShouldNotImplement e) {
1253 		// ignore
1254 	}
1255 	try {
1256 		stringConstant.booleanValue();
1257 		assertTrue(false);
1258 	} catch(ShouldNotImplement e) {
1259 		// ignore
1260 	}
1261 
1262 	// charValue()
1263 	byteConstant.charValue();
1264 	charConstant.charValue();
1265 	try {
1266 		booleanConstant.charValue();
1267 		assertTrue(false);
1268 	} catch(ShouldNotImplement e) {
1269 		// ignore
1270 	}
1271 	doubleConstant.charValue();
1272 	floatConstant.charValue();
1273 	intConstant.charValue();
1274 	longConstant.charValue();
1275 	shortConstant.charValue();
1276 	try {
1277 		stringConstant.charValue();
1278 		assertTrue(false);
1279 	} catch(ShouldNotImplement e) {
1280 		// ignore
1281 	}
1282 
1283 	// doubleValue()
1284 	byteConstant.doubleValue();
1285 	charConstant.doubleValue();
1286 	try {
1287 		booleanConstant.doubleValue();
1288 		assertTrue(false);
1289 	} catch(ShouldNotImplement e) {
1290 		// ignore
1291 	}
1292 	doubleConstant.doubleValue();
1293 	floatConstant.doubleValue();
1294 	intConstant.doubleValue();
1295 	longConstant.doubleValue();
1296 	shortConstant.doubleValue();
1297 	try {
1298 		stringConstant.doubleValue();
1299 		assertTrue(false);
1300 	} catch(ShouldNotImplement e) {
1301 		// ignore
1302 	}
1303 
1304 	// floatValue()
1305 	byteConstant.floatValue();
1306 	charConstant.floatValue();
1307 	try {
1308 		booleanConstant.floatValue();
1309 		assertTrue(false);
1310 	} catch(ShouldNotImplement e) {
1311 		// ignore
1312 	}
1313 	doubleConstant.floatValue();
1314 	floatConstant.floatValue();
1315 	intConstant.floatValue();
1316 	longConstant.floatValue();
1317 	shortConstant.floatValue();
1318 	try {
1319 		stringConstant.floatValue();
1320 		assertTrue(false);
1321 	} catch(ShouldNotImplement e) {
1322 		// ignore
1323 	}
1324 
1325 	// intValue()
1326 	byteConstant.intValue();
1327 	charConstant.intValue();
1328 	try {
1329 		booleanConstant.intValue();
1330 		assertTrue(false);
1331 	} catch(ShouldNotImplement e) {
1332 		// ignore
1333 	}
1334 	doubleConstant.intValue();
1335 	floatConstant.intValue();
1336 	intConstant.intValue();
1337 	longConstant.intValue();
1338 	shortConstant.intValue();
1339 	try {
1340 		stringConstant.intValue();
1341 		assertTrue(false);
1342 	} catch(ShouldNotImplement e) {
1343 		// ignore
1344 	}
1345 
1346 	// longValue()
1347 	byteConstant.longValue();
1348 	charConstant.longValue();
1349 	try {
1350 		booleanConstant.longValue();
1351 		assertTrue(false);
1352 	} catch(ShouldNotImplement e) {
1353 		// ignore
1354 	}
1355 	doubleConstant.longValue();
1356 	floatConstant.longValue();
1357 	intConstant.longValue();
1358 	longConstant.longValue();
1359 	shortConstant.longValue();
1360 	try {
1361 		stringConstant.longValue();
1362 		assertTrue(false);
1363 	} catch(ShouldNotImplement e) {
1364 		// ignore
1365 	}
1366 
1367 	// shortValue()
1368 	byteConstant.shortValue();
1369 	charConstant.shortValue();
1370 	try {
1371 		booleanConstant.shortValue();
1372 		assertTrue(false);
1373 	} catch(ShouldNotImplement e) {
1374 		// ignore
1375 	}
1376 	doubleConstant.shortValue();
1377 	floatConstant.shortValue();
1378 	intConstant.shortValue();
1379 	longConstant.shortValue();
1380 	shortConstant.shortValue();
1381 	try {
1382 		stringConstant.shortValue();
1383 		assertTrue(false);
1384 	} catch(ShouldNotImplement e) {
1385 		// ignore
1386 	}
1387 
1388 	// stringValue()
1389 	byteConstant.stringValue();
1390 	charConstant.stringValue();
1391 	booleanConstant.stringValue();
1392 	doubleConstant.stringValue();
1393 	floatConstant.stringValue();
1394 	intConstant.stringValue();
1395 	longConstant.stringValue();
1396 	shortConstant.stringValue();
1397 	stringConstant.stringValue();
1398 }
verifyConstantEqualsAndHashcode( Object o, Object o2, Object o3, Object o4)1399 private void verifyConstantEqualsAndHashcode(
1400 		Object o,
1401 		Object o2,
1402 		Object o3,
1403 		Object o4) {
1404 	assertTrue(o.equals(o));
1405 	assertTrue(o.equals(o3));
1406 	assertFalse(o.equals(o2));
1407 	assertFalse(o.equals(o4));
1408 	assertFalse(o.equals(null));
1409 	assertFalse(o.hashCode() == o2.hashCode());
1410 	assertNotNull(o.toString());
1411 
1412 	if (o instanceof Constant) {
1413 		assertTrue("Not the same values", ((Constant) o).hasSameValue((Constant) o3));
1414 		assertFalse("Have same values", ((Constant) o).hasSameValue((Constant) o2));
1415 		assertFalse("Have same values", ((Constant) o).hasSameValue((Constant) o4));
1416 	}
1417 }
1418 //test corner values (max, min, -1) for longs
test021()1419 public void test021() {
1420 	this.runConformTest(
1421 		new String[] {
1422 			"X.java",
1423 			"public class X {\n" +
1424 			"	public static void main(String[] args) {\n" +
1425 			"		System.out.println(0x0L); // OK\n" +
1426 			"		System.out.println(0x8000000000000000L); // OK\n" +
1427 			"		System.out.println(0x8000000000000000l); // OK\n" +
1428 			"		System.out.println(01000000000000000000000L); // OK\n" +
1429 			"		System.out.println(01000000000000000000000l); // OK\n" +
1430 			"		System.out.println(-9223372036854775808L); // OK\n" +
1431 			"		System.out.println(-9223372036854775808l); // OK\n" +
1432 			"		System.out.println(0x7fffffffffffffffL); // OK\n" +
1433 			"		System.out.println(0x7fffffffffffffffl); // OK\n" +
1434 			"		System.out.println(0777777777777777777777L); // OK\n" +
1435 			"		System.out.println(0777777777777777777777l); // OK\n" +
1436 			"		System.out.println(9223372036854775807L); // OK\n" +
1437 			"		System.out.println(9223372036854775807l); // OK\n" +
1438 			"		System.out.println(0xffffffffffffffffL); // OK\n" +
1439 			"		System.out.println(0x0000000000000ffffffffffffffffL); // OK\n" +
1440 			"		System.out.println(0xffffffffffffffffl); // OK\n" +
1441 			"		System.out.println(01777777777777777777777L); // OK\n" +
1442 			"		System.out.println(01777777777777777777777l); // OK\n" +
1443 			"		System.out.println(-0x1L); // OK\n" +
1444 			"		System.out.println(-0x1l); // OK\n" +
1445 			"		System.out.println(0677777777777777777777L);\n" +
1446 			"		System.out.println(0677777777777777777777l);\n" +
1447 			"		System.out.println(0x0000000000000L); // OK\n" +
1448 			"		System.out.println(0L); // OK\n" +
1449 			"	}\n" +
1450 			"}",
1451 		},
1452 		"0\n" +
1453 		"-9223372036854775808\n" +
1454 		"-9223372036854775808\n" +
1455 		"-9223372036854775808\n" +
1456 		"-9223372036854775808\n" +
1457 		"-9223372036854775808\n" +
1458 		"-9223372036854775808\n" +
1459 		"9223372036854775807\n" +
1460 		"9223372036854775807\n" +
1461 		"9223372036854775807\n" +
1462 		"9223372036854775807\n" +
1463 		"9223372036854775807\n" +
1464 		"9223372036854775807\n" +
1465 		"-1\n" +
1466 		"-1\n" +
1467 		"-1\n" +
1468 		"-1\n" +
1469 		"-1\n" +
1470 		"-1\n" +
1471 		"-1\n" +
1472 		"8070450532247928831\n" +
1473 		"8070450532247928831\n" +
1474 		"0\n" +
1475 		"0");
1476 }
1477 //test corner values (max, min, -1) for ints
test022()1478 public void test022() {
1479 	this.runConformTest(
1480 		new String[] {
1481 			"X.java",
1482 			"public class X {\n" +
1483 			"	public static void main(String[] args) {\n" +
1484 			"		System.out.println(0x0); // OK\n" +
1485 			"		System.out.println(0x80000000); // OK\n" +
1486 			"		System.out.println(020000000000); // OK\n" +
1487 			"		System.out.println(-2147483648); // OK\n" +
1488 			"		System.out.println(0x7fffffff); // OK\n" +
1489 			"		System.out.println(017777777777); // OK\n" +
1490 			"		System.out.println(2147483647); // OK\n" +
1491 			"		System.out.println(0xffffffff); // OK\n" +
1492 			"		System.out.println(0x0000000000000ffffffff); // OK\n" +
1493 			"		System.out.println(037777777777); // OK\n" +
1494 			"		System.out.println(-0x1); // OK\n" +
1495 			"		System.out.println(0xDADACAFE);\n" +
1496 			"		System.out.println(0x0000000000000); // OK\n" +
1497 			"	}\n" +
1498 			"}",
1499 		},
1500 		"0\n" +
1501 		"-2147483648\n" +
1502 		"-2147483648\n" +
1503 		"-2147483648\n" +
1504 		"2147483647\n" +
1505 		"2147483647\n" +
1506 		"2147483647\n" +
1507 		"-1\n" +
1508 		"-1\n" +
1509 		"-1\n" +
1510 		"-1\n" +
1511 		"-623195394\n" +
1512 		"0");
1513 }
testClass()1514 public static Class testClass() {
1515 	return ConstantTest.class;
1516 }
1517 }
1518