Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Fusier2008-06-27 16:04:50 +0000
committerFrederic Fusier2008-06-27 16:04:50 +0000
commitbd6803034b95b7e0dd8c0cbcd0aead0a5c726f65 (patch)
tree27611318284414829d25a09ce9b040291ac31cf0 /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
parent9ef1e97f6b56081e8537310fc409f77c2ce56944 (diff)
downloadeclipse.jdt.core-bd6803034b95b7e0dd8c0cbcd0aead0a5c726f65.tar.gz
eclipse.jdt.core-bd6803034b95b7e0dd8c0cbcd0aead0a5c726f65.tar.xz
eclipse.jdt.core-bd6803034b95b7e0dd8c0cbcd0aead0a5c726f65.zip
HEAD - Clean-up pass 1: add 'this.' to fields +remove 'this.' to msg send + remove trailing white spaces
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java1126
1 files changed, 563 insertions, 563 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
index c38d7e3ec8..d73e87495f 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
@@ -20,7 +20,7 @@ import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
public class ConstantTest extends AbstractRegressionTest {
-
+
public ConstantTest(String name) {
super(name);
}
@@ -38,21 +38,21 @@ public static Test suite() {
public void test001() {
this.runConformTest(new String[] {
"p/X.java",
- "package p;\n" +
- "public class X { \n" +
- "public static void main (String args []) {\n" +
- " foo(); \n" +
- "}\n" +
- "public static void foo() {\n" +
- " if(55f!=00000000000000000000055F) // HERE VA/Java detects an unexpected error\n" +
- " {\n" +
- "System.out.println(\"55f!=00000000000000000000055F\");\n" +
- " }\n" +
- " else\n" +
- " {\n" +
- "System.out.println(\"55f==00000000000000000000055F\");\n" +
- " }\n" +
- " } \n" +
+ "package p;\n" +
+ "public class X { \n" +
+ "public static void main (String args []) {\n" +
+ " foo(); \n" +
+ "}\n" +
+ "public static void foo() {\n" +
+ " if(55f!=00000000000000000000055F) // HERE VA/Java detects an unexpected error\n" +
+ " {\n" +
+ "System.out.println(\"55f!=00000000000000000000055F\");\n" +
+ " }\n" +
+ " else\n" +
+ " {\n" +
+ "System.out.println(\"55f==00000000000000000000055F\");\n" +
+ " }\n" +
+ " } \n" +
"}\n",
});
}
@@ -60,21 +60,21 @@ public void test001() {
public void test002() {
this.runConformTest(new String[] {
"p/X.java",
- "package p;\n" +
- "public class X {\n" +
- " public static void main (String args []) {\n" +
- " foo();\n" +
- " }\n" +
- " public static void foo() {\n" +
- " if(55f!=00000000000000000000055F) // HERE VA/Java detects an unexpected error\n" +
- " {\n" +
- " System.out.println(\"55f!=00000000000000000000055F\");\n" +
- " }\n" +
- " else\n" +
- " {\n" +
- " System.out.println(\"55f==00000000000000000000055F\");\n" +
- " }\n" +
- " } \n" +
+ "package p;\n" +
+ "public class X {\n" +
+ " public static void main (String args []) {\n" +
+ " foo();\n" +
+ " }\n" +
+ " public static void foo() {\n" +
+ " if(55f!=00000000000000000000055F) // HERE VA/Java detects an unexpected error\n" +
+ " {\n" +
+ " System.out.println(\"55f!=00000000000000000000055F\");\n" +
+ " }\n" +
+ " else\n" +
+ " {\n" +
+ " System.out.println(\"55f==00000000000000000000055F\");\n" +
+ " }\n" +
+ " } \n" +
"}\n",
});
}
@@ -82,15 +82,15 @@ public void test002() {
public void test003() {
this.runConformTest(new String[] {
"p/Z.java",
- "package p;\n" +
- "public class Z {\n" +
- " public static void main(String[] cargs) throws Exception {\n" +
- " System.out.println(System.getProperty(\"java.vm.info\", \"J9\"));\n" +
- " System.out.write((byte) 0x89);\n" +
- " System.out.println();\n" +
- " System.out.println(\"\u00E2?\u00B0\");\n" +
- " System.out.println(Integer.toHexString(\"\u00E2?\u00B0\".charAt(0)));\n" +
- " }\n" +
+ "package p;\n" +
+ "public class Z {\n" +
+ " public static void main(String[] cargs) throws Exception {\n" +
+ " System.out.println(System.getProperty(\"java.vm.info\", \"J9\"));\n" +
+ " System.out.write((byte) 0x89);\n" +
+ " System.out.println();\n" +
+ " System.out.println(\"\u00E2?\u00B0\");\n" +
+ " System.out.println(Integer.toHexString(\"\u00E2?\u00B0\".charAt(0)));\n" +
+ " }\n" +
"}\n",
});
}
@@ -336,145 +336,145 @@ public void test009() throws Exception {
"}",
},
"12345");
-
+
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class"));
String actualOutput =
disassembler.disassemble(
classFileBytes,
"\n",
- ClassFileBytesDisassembler.DETAILED);
-
- String expectedOutput =
- " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
- " // Stack: 3, Locals: 4\n" +
- " public static void main(java.lang.String[] args);\n" +
- " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 3 ldc <String \"1\"> [22]\n" +
- " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 8 aconst_null\n" +
- " 9 goto 13\n" +
- " 12 aconst_null\n" +
- " 13 aconst_null\n" +
- " 14 goto 18\n" +
- " 17 aconst_null\n" +
- " 18 if_acmpne 29\n" +
- " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 24 ldc <String \"2\"> [30]\n" +
- " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 29 new java.lang.StringBuffer [32]\n" +
- " 32 dup\n" +
- " 33 ldc <String \"[\"> [34]\n" +
- " 35 invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" +
- " 38 aconst_null\n" +
- " 39 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" +
- " 42 ldc <String \"]\"> [42]\n" +
- " 44 invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" +
- " 47 invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" +
- " 50 ldc <String \"[null]\"> [51]\n" +
- " 52 if_acmpne 59\n" +
- " 55 iconst_1\n" +
- " 56 goto 60\n" +
- " 59 iconst_0\n" +
- " 60 istore_1 [b]\n" +
- " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 64 ldc <String \"3\"> [53]\n" +
- " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 69 aconst_null\n" +
- " 70 astore_2 [s]\n" +
- " 71 aload_2 [s]\n" +
- " 72 ifnonnull 83\n" +
- " 75 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 78 ldc <String \"4\"> [55]\n" +
- " 80 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 83 ldc <String \"aaa\"> [57]\n" +
- " 85 astore_3 [s2]\n" +
- " 86 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 89 ldc <String \"5\"> [59]\n" +
- " 91 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
- " 94 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 3]\n" +
- " [pc: 8, line: 4]\n" +
- " [pc: 21, line: 5]\n" +
- " [pc: 29, line: 6]\n" +
- " [pc: 61, line: 7]\n" +
- " [pc: 69, line: 8]\n" +
- " [pc: 71, line: 9]\n" +
- " [pc: 83, line: 10]\n" +
- " [pc: 86, line: 11]\n" +
- " [pc: 94, line: 12]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" +
- " [pc: 61, pc: 95] local: b index: 1 type: boolean\n" +
- " [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" +
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
+ " // Stack: 3, Locals: 4\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 3 ldc <String \"1\"> [22]\n" +
+ " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 8 aconst_null\n" +
+ " 9 goto 13\n" +
+ " 12 aconst_null\n" +
+ " 13 aconst_null\n" +
+ " 14 goto 18\n" +
+ " 17 aconst_null\n" +
+ " 18 if_acmpne 29\n" +
+ " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 24 ldc <String \"2\"> [30]\n" +
+ " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 29 new java.lang.StringBuffer [32]\n" +
+ " 32 dup\n" +
+ " 33 ldc <String \"[\"> [34]\n" +
+ " 35 invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" +
+ " 38 aconst_null\n" +
+ " 39 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" +
+ " 42 ldc <String \"]\"> [42]\n" +
+ " 44 invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" +
+ " 47 invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" +
+ " 50 ldc <String \"[null]\"> [51]\n" +
+ " 52 if_acmpne 59\n" +
+ " 55 iconst_1\n" +
+ " 56 goto 60\n" +
+ " 59 iconst_0\n" +
+ " 60 istore_1 [b]\n" +
+ " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 64 ldc <String \"3\"> [53]\n" +
+ " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 69 aconst_null\n" +
+ " 70 astore_2 [s]\n" +
+ " 71 aload_2 [s]\n" +
+ " 72 ifnonnull 83\n" +
+ " 75 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 78 ldc <String \"4\"> [55]\n" +
+ " 80 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 83 ldc <String \"aaa\"> [57]\n" +
+ " 85 astore_3 [s2]\n" +
+ " 86 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 89 ldc <String \"5\"> [59]\n" +
+ " 91 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
+ " 94 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 3]\n" +
+ " [pc: 8, line: 4]\n" +
+ " [pc: 21, line: 5]\n" +
+ " [pc: 29, line: 6]\n" +
+ " [pc: 61, line: 7]\n" +
+ " [pc: 69, line: 8]\n" +
+ " [pc: 71, line: 9]\n" +
+ " [pc: 83, line: 10]\n" +
+ " [pc: 86, line: 11]\n" +
+ " [pc: 94, line: 12]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 61, pc: 95] local: b index: 1 type: boolean\n" +
+ " [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" +
" [pc: 86, pc: 95] local: s2 index: 3 type: java.lang.String\n";
-
+
String expectedOutput15 =
- " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
- " // Stack: 3, Locals: 4\n" +
- " public static void main(java.lang.String[] args);\n" +
- " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 3 ldc <String \"1\"> [22]\n" +
- " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 8 aconst_null\n" +
- " 9 goto 13\n" +
- " 12 aconst_null\n" +
- " 13 aconst_null\n" +
- " 14 goto 18\n" +
- " 17 aconst_null\n" +
- " 18 if_acmpne 29\n" +
- " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 24 ldc <String \"2\"> [30]\n" +
- " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 29 new java.lang.StringBuilder [32]\n" +
- " 32 dup\n" +
- " 33 ldc <String \"[\"> [34]\n" +
- " 35 invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" +
- " 38 aconst_null\n" +
- " 39 invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" +
- " 42 ldc <String \"]\"> [42]\n" +
- " 44 invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" +
- " 47 invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" +
- " 50 ldc <String \"[null]\"> [51]\n" +
- " 52 if_acmpne 59\n" +
- " 55 iconst_1\n" +
- " 56 goto 60\n" +
- " 59 iconst_0\n" +
- " 60 istore_1 [b]\n" +
- " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 64 ldc <String \"3\"> [53]\n" +
- " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 69 aconst_null\n" +
- " 70 astore_2 [s]\n" +
- " 71 aload_2 [s]\n" +
- " 72 ifnonnull 83\n" +
- " 75 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 78 ldc <String \"4\"> [55]\n" +
- " 80 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 83 ldc <String \"aaa\"> [57]\n" +
- " 85 astore_3 [s2]\n" +
- " 86 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 89 ldc <String \"5\"> [59]\n" +
- " 91 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
- " 94 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 3]\n" +
- " [pc: 8, line: 4]\n" +
- " [pc: 21, line: 5]\n" +
- " [pc: 29, line: 6]\n" +
- " [pc: 61, line: 7]\n" +
- " [pc: 69, line: 8]\n" +
- " [pc: 71, line: 9]\n" +
- " [pc: 83, line: 10]\n" +
- " [pc: 86, line: 11]\n" +
- " [pc: 94, line: 12]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" +
- " [pc: 61, pc: 95] local: b index: 1 type: boolean\n" +
- " [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" +
+ " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
+ " // Stack: 3, Locals: 4\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 3 ldc <String \"1\"> [22]\n" +
+ " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 8 aconst_null\n" +
+ " 9 goto 13\n" +
+ " 12 aconst_null\n" +
+ " 13 aconst_null\n" +
+ " 14 goto 18\n" +
+ " 17 aconst_null\n" +
+ " 18 if_acmpne 29\n" +
+ " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 24 ldc <String \"2\"> [30]\n" +
+ " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 29 new java.lang.StringBuilder [32]\n" +
+ " 32 dup\n" +
+ " 33 ldc <String \"[\"> [34]\n" +
+ " 35 invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" +
+ " 38 aconst_null\n" +
+ " 39 invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" +
+ " 42 ldc <String \"]\"> [42]\n" +
+ " 44 invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" +
+ " 47 invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" +
+ " 50 ldc <String \"[null]\"> [51]\n" +
+ " 52 if_acmpne 59\n" +
+ " 55 iconst_1\n" +
+ " 56 goto 60\n" +
+ " 59 iconst_0\n" +
+ " 60 istore_1 [b]\n" +
+ " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 64 ldc <String \"3\"> [53]\n" +
+ " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 69 aconst_null\n" +
+ " 70 astore_2 [s]\n" +
+ " 71 aload_2 [s]\n" +
+ " 72 ifnonnull 83\n" +
+ " 75 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 78 ldc <String \"4\"> [55]\n" +
+ " 80 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 83 ldc <String \"aaa\"> [57]\n" +
+ " 85 astore_3 [s2]\n" +
+ " 86 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 89 ldc <String \"5\"> [59]\n" +
+ " 91 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
+ " 94 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 3]\n" +
+ " [pc: 8, line: 4]\n" +
+ " [pc: 21, line: 5]\n" +
+ " [pc: 29, line: 6]\n" +
+ " [pc: 61, line: 7]\n" +
+ " [pc: 69, line: 8]\n" +
+ " [pc: 71, line: 9]\n" +
+ " [pc: 83, line: 10]\n" +
+ " [pc: 86, line: 11]\n" +
+ " [pc: 94, line: 12]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 61, pc: 95] local: b index: 1 type: boolean\n" +
+ " [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" +
" [pc: 86, pc: 95] local: s2 index: 3 type: java.lang.String\n";
-
+
if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
int index = actualOutput.indexOf(expectedOutput15);
if (index == -1 || expectedOutput15.length() == 0) {
@@ -513,33 +513,33 @@ public void test010() throws Exception {
"} \n",
},
"SUCCESS");
-
+
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class"));
String actualOutput =
disassembler.disassemble(
classFileBytes,
"\n",
- ClassFileBytesDisassembler.DETAILED);
-
- String expectedOutput =
- " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
- " // Stack: 2, Locals: 1\n" +
- " public static void main(java.lang.String[] args);\n" +
- " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 3 ldc <String \"SUCCESS\"> [22]\n" +
- " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 8 return\n" +
- " 9 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 12 ldc <String \"SHOULDN\'T BE GENERATED\"> [30]\n" +
- " 14 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 17 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 4]\n" +
- " [pc: 8, line: 5]\n" +
- " [pc: 9, line: 7]\n" +
- " [pc: 17, line: 8]\n" +
- " Local variable table:\n" +
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 1\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 3 ldc <String \"SUCCESS\"> [22]\n" +
+ " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 8 return\n" +
+ " 9 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 12 ldc <String \"SHOULDN\'T BE GENERATED\"> [30]\n" +
+ " 14 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
+ " 17 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 4]\n" +
+ " [pc: 8, line: 5]\n" +
+ " [pc: 9, line: 7]\n" +
+ " [pc: 17, line: 8]\n" +
+ " Local variable table:\n" +
" [pc: 0, pc: 18] local: args index: 0 type: java.lang.String[]\n";
int index = actualOutput.indexOf(expectedOutput);
if (index == -1 || expectedOutput.length() == 0) {
@@ -598,26 +598,26 @@ public void test013() {
" }\n" +
"}",
},
- "----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " System.out.println(-9223372036854775809L); // KO\n" +
- " ^^^^^^^^^^^^^^^^^^^^\n" +
- "The literal 9223372036854775809L of type long is out of range \n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " System.out.println(9223372036854775809L); // KO\n" +
- " ^^^^^^^^^^^^^^^^^^^^\n" +
- "The literal 9223372036854775809L of type long is out of range \n" +
- "----------\n" +
- "3. ERROR in X.java (at line 5)\n" +
- " System.out.println(9223372036854775808L); // KO\n" +
- " ^^^^^^^^^^^^^^^^^^^^\n" +
- "The literal 9223372036854775808L of type long is out of range \n" +
- "----------\n" +
- "4. ERROR in X.java (at line 6)\n" +
- " System.out.println(23092395825689123986L); // KO\n" +
- " ^^^^^^^^^^^^^^^^^^^^^\n" +
- "The literal 23092395825689123986L of type long is out of range \n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " System.out.println(-9223372036854775809L); // KO\n" +
+ " ^^^^^^^^^^^^^^^^^^^^\n" +
+ "The literal 9223372036854775809L of type long is out of range \n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " System.out.println(9223372036854775809L); // KO\n" +
+ " ^^^^^^^^^^^^^^^^^^^^\n" +
+ "The literal 9223372036854775809L of type long is out of range \n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " System.out.println(9223372036854775808L); // KO\n" +
+ " ^^^^^^^^^^^^^^^^^^^^\n" +
+ "The literal 9223372036854775808L of type long is out of range \n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 6)\n" +
+ " System.out.println(23092395825689123986L); // KO\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The literal 23092395825689123986L of type long is out of range \n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182
@@ -626,147 +626,147 @@ public void test014() throws Exception {
this.runConformTest(
new String[] {
"X.java",
- "public class X {\n" +
- " X fx;\n" +
- " final static boolean DBG = false;\n" +
- " void foo1(X x) {\n" +
- " if (x.DBG) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " boolean bb;\n" +
- " if (bb = x.DBG) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo2(X x) {\n" +
- " while (x.DBG) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo3(X x) {\n" +
- " for (;x.DBG;) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo4(X x) {\n" +
- " boolean b = x.DBG ? x == null : x.DBG;\n" +
- " }\n" +
- " void foo5() {\n" +
- " if (this.fx.DBG) {\n" +
- " boolean b = this.fx.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo6() {\n" +
- " while (this.fx.DBG) {\n" +
- " boolean b = this.fx.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo7() {\n" +
- " for (;this.fx.DBG;) {\n" +
- " boolean b = this.fx.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo8() {\n" +
- " boolean b = this.fx.DBG ? this.fx == null : this.fx.DBG;\n" +
+ "public class X {\n" +
+ " X fx;\n" +
+ " final static boolean DBG = false;\n" +
+ " void foo1(X x) {\n" +
+ " if (x.DBG) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " boolean bb;\n" +
+ " if (bb = x.DBG) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo2(X x) {\n" +
+ " while (x.DBG) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo3(X x) {\n" +
+ " for (;x.DBG;) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo4(X x) {\n" +
+ " boolean b = x.DBG ? x == null : x.DBG;\n" +
+ " }\n" +
+ " void foo5() {\n" +
+ " if (this.fx.DBG) {\n" +
+ " boolean b = this.fx.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo6() {\n" +
+ " while (this.fx.DBG) {\n" +
+ " boolean b = this.fx.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo7() {\n" +
+ " for (;this.fx.DBG;) {\n" +
+ " boolean b = this.fx.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo8() {\n" +
+ " boolean b = this.fx.DBG ? this.fx == null : this.fx.DBG;\n" +
" }\n" +
"}\n",
},
"");
// ensure boolean codegen got optimized (optimizedBooleanConstant)
String expectedOutput =
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 2, Locals: 4\n" +
- " void foo1(X x);\n" +
- " 0 iconst_0\n" +
- " 1 dup\n" +
- " 2 istore_2 [bb]\n" +
- " 3 ifeq 8\n" +
- " 6 iconst_0\n" +
- " 7 istore_3\n" +
- " 8 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 9]\n" +
- " [pc: 6, line: 10]\n" +
- " [pc: 8, line: 12]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 9] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 9] local: x index: 1 type: X\n" +
- " [pc: 3, pc: 9] local: bb index: 2 type: boolean\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 0, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 17]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 0, Locals: 2\n" +
- " void foo3(X x);\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 22]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 1, Locals: 3\n" +
- " void foo4(X x);\n" +
- " 0 iconst_0\n" +
- " 1 istore_2 [b]\n" +
- " 2 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 24]\n" +
- " [pc: 2, line: 25]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 3] local: x index: 1 type: X\n" +
- " [pc: 2, pc: 3] local: b index: 2 type: boolean\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 0, Locals: 1\n" +
- " void foo5();\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 30]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 0, Locals: 1\n" +
- " void foo6();\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 35]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 0, Locals: 1\n" +
- " void foo7();\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 40]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo8();\n" +
- " 0 iconst_0\n" +
- " 1 istore_1 [b]\n" +
- " 2 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 42]\n" +
- " [pc: 2, line: 43]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 2, Locals: 4\n" +
+ " void foo1(X x);\n" +
+ " 0 iconst_0\n" +
+ " 1 dup\n" +
+ " 2 istore_2 [bb]\n" +
+ " 3 ifeq 8\n" +
+ " 6 iconst_0\n" +
+ " 7 istore_3\n" +
+ " 8 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 9]\n" +
+ " [pc: 6, line: 10]\n" +
+ " [pc: 8, line: 12]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 9] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 9] local: x index: 1 type: X\n" +
+ " [pc: 3, pc: 9] local: bb index: 2 type: boolean\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 0, Locals: 2\n" +
+ " void foo2(X x);\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 17]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 0, Locals: 2\n" +
+ " void foo3(X x);\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 22]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 1, Locals: 3\n" +
+ " void foo4(X x);\n" +
+ " 0 iconst_0\n" +
+ " 1 istore_2 [b]\n" +
+ " 2 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 24]\n" +
+ " [pc: 2, line: 25]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 3] local: x index: 1 type: X\n" +
+ " [pc: 2, pc: 3] local: b index: 2 type: boolean\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 0, Locals: 1\n" +
+ " void foo5();\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 30]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 0, Locals: 1\n" +
+ " void foo6();\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 35]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 0, Locals: 1\n" +
+ " void foo7();\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 40]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 1, Locals: 2\n" +
+ " void foo8();\n" +
+ " 0 iconst_0\n" +
+ " 1 istore_1 [b]\n" +
+ " 2 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 42]\n" +
+ " [pc: 2, line: 43]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
" [pc: 2, pc: 3] local: b index: 1 type: boolean\n";
-
+
File f = new File(OUTPUT_DIR + File.separator + "X.class");
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
@@ -778,7 +778,7 @@ public void test014() throws Exception {
if (index == -1) {
assertEquals("Wrong contents", expectedOutput, result);
}
-
+
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182 - variation
public void test015() throws Exception {
@@ -786,147 +786,147 @@ public void test015() throws Exception {
this.runConformTest(
new String[] {
"X.java",
- "public class X {\n" +
- " X fx;\n" +
- " final static boolean DBG = false;\n" +
- " void foo1(X x) {\n" +
- " if (x.DBG) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " boolean bb;\n" +
- " if (bb = x.DBG) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo2(X x) {\n" +
- " while (x.DBG) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo3(X x) {\n" +
- " for (;x.DBG;) {\n" +
- " boolean b = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo4(X x) {\n" +
- " boolean b = x.DBG ? x == null : x.DBG;\n" +
- " }\n" +
- " void foo5() {\n" +
- " if (this.fx.DBG) {\n" +
- " boolean b = this.fx.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo6() {\n" +
- " while (this.fx.DBG) {\n" +
- " boolean b = this.fx.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo7() {\n" +
- " for (;this.fx.DBG;) {\n" +
- " boolean b = this.fx.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo8() {\n" +
- " boolean b = this.fx.DBG ? this.fx == null : this.fx.DBG;\n" +
+ "public class X {\n" +
+ " X fx;\n" +
+ " final static boolean DBG = false;\n" +
+ " void foo1(X x) {\n" +
+ " if (x.DBG) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " boolean bb;\n" +
+ " if (bb = x.DBG) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo2(X x) {\n" +
+ " while (x.DBG) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo3(X x) {\n" +
+ " for (;x.DBG;) {\n" +
+ " boolean b = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo4(X x) {\n" +
+ " boolean b = x.DBG ? x == null : x.DBG;\n" +
+ " }\n" +
+ " void foo5() {\n" +
+ " if (this.fx.DBG) {\n" +
+ " boolean b = this.fx.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo6() {\n" +
+ " while (this.fx.DBG) {\n" +
+ " boolean b = this.fx.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo7() {\n" +
+ " for (;this.fx.DBG;) {\n" +
+ " boolean b = this.fx.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo8() {\n" +
+ " boolean b = this.fx.DBG ? this.fx == null : this.fx.DBG;\n" +
" }\n" +
"}\n",
},
"");
// ensure boolean codegen got optimized (optimizedBooleanConstant)
String expectedOutput =
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 2, Locals: 4\n" +
- " void foo1(X x);\n" +
- " 0 iconst_0\n" +
- " 1 dup\n" +
- " 2 istore_2 [bb]\n" +
- " 3 ifeq 8\n" +
- " 6 iconst_0\n" +
- " 7 istore_3\n" +
- " 8 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 9]\n" +
- " [pc: 6, line: 10]\n" +
- " [pc: 8, line: 12]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 9] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 9] local: x index: 1 type: X\n" +
- " [pc: 3, pc: 9] local: bb index: 2 type: boolean\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 0, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 17]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 0, Locals: 2\n" +
- " void foo3(X x);\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 22]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 1, Locals: 3\n" +
- " void foo4(X x);\n" +
- " 0 iconst_0\n" +
- " 1 istore_2 [b]\n" +
- " 2 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 24]\n" +
- " [pc: 2, line: 25]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 3] local: x index: 1 type: X\n" +
- " [pc: 2, pc: 3] local: b index: 2 type: boolean\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 0, Locals: 1\n" +
- " void foo5();\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 30]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 0, Locals: 1\n" +
- " void foo6();\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 35]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 0, Locals: 1\n" +
- " void foo7();\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 40]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo8();\n" +
- " 0 iconst_0\n" +
- " 1 istore_1 [b]\n" +
- " 2 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 42]\n" +
- " [pc: 2, line: 43]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
- " [pc: 2, pc: 3] local: b index: 1 type: boolean\n";
-
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 2, Locals: 4\n" +
+ " void foo1(X x);\n" +
+ " 0 iconst_0\n" +
+ " 1 dup\n" +
+ " 2 istore_2 [bb]\n" +
+ " 3 ifeq 8\n" +
+ " 6 iconst_0\n" +
+ " 7 istore_3\n" +
+ " 8 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 9]\n" +
+ " [pc: 6, line: 10]\n" +
+ " [pc: 8, line: 12]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 9] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 9] local: x index: 1 type: X\n" +
+ " [pc: 3, pc: 9] local: bb index: 2 type: boolean\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 0, Locals: 2\n" +
+ " void foo2(X x);\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 17]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 0, Locals: 2\n" +
+ " void foo3(X x);\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 22]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 1, Locals: 3\n" +
+ " void foo4(X x);\n" +
+ " 0 iconst_0\n" +
+ " 1 istore_2 [b]\n" +
+ " 2 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 24]\n" +
+ " [pc: 2, line: 25]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 3] local: x index: 1 type: X\n" +
+ " [pc: 2, pc: 3] local: b index: 2 type: boolean\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 0, Locals: 1\n" +
+ " void foo5();\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 30]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 0, Locals: 1\n" +
+ " void foo6();\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 35]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 0, Locals: 1\n" +
+ " void foo7();\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 40]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 1, Locals: 2\n" +
+ " void foo8();\n" +
+ " 0 iconst_0\n" +
+ " 1 istore_1 [b]\n" +
+ " 2 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 42]\n" +
+ " [pc: 2, line: 43]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
+ " [pc: 2, pc: 3] local: b index: 1 type: boolean\n";
+
File f = new File(OUTPUT_DIR + File.separator + "X.class");
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
@@ -937,7 +937,7 @@ public void test015() throws Exception {
}
if (index == -1) {
assertEquals("Wrong contents", expectedOutput, result);
- }
+ }
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182 - variation
public void test016() throws Exception {
@@ -945,87 +945,87 @@ public void test016() throws Exception {
this.runConformTest(
new String[] {
"X.java",
- "public class X {\n" +
- " X fx;\n" +
- " final static boolean DBG = false;\n" +
- " void foo1(X x) {\n" +
- " boolean b;\n" +
- " if (false ? false : x.DBG) {\n" +
- " boolean bb = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo2(X x) {\n" +
- " boolean b;\n" +
- " while (x == null ? x.DBG : x.DBG) {\n" +
- " boolean bb = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo3(X x) {\n" +
- " boolean b;\n" +
- " for (;x == null ? x.DBG : x.DBG;) {\n" +
- " boolean bb = x.DBG;\n" +
- " }\n" +
- " }\n" +
- " void foo4(X x) {\n" +
- " boolean bb = (x == null ? x.DBG : x.DBG) ? x == null : x.DBG;\n" +
- " }\n" +
+ "public class X {\n" +
+ " X fx;\n" +
+ " final static boolean DBG = false;\n" +
+ " void foo1(X x) {\n" +
+ " boolean b;\n" +
+ " if (false ? false : x.DBG) {\n" +
+ " boolean bb = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo2(X x) {\n" +
+ " boolean b;\n" +
+ " while (x == null ? x.DBG : x.DBG) {\n" +
+ " boolean bb = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo3(X x) {\n" +
+ " boolean b;\n" +
+ " for (;x == null ? x.DBG : x.DBG;) {\n" +
+ " boolean bb = x.DBG;\n" +
+ " }\n" +
+ " }\n" +
+ " void foo4(X x) {\n" +
+ " boolean bb = (x == null ? x.DBG : x.DBG) ? x == null : x.DBG;\n" +
+ " }\n" +
"}\n",
},
"");
// ensure boolean codegen got optimized (optimizedBooleanConstant)
String expectedOutput =
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 0, Locals: 2\n" +
- " void foo1(X x);\n" +
- " 0 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 9]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 aload_1 [x]\n" +
- " 1 ifnonnull 4\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 12]\n" +
- " [pc: 4, line: 15]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 5] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo3(X x);\n" +
- " 0 aload_1 [x]\n" +
- " 1 ifnonnull 4\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 18]\n" +
- " [pc: 4, line: 21]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 5] local: x index: 1 type: X\n" +
- " \n" +
- " // Method descriptor #20 (LX;)V\n" +
- " // Stack: 1, Locals: 3\n" +
- " void foo4(X x);\n" +
- " 0 aload_1 [x]\n" +
- " 1 ifnonnull 4\n" +
- " 4 iconst_0\n" +
- " 5 istore_2 [bb]\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 23]\n" +
- " [pc: 6, line: 24]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " [pc: 0, pc: 7] local: x index: 1 type: X\n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 0, Locals: 2\n" +
+ " void foo1(X x);\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 9]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 1] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 1] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 1, Locals: 2\n" +
+ " void foo2(X x);\n" +
+ " 0 aload_1 [x]\n" +
+ " 1 ifnonnull 4\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 12]\n" +
+ " [pc: 4, line: 15]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 5] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 1, Locals: 2\n" +
+ " void foo3(X x);\n" +
+ " 0 aload_1 [x]\n" +
+ " 1 ifnonnull 4\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 18]\n" +
+ " [pc: 4, line: 21]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 5] local: x index: 1 type: X\n" +
+ " \n" +
+ " // Method descriptor #20 (LX;)V\n" +
+ " // Stack: 1, Locals: 3\n" +
+ " void foo4(X x);\n" +
+ " 0 aload_1 [x]\n" +
+ " 1 ifnonnull 4\n" +
+ " 4 iconst_0\n" +
+ " 5 istore_2 [bb]\n" +
+ " 6 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 23]\n" +
+ " [pc: 6, line: 24]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 7] local: x index: 1 type: X\n" +
" [pc: 6, pc: 7] local: bb index: 2 type: boolean\n";
-
+
File f = new File(OUTPUT_DIR + File.separator + "X.class");
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
@@ -1045,7 +1045,7 @@ public void test017() {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
- " int x = 2;\n" +
+ " int x = 2;\n" +
" System.out.println(\"n: \"+(x > 1 ? 2 : 1.0));\n" +
" }\n" +
"}",
@@ -1098,11 +1098,11 @@ public void test020() {
" }\n" +
"}",
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " static final String notAConstant = null;\n" +
- " ^^^^^^^^^^^^\n" +
- "The field notAConstant cannot be declared static; static fields can only be declared in static or top level types\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " static final String notAConstant = null;\n" +
+ " ^^^^^^^^^^^^\n" +
+ "The field notAConstant cannot be declared static; static fields can only be declared in static or top level types\n" +
"----------\n");
}
public static Class testClass() {

Back to the top