Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java1166
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java686
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java62
3 files changed, 1402 insertions, 512 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java
index 3ec01c183c..be5366857d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java
@@ -10,6 +10,13 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.jdt.core.ToolFactory;
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -414,6 +421,1165 @@ public void test017() {
},
"SUCCESS");
}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120
+public void test018() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0++) || true) != ((true && true) && (!(false || true)))));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 3, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 getstatic X.f0 : float [26]\n" +
+ " 10 fconst_1\n" +
+ " 11 fadd\n" +
+ " 12 putstatic X.f0 : float [26]\n" +
+ " 15 iconst_1\n" +
+ " 16 invokevirtual java.io.PrintStream.println(boolean) : void [28]\n" +
+ " 19 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 16, line: 8]\n" +
+ " [pc: 19, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 20] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 20] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test019() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0++) || false) != true));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 5, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 lload_1 [l11]\n" +
+ " 8 l2f\n" +
+ " 9 getstatic X.f0 : float [26]\n" +
+ " 12 dup\n" +
+ " 13 fconst_1\n" +
+ " 14 fadd\n" +
+ " 15 putstatic X.f0 : float [26]\n" +
+ " 18 fcmpg\n" +
+ " 19 ifge 26\n" +
+ " 22 iconst_0\n" +
+ " 23 goto 27\n" +
+ " 26 iconst_1\n" +
+ " 27 invokevirtual java.io.PrintStream.println(boolean) : void [28]\n" +
+ " 30 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 27, line: 8]\n" +
+ " [pc: 30, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 31] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 31] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test020() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) | true) != false));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_1\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test021() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) && false) != true));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_1\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test022() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) & false) != true));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_1\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120
+public void test023() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0++) || true) == ((true && true) && (!(false || true)))));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 3, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 getstatic X.f0 : float [26]\n" +
+ " 10 fconst_1\n" +
+ " 11 fadd\n" +
+ " 12 putstatic X.f0 : float [26]\n" +
+ " 15 iconst_0\n" +
+ " 16 invokevirtual java.io.PrintStream.println(boolean) : void [28]\n" +
+ " 19 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 16, line: 8]\n" +
+ " [pc: 19, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 20] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 20] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test024() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0++) || false) == true));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 5, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 lload_1 [l11]\n" +
+ " 8 l2f\n" +
+ " 9 getstatic X.f0 : float [26]\n" +
+ " 12 dup\n" +
+ " 13 fconst_1\n" +
+ " 14 fadd\n" +
+ " 15 putstatic X.f0 : float [26]\n" +
+ " 18 fcmpg\n" +
+ " 19 ifge 26\n" +
+ " 22 iconst_1\n" +
+ " 23 goto 27\n" +
+ " 26 iconst_0\n" +
+ " 27 invokevirtual java.io.PrintStream.println(boolean) : void [28]\n" +
+ " 30 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 27, line: 8]\n" +
+ " [pc: 30, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 31] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 31] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test025() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) | true) == false));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_0\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test026() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) && false) == true));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_0\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n" +
+ "}";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test027() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) & false) == true));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_0\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test028() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0) || true) == false));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 iconst_0\n" +
+ " 8 invokevirtual java.io.PrintStream.println(boolean) : void [26]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 8, line: 8]\n" +
+ " [pc: 11, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 12] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 12] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test029() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " System.out.println(\n" +
+ " ((foo() || bar()) || true) && false); \n" +
+ " }\n" +
+ " static boolean foo(){ \n" +
+ " System.out.print(\"foo\");\n" +
+ " return false;\n" +
+ " }\n" +
+ " static boolean bar(){\n" +
+ " System.out.print(\"bar\");\n" +
+ " return true;\n" +
+ " }\n" +
+ "}\n",
+ },
+ "foobarfalse");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([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 [18]\n" +
+ " 3 invokestatic X.foo() : boolean [24]\n" +
+ " 6 ifne 13\n" +
+ " 9 invokestatic X.bar() : boolean [28]\n" +
+ " 12 pop\n" +
+ " 13 iconst_0\n" +
+ " 14 invokevirtual java.io.PrintStream.println(boolean) : void [31]\n" +
+ " 17 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 3, line: 7]\n" +
+ " [pc: 14, line: 6]\n" +
+ " [pc: 17, line: 8]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 18] local: args index: 0 type: java.lang.String[]\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117120 - variation
+public void test030() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static float f0;\n" +
+ " \n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " \n" +
+ " System.out.println(\n" +
+ " (((l11 < f0++) || true) == ((foo() || bar()) || true)));\n" +
+ " }\n" +
+ " static boolean foo() {\n" +
+ " System.out.print(\"foo\");\n" +
+ " return false;\n" +
+ " }\n" +
+ " static boolean bar() {\n" +
+ " System.out.print(\"bar\");\n" +
+ " return true;\n" +
+ " }\n" +
+ "}\n",
+ },
+ "foobartrue");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 3, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 getstatic X.f0 : float [26]\n" +
+ " 10 fconst_1\n" +
+ " 11 fadd\n" +
+ " 12 putstatic X.f0 : float [26]\n" +
+ " 15 invokestatic X.foo() : boolean [28]\n" +
+ " 18 ifne 25\n" +
+ " 21 invokestatic X.bar() : boolean [32]\n" +
+ " 24 pop\n" +
+ " 25 iconst_1\n" +
+ " 26 invokevirtual java.io.PrintStream.println(boolean) : void [35]\n" +
+ " 29 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 8]\n" +
+ " [pc: 7, line: 9]\n" +
+ " [pc: 26, line: 8]\n" +
+ " [pc: 29, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 30] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 30] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117451
+public void test031() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public float f0;\n" +
+ "\n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " X x = new X();\n" +
+ " System.out.println(\n" +
+ " (((l11 < x.f0) || true) != false));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput = this.complianceLevel.equals(COMPLIANCE_1_3)
+ ? " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 4\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 new X [1]\n" +
+ " 7 dup\n" +
+ " 8 invokespecial X() [20]\n" +
+ " 11 astore_3 [x]\n" +
+ " 12 getstatic java.lang.System.out : java.io.PrintStream [21]\n" +
+ " 15 aload_3 [x]\n" +
+ " 16 invokevirtual java.lang.Object.getClass() : java.lang.Class [27]\n" +
+ " 19 pop\n" +
+ " 20 iconst_1\n" +
+ " 21 invokevirtual java.io.PrintStream.println(boolean) : void [31]\n" +
+ " 24 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 7]\n" +
+ " [pc: 12, line: 8]\n" +
+ " [pc: 15, line: 9]\n" +
+ " [pc: 21, line: 8]\n" +
+ " [pc: 24, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 25] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 25] local: l11 index: 1 type: long\n" +
+ " [pc: 12, pc: 25] local: x index: 3 type: X\n"
+
+ : " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 4\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 new X [1]\n" +
+ " 7 dup\n" +
+ " 8 invokespecial X() [20]\n" +
+ " 11 astore_3 [x]\n" +
+ " 12 getstatic java.lang.System.out : java.io.PrintStream [21]\n" +
+ " 15 aload_3 [x]\n" +
+ " 16 getfield X.f0 : float [27]\n" +
+ " 19 pop\n" +
+ " 20 iconst_1\n" +
+ " 21 invokevirtual java.io.PrintStream.println(boolean) : void [29]\n" +
+ " 24 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 7]\n" +
+ " [pc: 12, line: 8]\n" +
+ " [pc: 15, line: 9]\n" +
+ " [pc: 21, line: 8]\n" +
+ " [pc: 24, line: 10]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 25] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 25] local: l11 index: 1 type: long\n" +
+ " [pc: 12, pc: 25] local: x index: 3 type: X\n";
+
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117451 - variation
+public void test032() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static float f0;\n" +
+ "\n" +
+ " public static void main(String[] args)\n" +
+ " {\n" +
+ " long l11 = -26;\n" +
+ " System.out.println(\n" +
+ " (((l11 < (f0=13)) || true) != false));\n" +
+ " }\n" +
+ "}\n",
+ },
+ "true");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 ldc2_w <Long -26> [18]\n" +
+ " 3 lstore_1 [l11]\n" +
+ " 4 getstatic java.lang.System.out : java.io.PrintStream [20]\n" +
+ " 7 ldc <Float 13.0> [26]\n" +
+ " 9 putstatic X.f0 : float [27]\n" +
+ " 12 iconst_1\n" +
+ " 13 invokevirtual java.io.PrintStream.println(boolean) : void [29]\n" +
+ " 16 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " [pc: 4, line: 7]\n" +
+ " [pc: 7, line: 8]\n" +
+ " [pc: 13, line: 7]\n" +
+ " [pc: 16, line: 9]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 17] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 4, pc: 17] local: l11 index: 1 type: long\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+
+public void test033() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " boolean b = true;\n" +
+ " System.out.print(b ^ b);\n" +
+ " System.out.println(b ^ true);\n" +
+ " } \n" +
+ "}\n",
+ },
+ "falsefalse");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
+ " // Stack: 3, Locals: 2\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 iconst_1\n" +
+ " 1 istore_1 [b]\n" +
+ " 2 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 5 iload_1 [b]\n" +
+ " 6 iload_1 [b]\n" +
+ " 7 ixor\n" +
+ " 8 invokevirtual java.io.PrintStream.print(boolean) : void [22]\n" +
+ " 11 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 14 iload_1 [b]\n" +
+ " 15 iconst_1\n" +
+ " 16 ixor\n" +
+ " 17 invokevirtual java.io.PrintStream.println(boolean) : void [28]\n" +
+ " 20 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 3]\n" +
+ " [pc: 2, line: 4]\n" +
+ " [pc: 11, line: 5]\n" +
+ " [pc: 20, line: 6]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 21] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 2, pc: 21] local: b index: 1 type: boolean\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+public void test034() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " boolean b = true;\n" +
+ " if ((b ^ true) || b) {\n" +
+ " System.out.println(\"SUCCESS\");\n" +
+ " }\n" +
+ " } \n" +
+ "}\n",
+ },
+ "SUCCESS");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #15 ([Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 2\n" +
+ " public static void main(java.lang.String[] args);\n" +
+ " 0 iconst_1\n" +
+ " 1 istore_1 [b]\n" +
+ " 2 iload_1 [b]\n" +
+ " 3 ifeq 10\n" +
+ " 6 iload_1 [b]\n" +
+ " 7 ifeq 18\n" +
+ " 10 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
+ " 13 ldc <String \"SUCCESS\"> [22]\n" +
+ " 15 invokevirtual java.io.PrintStream.println(java.lang.String) : void [24]\n" +
+ " 18 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 3]\n" +
+ " [pc: 2, line: 4]\n" +
+ " [pc: 10, line: 5]\n" +
+ " [pc: 18, line: 7]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 19] local: args index: 0 type: java.lang.String[]\n" +
+ " [pc: 2, pc: 19] local: b index: 1 type: boolean\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117451 - variation
+public void test035() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static float f0;\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println((X.f0 > 0 || true) == false);\n" +
+ " } \n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #17 ([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 [18]\n" +
+ " 3 iconst_0\n" +
+ " 4 invokevirtual java.io.PrintStream.println(boolean) : void [24]\n" +
+ " 7 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 4]\n" +
+ " [pc: 7, line: 5]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 8] local: args index: 0 type: java.lang.String[]\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117451 - variation
+public void test036() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " float f0;\n" +
+ " public static void main(String[] args) {\n" +
+ " new X().foo();\n" +
+ " }\n" +
+ " void foo() {\n" +
+ " System.out.println((this.f0 > 0 || true) == false);\n" +
+ " } \n" +
+ "}\n",
+ },
+ "false");
+ // ensure optimized boolean codegen sequence
+ String expectedOutput =
+ " // Method descriptor #8 ()V\n" +
+ " // Stack: 2, Locals: 1\n" +
+ " void foo();\n" +
+ " 0 getstatic java.lang.System.out : java.io.PrintStream [24]\n" +
+ " 3 iconst_0\n" +
+ " 4 invokevirtual java.io.PrintStream.println(boolean) : void [30]\n" +
+ " 7 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 7]\n" +
+ " [pc: 7, line: 8]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 8] local: this index: 0 type: X\n";
+
+ try {
+ 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();
+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
+ int index = result.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(result, 3));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, result);
+ }
+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+}
+
public static Class testClass() {
return BooleanTest.class;
}
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 ff042cef3c..1580da86e7 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
@@ -19,8 +19,6 @@ import junit.framework.TestSuite;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
public class ConstantTest extends AbstractRegressionTest {
@@ -691,244 +689,110 @@ public void test014() {
"");
// ensure boolean codegen got optimized (optimizedBooleanConstant)
String expectedOutput =
- CompilerOptions.versionToJdkLevel(getCompilerOptions().get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_4
- ? " // 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: 1, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 iconst_0\n" +
- " 1 ifeq 4\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 14]\n" +
- " [pc: 4, line: 17]\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 iconst_0\n" +
- " 1 ifne 0\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 19]\n" +
- " [pc: 4, line: 22]\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 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: 1, Locals: 1\n" +
- " void foo5();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 27]\n" +
- " [pc: 2, line: 30]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo6();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 iconst_0\n" +
- " 3 ifeq 6\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 32]\n" +
- " [pc: 6, line: 35]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo7();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 iconst_0\n" +
- " 3 ifne 0\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 37]\n" +
- " [pc: 6, line: 40]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo8();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 aload_0 [this]\n" +
- " 3 pop\n" +
- " 4 iconst_0\n" +
- " 5 istore_1 [b]\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 42]\n" +
- " [pc: 6, line: 43]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " [pc: 6, pc: 7] 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: 1, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 iconst_0\n" +
- " 1 ifeq 4\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 14]\n" +
- " [pc: 4, line: 17]\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 iconst_0\n" +
- " 1 ifne 0\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 19]\n" +
- " [pc: 4, line: 22]\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 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: 1, Locals: 1\n" +
- " void foo5();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 27]\n" +
- " [pc: 5, line: 30]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 6] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo6();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 iconst_0\n" +
- " 6 ifeq 9\n" +
- " 9 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 32]\n" +
- " [pc: 9, line: 35]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 10] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo7();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 iconst_0\n" +
- " 6 ifne 0\n" +
- " 9 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 37]\n" +
- " [pc: 9, line: 40]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 10] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo8();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 aload_0 [this]\n" +
- " 6 getfield X.fx : X [28]\n" +
- " 9 pop\n" +
- " 10 iconst_0\n" +
- " 11 istore_1 [b]\n" +
- " 12 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 42]\n" +
- " [pc: 12, line: 43]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 13] local: this index: 0 type: X\n" +
- " [pc: 12, pc: 13] 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: 1, Locals: 2\n" +
+ " void foo2(X x);\n" +
+ " 0 iconst_0\n" +
+ " 1 ifeq 4\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 14]\n" +
+ " [pc: 4, line: 17]\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 iconst_0\n" +
+ " 1 ifne 0\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 19]\n" +
+ " [pc: 4, line: 22]\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 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: 1, Locals: 1\n" +
+ " void foo6();\n" +
+ " 0 iconst_0\n" +
+ " 1 ifeq 4\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 32]\n" +
+ " [pc: 4, line: 35]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " void foo7();\n" +
+ " 0 iconst_0\n" +
+ " 1 ifne 0\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 37]\n" +
+ " [pc: 4, line: 40]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] 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";
try {
File f = new File(OUTPUT_DIR + File.separator + "X.class");
@@ -1002,244 +866,110 @@ public void test015() {
"");
// ensure boolean codegen got optimized (optimizedBooleanConstant)
String expectedOutput =
- CompilerOptions.versionToJdkLevel(getCompilerOptions().get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_4
- ? " // 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: 1, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 iconst_0\n" +
- " 1 ifeq 4\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 14]\n" +
- " [pc: 4, line: 17]\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 iconst_0\n" +
- " 1 ifne 0\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 19]\n" +
- " [pc: 4, line: 22]\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 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: 1, Locals: 1\n" +
- " void foo5();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 27]\n" +
- " [pc: 2, line: 30]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo6();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 iconst_0\n" +
- " 3 ifeq 6\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 32]\n" +
- " [pc: 6, line: 35]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo7();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 iconst_0\n" +
- " 3 ifne 0\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 37]\n" +
- " [pc: 6, line: 40]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo8();\n" +
- " 0 aload_0 [this]\n" +
- " 1 pop\n" +
- " 2 aload_0 [this]\n" +
- " 3 pop\n" +
- " 4 iconst_0\n" +
- " 5 istore_1 [b]\n" +
- " 6 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 42]\n" +
- " [pc: 6, line: 43]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 7] local: this index: 0 type: X\n" +
- " [pc: 6, pc: 7] 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: 1, Locals: 2\n" +
- " void foo2(X x);\n" +
- " 0 iconst_0\n" +
- " 1 ifeq 4\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 14]\n" +
- " [pc: 4, line: 17]\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 iconst_0\n" +
- " 1 ifne 0\n" +
- " 4 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 19]\n" +
- " [pc: 4, line: 22]\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 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: 1, Locals: 1\n" +
- " void foo5();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 27]\n" +
- " [pc: 5, line: 30]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 6] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo6();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 iconst_0\n" +
- " 6 ifeq 9\n" +
- " 9 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 32]\n" +
- " [pc: 9, line: 35]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 10] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 1\n" +
- " void foo7();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 iconst_0\n" +
- " 6 ifne 0\n" +
- " 9 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 37]\n" +
- " [pc: 9, line: 40]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 10] local: this index: 0 type: X\n" +
- " \n" +
- " // Method descriptor #12 ()V\n" +
- " // Stack: 1, Locals: 2\n" +
- " void foo8();\n" +
- " 0 aload_0 [this]\n" +
- " 1 getfield X.fx : X [28]\n" +
- " 4 pop\n" +
- " 5 aload_0 [this]\n" +
- " 6 getfield X.fx : X [28]\n" +
- " 9 pop\n" +
- " 10 iconst_0\n" +
- " 11 istore_1 [b]\n" +
- " 12 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 42]\n" +
- " [pc: 12, line: 43]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 13] local: this index: 0 type: X\n" +
- " [pc: 12, pc: 13] 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: 1, Locals: 2\n" +
+ " void foo2(X x);\n" +
+ " 0 iconst_0\n" +
+ " 1 ifeq 4\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 14]\n" +
+ " [pc: 4, line: 17]\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 iconst_0\n" +
+ " 1 ifne 0\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 19]\n" +
+ " [pc: 4, line: 22]\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 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: 1, Locals: 1\n" +
+ " void foo6();\n" +
+ " 0 iconst_0\n" +
+ " 1 ifeq 4\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 32]\n" +
+ " [pc: 4, line: 35]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #12 ()V\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " void foo7();\n" +
+ " 0 iconst_0\n" +
+ " 1 ifne 0\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 37]\n" +
+ " [pc: 4, line: 40]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] 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";
try {
File f = new File(OUTPUT_DIR + File.separator + "X.class");
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index 380fc14a6d..2840162df7 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -14781,22 +14781,22 @@ public void test500(){
this.runConformTest(
new String[] {
"X.java",
- "class XA {}\n" +
- "interface XB {\n" +
- " XB CONST = new XB(){ public String toString() { return \"SUCCESS\"; }};\n" +
- "}\n" +
- "class XAB extends XA implements XB {}\n" +
- "\n" +
- "public class X <E extends XA&XB> {\n" +
- " E e;\n" +
- " public static void main(String[] args) {\n" +
- " System.out.print(new X<XAB>().e.CONST);\n" +
- " new X<XAB>().foo();\n" +
- " }\n" +
- " public void foo() {\n" +
- " System.out.print(this.e.CONST);\n" +
- " }\n" +
- "}\n",
+ "class XA {}\n" +
+ "interface XB {\n" +
+ " XB CONST = new XB(){ public String toString() { return \"SUCCESS\"; }};\n" +
+ "}\n" +
+ "class XAB extends XA implements XB {}\n" +
+ "\n" +
+ "public class X <E extends XA&XB> {\n" +
+ " E e;\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.print(new X<XAB>().e.CONST);\n" +
+ " new X<XAB>().foo();\n" +
+ " }\n" +
+ " public void foo() {\n" +
+ " System.out.print(this.e.CONST);\n" +
+ " }\n" +
+ "}\n",
},
"SUCCESSSUCCESS");
String expectedOutput =
@@ -14848,19 +14848,16 @@ public void test500(){
" // Stack: 2, Locals: 1\n" +
" public void foo();\n" +
" 0 getstatic java.lang.System.out : java.io.PrintStream [22]\n" +
- " 3 aload_0 [this]\n" +
- " 4 getfield X.e : XA [29]\n" +
- " 7 pop\n" +
- " 8 getstatic XB.CONST : XB [48]\n" +
- " 11 invokevirtual java.io.PrintStream.print(java.lang.Object) : void [37]\n" +
- " 14 return\n" +
+ " 3 getstatic XB.CONST : XB [48]\n" +
+ " 6 invokevirtual java.io.PrintStream.print(java.lang.Object) : void [37]\n" +
+ " 9 return\n" +
" Line numbers:\n" +
" [pc: 0, line: 14]\n" +
- " [pc: 14, line: 15]\n" +
+ " [pc: 9, line: 15]\n" +
" Local variable table:\n" +
- " [pc: 0, pc: 15] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 10] local: this index: 0 type: X\n" +
" Local variable type table:\n" +
- " [pc: 0, pc: 15] local: this index: 0 type: X<E>\n" +
+ " [pc: 0, pc: 10] local: this index: 0 type: X<E>\n" +
"}";
try {
@@ -15067,21 +15064,18 @@ public void test500(){
" 5 invokespecial X$1(X) [30]\n" +
" 8 invokevirtual X$1.run() : void [33]\n" +
" 11 getstatic java.lang.System.out : java.io.PrintStream [36]\n" +
- " 14 aload_0 [this]\n" +
- " 15 getfield X.e : XA [42]\n" +
- " 18 pop\n" +
- " 19 getstatic XB.CONST : XB [44]\n" +
- " 22 invokevirtual java.io.PrintStream.print(java.lang.Object) : void [50]\n" +
- " 25 return\n" +
+ " 14 getstatic XB.CONST : XB [42]\n" +
+ " 17 invokevirtual java.io.PrintStream.print(java.lang.Object) : void [48]\n" +
+ " 20 return\n" +
" Line numbers:\n" +
" [pc: 0, line: 13]\n" +
" [pc: 8, line: 17]\n" +
" [pc: 11, line: 18]\n" +
- " [pc: 25, line: 19]\n" +
+ " [pc: 20, line: 19]\n" +
" Local variable table:\n" +
- " [pc: 0, pc: 26] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 21] local: this index: 0 type: X\n" +
" Local variable type table:\n" +
- " [pc: 0, pc: 26] local: this index: 0 type: X<E>\n" +
+ " [pc: 0, pc: 21] local: this index: 0 type: X<E>\n" +
"\n" +
" Inner classes:\n" +
" [inner class info: #28 X$1, outer class info: #0\n" +

Back to the top