Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-09-23 09:29:43 -0400
committerAndrey Loskutov2019-09-23 10:01:33 -0400
commitd698c9585b5705d5d5c4944bb938bdba566fefdc (patch)
treeb1241263d54c7fe09fba0477192e43f67111e753
parent448898f0ee6a96cdbc767c0d92174b23a153f97b (diff)
downloadeclipse.jdt.core-I20190923-1800.tar.gz
eclipse.jdt.core-I20190923-1800.tar.xz
eclipse.jdt.core-I20190923-1800.zip
Bug 544943 - revert "Changes for new stack map frame"I20190923-1800
This reverts commit ae3d720efce20459d1d746646153478f03bf3002. This commit caused severe regressions, see bug 551368. Change-Id: I3d5b39687726042f61d28a1e427e174c596bab45 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConditionalExpressionTest.java47
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java244
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java35
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java88
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java60
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jarbin37338 -> 35029 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jarbin49646 -> 47396 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jarbin53688 -> 51393 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jarbin85817 -> 85350 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jarbin15583 -> 14586 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jarbin15583 -> 14586 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jarbin15583 -> 22094 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.zipbin0 -> 12320 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zipbin9140 -> 12320 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jarbin20525 -> 0 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zipbin14924 -> 0 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jarbin15677 -> 14680 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java10
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter13/.classpath2
-rw-r--r--org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs190
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java787
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java16
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java607
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java882
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java341
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java1
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java6
38 files changed, 1661 insertions, 1702 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConditionalExpressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConditionalExpressionTest.java
index c9594263c0..d63e379288 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConditionalExpressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConditionalExpressionTest.java
@@ -576,39 +576,20 @@ public class ConditionalExpressionTest extends AbstractRegressionTest {
if (this.complianceLevel < ClassFileConstants.JDK1_8)
return;
this.runNegativeTest(
- new String[] {
- "X.java",
- "public class X extends Y {\n" +
- " public X(Z[] n) {\n" +
- " super((n == null) ? null : n.clone());\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " public Y(Z[] notifications) {\n" +
- " }\n" +
- "}\n" +
- "interface Z {}\n",
- },
- "");
- }
- public void test437444_2() {
- if (this.complianceLevel < ClassFileConstants.JDK1_8)
- return;
- this.runNegativeTest(
- new String[] {
- "X.java",
- "public class X extends Y {\n" +
- " public X(int[] n) {\n" +
- " super((n == null) ? null : n.clone());\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " public Y(int[] notifications) {\n" +
- " }\n" +
- "}\n" +
- "interface Z {}\n",
- },
- "");
+ new String[] {
+ "X.java",
+ "public class X extends Y {\n" +
+ " public X(Z[] n) {\n" +
+ " super((n == null) ? null : n.clone());\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " public Y(Z[] notifications) {\n" +
+ " }\n" +
+ "}\n" +
+ "interface Z {}\n",
+ },
+ "");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=484425: [bytecode] Bad type on operand stack - compiler omitted instructions for unboxing null Boolean
public void test484425() {
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 28c2127cdd..693beeeeb0 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
@@ -367,126 +367,134 @@ public void test009() throws Exception {
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 aconst_null\n" +
- " 10 if_acmpne 21\n" +
- " 13 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 16 ldc <String \"2\"> [30]\n" +
- " 18 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 21 new java.lang.StringBuffer [32]\n" +
- " 24 dup\n" +
- " 25 ldc <String \"[\"> [34]\n" +
- " 27 invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" +
- " 30 aconst_null\n" +
- " 31 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" +
- " 34 ldc <String \"]\"> [42]\n" +
- " 36 invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" +
- " 39 invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" +
- " 42 ldc <String \"[null]\"> [51]\n" +
- " 44 if_acmpne 51\n" +
- " 47 iconst_1\n" +
- " 48 goto 52\n" +
- " 51 iconst_0\n" +
- " 52 istore_1 [b]\n" +
- " 53 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 56 ldc <String \"3\"> [53]\n" +
- " 58 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 61 aconst_null\n" +
- " 62 astore_2 [s]\n" +
- " 63 aload_2 [s]\n" +
- " 64 ifnonnull 75\n" +
- " 67 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 70 ldc <String \"4\"> [55]\n" +
- " 72 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 75 ldc <String \"aaa\"> [57]\n" +
- " 77 astore_3 [s2]\n" +
- " 78 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 81 ldc <String \"5\"> [59]\n" +
- " 83 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
- " 86 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 3]\n" +
- " [pc: 8, line: 4]\n" +
- " [pc: 13, line: 5]\n" +
- " [pc: 21, line: 6]\n" +
- " [pc: 53, line: 7]\n" +
- " [pc: 61, line: 8]\n" +
- " [pc: 63, line: 9]\n" +
- " [pc: 75, line: 10]\n" +
- " [pc: 78, line: 11]\n" +
- " [pc: 86, line: 12]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 87] local: args index: 0 type: java.lang.String[]\n" +
- " [pc: 53, pc: 87] local: b index: 1 type: boolean\n" +
- " [pc: 63, pc: 87] local: s index: 2 type: java.lang.String\n" +
- " [pc: 78, pc: 87] local: s2 index: 3 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.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 aconst_null\n" +
- " 10 if_acmpne 21\n" +
- " 13 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 16 ldc <String \"2\"> [30]\n" +
- " 18 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 21 new java.lang.StringBuilder [32]\n" +
- " 24 dup\n" +
- " 25 ldc <String \"[\"> [34]\n" +
- " 27 invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" +
- " 30 aconst_null\n" +
- " 31 invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" +
- " 34 ldc <String \"]\"> [42]\n" +
- " 36 invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" +
- " 39 invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" +
- " 42 ldc <String \"[null]\"> [51]\n" +
- " 44 if_acmpne 51\n" +
- " 47 iconst_1\n" +
- " 48 goto 52\n" +
- " 51 iconst_0\n" +
- " 52 istore_1 [b]\n" +
- " 53 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 56 ldc <String \"3\"> [53]\n" +
- " 58 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 61 aconst_null\n" +
- " 62 astore_2 [s]\n" +
- " 63 aload_2 [s]\n" +
- " 64 ifnonnull 75\n" +
- " 67 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 70 ldc <String \"4\"> [55]\n" +
- " 72 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
- " 75 ldc <String \"aaa\"> [57]\n" +
- " 77 astore_3 [s2]\n" +
- " 78 getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
- " 81 ldc <String \"5\"> [59]\n" +
- " 83 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
- " 86 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 3]\n" +
- " [pc: 8, line: 4]\n" +
- " [pc: 13, line: 5]\n" +
- " [pc: 21, line: 6]\n" +
- " [pc: 53, line: 7]\n" +
- " [pc: 61, line: 8]\n" +
- " [pc: 63, line: 9]\n" +
- " [pc: 75, line: 10]\n" +
- " [pc: 78, line: 11]\n" +
- " [pc: 86, line: 12]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 87] local: args index: 0 type: java.lang.String[]\n" +
- " [pc: 53, pc: 87] local: b index: 1 type: boolean\n" +
- " [pc: 63, pc: 87] local: s index: 2 type: java.lang.String\n" +
- " [pc: 78, pc: 87] local: s2 index: 3 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);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java
index 0261c95932..36470b3f35 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java
@@ -851,9 +851,13 @@ public class StackMapAttributeTest extends AbstractRegressionTest {
" [pc: 5, pc: 24] local: bar index: 2 type: java.lang.String\n" +
" Stack map table: number of frames 2\n" +
" [pc: 19, full, stack: {java.io.PrintStream}, locals: {java.lang.String[], int, java.lang.String}]\n" +
- " [pc: 20, full, stack: {java.io.PrintStream, java.lang.Comparable}, locals: {java.lang.String[], int, java.lang.String}]\n" +
+ (this.complianceLevel >= ClassFileConstants.JDK1_8 ? // in 1.8 the ternary is resolved to its target type j.l.Object
+ " [pc: 20, full, stack: {java.io.PrintStream, java.lang.Object}, locals: {java.lang.String[], int, java.lang.String}]\n" :
+ " [pc: 20, full, stack: {java.io.PrintStream, java.lang.Comparable}, locals: {java.lang.String[], int, java.lang.String}]\n") +
" \n" +
- " // Method descriptor #48 (Ljava/lang/Comparable;)V\n" +
+ (this.complianceLevel >= ClassFileConstants.JDK1_8 ?
+ " // Method descriptor #46 (Ljava/lang/Comparable;)V\n" :
+ " // Method descriptor #48 (Ljava/lang/Comparable;)V\n") +
" // Signature: <T::Ljava/lang/Comparable<*>;>(TT;)V\n" +
" // Stack: 2, Locals: 3\n" +
" void foo(java.lang.Comparable foo);\n" +
@@ -880,7 +884,11 @@ public class StackMapAttributeTest extends AbstractRegressionTest {
" [pc: 2, pc: 18] local: bar index: 2 type: T\n" +
" Stack map table: number of frames 2\n" +
" [pc: 13, full, stack: {java.io.PrintStream}, locals: {X, java.lang.Comparable, java.lang.Comparable}]\n" +
- " [pc: 14, full, stack: {java.io.PrintStream, java.lang.Comparable}, locals: {X, java.lang.Comparable, java.lang.Comparable}]\n";
+ (this.complianceLevel < ClassFileConstants.JDK1_8 ?
+ " [pc: 14, full, stack: {java.io.PrintStream, java.lang.Comparable}, locals: {X, java.lang.Comparable, java.lang.Comparable}]\n"
+ : // in 1.8 the ternary is resolved to its target type j.l.Object
+ " [pc: 14, full, stack: {java.io.PrintStream, java.lang.Object}, locals: {X, java.lang.Comparable, java.lang.Comparable}]\n"
+ );
int index = actualOutput.indexOf(expectedOutput);
if (index == -1 || expectedOutput.length() == 0) {
@@ -2528,16 +2536,17 @@ public class StackMapAttributeTest extends AbstractRegressionTest {
}
public void test032() {
this.runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " int i = args.length;\n" +
- " X[] array = new X[] { i == 0 ? null : null };\n" +
- " System.out.print(\"SUCCESS\" + array.length);\n" +
- " }\n" +
- "}",
- },
+ new String[] {
+ "X.java",
+ "import java.util.*;\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " int i = args.length;\n" +
+ " X[] array = new X[] { i == 0 ? null : null };\n" +
+ " System.out.print(\"SUCCESS\" + array.length);\n" +
+ " }\n" +
+ "}",
+ },
"SUCCESS1");
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
index 32efd3c180..1fef2d022a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
@@ -631,20 +631,20 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
String[] testFiles = new String[] {
"X.java",
"public class X {\n" +
- "public static void bar(Day day) {\n" +
- " switch (day) {\n" +
- " case SATURDAY, SUNDAY: \n" +
- " System.out.println(Day.SUNDAY);\n" +
- " break;\n" +
- " case MONDAY : System.out.println(Day.MONDAY);\n" +
- " break;\n" +
- " }\n" +
- " }" +
- " public static void main(String[] args) {\n" +
- " bar(Day.SATURDAY);\n" +
- " }\n" +
- "}\n" +
- "enum Day { SATURDAY, SUNDAY, MONDAY;}",
+ "public static void bar(Day day) {\n" +
+ " switch (day) {\n" +
+ " case SATURDAY, SUNDAY: \n" +
+ " System.out.println(Day.SUNDAY);\n" +
+ " break;\n" +
+ " case MONDAY : System.out.println(Day.MONDAY);\n" +
+ " break;\n" +
+ " }\n" +
+ " }" +
+ " public static void main(String[] args) {\n" +
+ " bar(Day.SATURDAY);\n" +
+ " }\n" +
+ "}\n" +
+ "enum Day { SATURDAY, SUNDAY, MONDAY;}",
};
String expectedProblemLog =
@@ -2921,64 +2921,4 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
"Duplicate case\n" +
"----------\n");
}
- public void _testBug544943() {
- runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " @SuppressWarnings(\"preview\")\n" +
- " public static int foo(int i) throws MyException {\n" +
- " int v = -1;\n" +
- " try {\n" +
- " v = switch (i) {\n" +
- " case 0 -> switch(i) {\n" +
- " case 0 -> 1;\n" +
- " default -> throw new MyException();\n" +
- " };\n" +
- " default -> 1;\n" +
- " };\n" +
- " } finally {\n" +
- " // do nothing\n" +
- " }\n" +
- " return v;\n" +
- " } \n" +
- " public static void main(String argv[]) {\n" +
- " try {\n" +
- " System.out.println(X.foo(0));\n" +
- " } catch (MyException e) {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "class MyException extends Exception {\n" +
- " private static final long serialVersionUID = 3461899582505930473L; \n" +
- "}"
- },
- "1");
- }
- public void _testBug544943_2() {
- runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " @SuppressWarnings({ \"preview\" })\n" +
- " public static int foo(int i) throws Exception {\n" +
- " int v = switch (i) {\n" +
- " case 0 -> switch (i) {\n" +
- " case 0 -> 0;\n" +
- " default-> throw new Exception();\n" +
- " case 3 -> 3;\n" +
- " case 2 -> throw new Exception();\n" +
- " };\n" +
- " default -> 0;\n" +
- " };\n" +
- " return v;\n" +
- " }\n" +
- " public static void main(String argv[]) throws Exception {\n" +
- " System.out.println(X.foo(1));\n" +
- " }\n" +
- "}"
- },
- "0");
- }
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
index 8c981768d0..f0dd255882 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
@@ -3480,64 +3480,4 @@ public class SwitchExpressionsYieldTest extends AbstractRegressionTest {
"String literal is not properly closed by a double-quote\n" +
"----------\n");
}
- public void testBug544943() {
- runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " @SuppressWarnings(\"preview\")\n" +
- " public static int foo(int i) throws MyException {\n" +
- " int v = -1;\n" +
- " try {\n" +
- " v = switch (i) {\n" +
- " case 0 -> switch(i) {\n" +
- " case 0 -> 1;\n" +
- " default -> throw new MyException();\n" +
- " };\n" +
- " default -> 1;\n" +
- " };\n" +
- " } finally {\n" +
- " // do nothing\n" +
- " }\n" +
- " return v;\n" +
- " } \n" +
- " public static void main(String argv[]) {\n" +
- " try {\n" +
- " System.out.println(X.foo(0));\n" +
- " } catch (MyException e) {\n" +
- " e.printStackTrace();\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "class MyException extends Exception {\n" +
- " private static final long serialVersionUID = 3461899582505930473L; \n" +
- "}"
- },
- "1");
- }
- public void testBug544943_2() {
- runConformTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " @SuppressWarnings({ \"preview\" })\n" +
- " public static int foo(int i) throws Exception {\n" +
- " int v = switch (i) {\n" +
- " case 0 -> switch (i) {\n" +
- " case 0 -> 0;\n" +
- " default-> throw new Exception();\n" +
- " case 3 -> 3;\n" +
- " case 2 -> throw new Exception();\n" +
- " };\n" +
- " default -> 0;\n" +
- " };\n" +
- " return v;\n" +
- " }\n" +
- " public static void main(String argv[]) throws Exception {\n" +
- " System.out.println(X.foo(1));\n" +
- " }\n" +
- "}"
- },
- "0");
- }
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
index 5c8eae7a24..8751d1327f 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar
index a064a8721d..0d0a3615cb 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.5.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
index a2e54e15a6..8842bb29cd 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
index 42518444d0..1a9814ebf4 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
index 3cc6d95218..df361f565f 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
index 3cc6d95218..df361f565f 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
index 3cc6d95218..eed2c4df78 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.zip
new file mode 100644
index 0000000000..35e5589d58
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip
index 23ce774f5e..35e5589d58 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
deleted file mode 100644
index b63330135d..0000000000
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip
deleted file mode 100644
index 6f5bb89609..0000000000
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13src.zip
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
index 4a59a6138e..bb48557698 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java
index 21d4e4b092..867723c0b6 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java
@@ -48,7 +48,7 @@ import junit.framework.Test;
public class ASTConverter13Test extends ConverterTestSetup {
ICompilationUnit workingCopy;
- private static final String jclLib = "CONVERTER_JCL13_LIB";
+ private static final String jclLib = "CONVERTER_JCL9_LIB";
public void setUpSuite() throws Exception {
super.setUpSuite();
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
index 8bd1281b0c..b5f936605e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
@@ -184,18 +184,10 @@ public abstract class ConverterTestSetup extends AbstractASTTests {
if (JavaCore.getClasspathVariable("CONVERTER_JCL12_LIB") == null) {
setupExternalJCL("converterJclMin12");
JavaCore.setClasspathVariables(
- new String[] {"CONVERTER_JCL12_LIB", "CONVERTER_JCL12_SRC", "CONVERTER_JCL12_SRCROOT"},
+ new String[] {"CONVERTER_JCL11_LIB", "CONVERTER_JCL11_SRC", "CONVERTER_JCL11_SRCROOT"},
new IPath[] {getConverterJCLPath("12"), getConverterJCLSourcePath("12"), getConverterJCLRootSourcePath()},
null);
}
- } else if ("13".equals(compliance)) {
- if (JavaCore.getClasspathVariable("CONVERTER_JCL13_LIB") == null) {
- setupExternalJCL("converterJclMin13");
- JavaCore.setClasspathVariables(
- new String[] {"CONVERTER_JCL13_LIB", "CONVERTER_JCL13_SRC", "CONVERTER_JCL13_SRCROOT"},
- new IPath[] {getConverterJCLPath("13"), getConverterJCLSourcePath("13"), getConverterJCLRootSourcePath()},
- null);
- }
} else if (JavaCore.getClasspathVariable("CONVERTER_JCL_LIB") == null) {
setupExternalJCL("converterJclMin");
JavaCore.setClasspathVariables(
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter13/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Converter13/.classpath
index 1117818ec6..3522bc0c3f 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter13/.classpath
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter13/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="CONVERTER_JCL13_LIB" sourcepath="CONVERTER_JCL13_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
+ <classpathentry kind="var" path="CONVERTER_JCL18_LIB" sourcepath="CONVERTER_JCL18_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs
index 2ec8851f0c..6f7536aee1 100644
--- a/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs
+++ b/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs
@@ -1,104 +1,94 @@
-ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Ignore
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Ignore
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Ignore
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Ignore
-API_USE_SCAN_FIELD_SEVERITY=Ignore
-API_USE_SCAN_METHOD_SEVERITY=Ignore
-API_USE_SCAN_TYPE_SEVERITY=Ignore
-CLASS_ELEMENT_TYPE_ADDED_FIELD=Ignore
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Ignore
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Ignore
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Ignore
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Ignore
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Ignore
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Ignore
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Ignore
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Ignore
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Ignore
-ILLEGAL_EXTEND=Ignore
-ILLEGAL_IMPLEMENT=Ignore
-ILLEGAL_INSTANTIATE=Ignore
-ILLEGAL_OVERRIDE=Ignore
-ILLEGAL_REFERENCE=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Ignore
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Ignore
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Ignore
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-INVALID_ANNOTATION=Ignore
-INVALID_JAVADOC_TAG=Ignore
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
-LEAK_EXTEND=Ignore
-LEAK_FIELD_DECL=Ignore
-LEAK_IMPLEMENT=Ignore
-LEAK_METHOD_PARAM=Ignore
-LEAK_METHOD_RETURN_TYPE=Ignore
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Ignore
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Ignore
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Ignore
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Ignore
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Ignore
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Ignore
-UNUSED_PROBLEM_FILTERS=Ignore
-automatically_removed_unused_problem_filters=Ignore
-changed_execution_env=Ignore
+#Fri May 21 10:24:07 EDT 2010
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
eclipse.preferences.version=1
-incompatible_api_component_version=Ignore
+incompatible_api_component_version=Error
incompatible_api_component_version_include_major_without_breaking_change=Disabled
incompatible_api_component_version_include_minor_without_api_change=Disabled
-incompatible_api_component_version_report_major_without_breaking_change=Ignore
-incompatible_api_component_version_report_minor_without_api_change=Ignore
-invalid_since_tag_version=Ignore
-malformed_since_tag=Ignore
-missing_since_tag=Ignore
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Ignore
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
index ad8b1ef6b9..c5ef13bf83 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -86,25 +86,22 @@ import org.eclipse.jdt.internal.compiler.codegen.Opcodes;
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame;
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream;
import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker;
+import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker;
+import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker;
import org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream;
import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.impl.StringConstant;
-import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
-import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.jdt.internal.compiler.lookup.PolymorphicMethodBinding;
-import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
-import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
-import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding;
import org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding;
@@ -772,8 +769,7 @@ public class ClassFile implements TypeConstants, TypeIds {
attributeNumber++; // code attribute
completeCodeAttributeForClinit(
codeAttributeOffset,
- problemLine,
- null);
+ problemLine);
if (this.contentsOffset + 2 >= this.contents.length) {
resizeContents(2);
}
@@ -1381,9 +1377,7 @@ public class ClassFile implements TypeConstants, TypeIds {
.scope
.referenceCompilationUnit()
.compilationResult
- .getLineSeparatorPositions(),
- ((SourceTypeBinding) methodBinding.declaringClass)
- .scope);
+ .getLineSeparatorPositions());
// update the number of attributes
this.contents[methodAttributeOffset++] = (byte) (attributeNumber >> 8);
this.contents[methodAttributeOffset] = (byte) attributeNumber;
@@ -1401,7 +1395,7 @@ public class ClassFile implements TypeConstants, TypeIds {
*
* @param codeAttributeOffset <CODE>int</CODE>
*/
- public void completeCodeAttribute(int codeAttributeOffset, MethodScope scope) {
+ public void completeCodeAttribute(int codeAttributeOffset) {
// reinitialize the localContents with the byte modified by the code stream
this.contents = this.codeStream.bCodeStream;
int localContentsOffset = this.codeStream.classFileOffset;
@@ -1521,8 +1515,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- scope);
+ false);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
@@ -1531,8 +1524,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- scope);
+ false);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
@@ -1611,7 +1603,7 @@ public class ClassFile implements TypeConstants, TypeIds {
*
* @param codeAttributeOffset <CODE>int</CODE>
*/
- public void completeCodeAttributeForClinit(int codeAttributeOffset, Scope scope) {
+ public void completeCodeAttributeForClinit(int codeAttributeOffset) {
// reinitialize the contents with the byte modified by the code stream
this.contents = this.codeStream.bCodeStream;
int localContentsOffset = this.codeStream.classFileOffset;
@@ -1721,8 +1713,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- true,
- scope);
+ true);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
@@ -1731,8 +1722,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- true,
- scope);
+ true);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
@@ -1766,8 +1756,7 @@ public class ClassFile implements TypeConstants, TypeIds {
*/
public void completeCodeAttributeForClinit(
int codeAttributeOffset,
- int problemLine,
- MethodScope scope) {
+ int problemLine) {
// reinitialize the contents with the byte modified by the code stream
this.contents = this.codeStream.bCodeStream;
int localContentsOffset = this.codeStream.classFileOffset;
@@ -1838,8 +1827,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- true,
- scope);
+ true);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
@@ -1848,8 +1836,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- true,
- scope);
+ true);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
@@ -1923,8 +1910,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- null);
+ false);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
@@ -1933,8 +1919,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- null);
+ false);
}
// then we do the local variable attribute
@@ -2021,8 +2006,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- null);
+ false);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
@@ -2031,8 +2015,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- null);
+ false);
}
// update the number of attributes// ensure first that there is enough space available inside the localContents array
@@ -2066,8 +2049,7 @@ public class ClassFile implements TypeConstants, TypeIds {
boolean hasExceptionHandlers,
SyntheticMethodBinding binding,
int codeAttributeOffset,
- int[] startLineIndexes,
- Scope scope) {
+ int[] startLineIndexes) {
// reinitialize the contents with the byte modified by the code stream
this.contents = this.codeStream.bCodeStream;
int localContentsOffset = this.codeStream.classFileOffset;
@@ -2180,7 +2162,7 @@ public class ClassFile implements TypeConstants, TypeIds {
attributesNumber += generateLocalVariableTableAttribute(code_length, methodDeclarationIsStatic, true);
}
if (addStackMaps) {
- attributesNumber += generateStackMapTableAttribute(binding, code_length, codeAttributeOffset, max_locals, false, scope);
+ attributesNumber += generateStackMapTableAttribute(binding, code_length, codeAttributeOffset, max_locals, false);
}
if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) {
@@ -2189,8 +2171,7 @@ public class ClassFile implements TypeConstants, TypeIds {
code_length,
codeAttributeOffset,
max_locals,
- false,
- scope);
+ false);
}
// update the number of attributes
@@ -2231,8 +2212,7 @@ public class ClassFile implements TypeConstants, TypeIds {
false,
binding,
codeAttributeOffset,
- startLineIndexes,
- ((SourceTypeBinding) binding.declaringClass).scope);
+ startLineIndexes);
}
private void completeArgumentAnnotationInfo(Argument[] arguments, List allAnnotationContexts) {
@@ -4637,15 +4617,14 @@ public class ClassFile implements TypeConstants, TypeIds {
int code_length,
int codeAttributeOffset,
int max_locals,
- boolean isClinit,
- Scope scope) {
+ boolean isClinit) {
int attributesNumber = 0;
int localContentsOffset = this.contentsOffset;
StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream;
stackMapFrameCodeStream.removeFramePosition(code_length);
if (stackMapFrameCodeStream.hasFramePositions()) {
Map frames = new HashMap();
- List realFrames = traverse(isClinit ? null : methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit, scope);
+ List realFrames = traverse(isClinit ? null : methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit);
int numberOfFrames = realFrames.size();
if (numberOfFrames > 1) {
int stackMapTableAttributeOffset = localContentsOffset;
@@ -4720,17 +4699,17 @@ public class ClassFile implements TypeConstants, TypeIds {
break;
default:
this.contents[localContentsOffset++] = (byte) info.tag;
- switch (info.tag) {
- case VerificationTypeInfo.ITEM_UNINITIALIZED :
- int offset = info.offset;
- this.contents[localContentsOffset++] = (byte) (offset >> 8);
- this.contents[localContentsOffset++] = (byte) offset;
- break;
- case VerificationTypeInfo.ITEM_OBJECT :
- int indexForType = this.constantPool.literalIndexForType(info.constantPoolName());
- this.contents[localContentsOffset++] = (byte) (indexForType >> 8);
- this.contents[localContentsOffset++] = (byte) indexForType;
- }
+ switch (info.tag) {
+ case VerificationTypeInfo.ITEM_UNINITIALIZED :
+ int offset = info.offset;
+ this.contents[localContentsOffset++] = (byte) (offset >> 8);
+ this.contents[localContentsOffset++] = (byte) offset;
+ break;
+ case VerificationTypeInfo.ITEM_OBJECT :
+ int indexForType = this.constantPool.literalIndexForType(info.constantPoolName());
+ this.contents[localContentsOffset++] = (byte) (indexForType >> 8);
+ this.contents[localContentsOffset++] = (byte) indexForType;
+ }
}
numberOfLocalEntries++;
}
@@ -4815,15 +4794,14 @@ public class ClassFile implements TypeConstants, TypeIds {
int code_length,
int codeAttributeOffset,
int max_locals,
- boolean isClinit,
- Scope scope) {
+ boolean isClinit) {
int attributesNumber = 0;
int localContentsOffset = this.contentsOffset;
StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream;
stackMapFrameCodeStream.removeFramePosition(code_length);
if (stackMapFrameCodeStream.hasFramePositions()) {
Map frames = new HashMap();
- List realFrames = traverse(isClinit ? null: methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit, scope);
+ List realFrames = traverse(isClinit ? null: methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit);
int numberOfFrames = realFrames.size();
if (numberOfFrames > 1) {
int stackMapTableAttributeOffset = localContentsOffset;
@@ -5362,7 +5340,8 @@ public class ClassFile implements TypeConstants, TypeIds {
// skip type parameters
int paren = CharOperation.lastIndexOf(')', methodSignature);
// there could be thrown exceptions behind, thus scan one type exactly
- return CharOperation.subarray(methodSignature, paren + 1, methodSignature.length);
+ return CharOperation.subarray(methodSignature, paren + 1,
+ methodSignature.length);
}
private final int i4At(byte[] reference, int relativeOffset,
@@ -5527,7 +5506,9 @@ public class ClassFile implements TypeConstants, TypeIds {
localVariableBinding.recordInitializationStartPC(0);
localVariableBinding.recordInitializationEndPC(codeLength);
- frame.putLocal(resolvedPosition, new VerificationTypeInfo(this.referenceBinding.scope.getJavaLangString()));
+ frame.putLocal(resolvedPosition, new VerificationTypeInfo(
+ TypeIds.T_JavaLangString,
+ ConstantPool.JavaLangStringConstantPoolName));
resolvedPosition++;
localVariableBinding = new LocalVariableBinding(" ordinal".toCharArray(), TypeBinding.INT, 0, false); //$NON-NLS-1$
@@ -5535,7 +5516,8 @@ public class ClassFile implements TypeConstants, TypeIds {
this.codeStream.record(localVariableBinding);
localVariableBinding.recordInitializationStartPC(0);
localVariableBinding.recordInitializationEndPC(codeLength);
- frame.putLocal(resolvedPosition, new VerificationTypeInfo(TypeBinding.INT));
+ frame.putLocal(resolvedPosition, new VerificationTypeInfo(
+ TypeBinding.INT));
resolvedPosition++;
}
@@ -5857,161 +5839,8 @@ public class ClassFile implements TypeConstants, TypeIds {
});
return result;
}
-
- private TypeBinding getTypeBinding(char[] typeConstantPoolName, Scope scope, boolean checkcast) {
- if (typeConstantPoolName.length == 1) {
- // base type
- switch(typeConstantPoolName[0]) {
- case 'Z':
- return TypeBinding.BOOLEAN;
- case 'B':
- return TypeBinding.BYTE;
- case 'C':
- return TypeBinding.CHAR;
- case 'D':
- return TypeBinding.DOUBLE;
- case 'F':
- return TypeBinding.FLOAT;
- case 'I':
- return TypeBinding.INT;
- case 'J':
- return TypeBinding.LONG;
- case 'S':
- return TypeBinding.SHORT;
- default:
- return null;
- }
- } else if (typeConstantPoolName[0] == '[') {
- int dimensions = getDimensions(typeConstantPoolName);
- if (typeConstantPoolName.length - dimensions == 1) {
- // array of base types
- TypeBinding baseType = null;
- switch(typeConstantPoolName[typeConstantPoolName.length - 1]) {
- case 'Z':
- baseType = TypeBinding.BOOLEAN;
- break;
- case 'B':
- baseType = TypeBinding.BYTE;
- break;
- case 'C':
- baseType = TypeBinding.CHAR;
- break;
- case 'D':
- baseType = TypeBinding.DOUBLE;
- break;
- case 'F':
- baseType = TypeBinding.FLOAT;
- break;
- case 'I':
- baseType = TypeBinding.INT;
- break;
- case 'J':
- baseType = TypeBinding.LONG;
- break;
- case 'S':
- baseType = TypeBinding.SHORT;
- break;
- case 'V':
- baseType = TypeBinding.VOID;
- }
- return scope.createArrayType(baseType, dimensions);
- } else {
- // array of object types
- TypeBinding type = (TypeBinding) scope.getTypeOrPackage(
- CharOperation.splitOn('/', CharOperation.subarray(typeConstantPoolName, dimensions + 1, typeConstantPoolName.length - 1)));
- if (!type.isValidBinding()) {
- ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) type;
- if ((problemReferenceBinding.problemId() & ProblemReasons.InternalNameProvided) != 0) {
- type = problemReferenceBinding.closestMatch();
- }
- }
- return scope.createArrayType(type, dimensions);
- }
- } else {
- TypeBinding type = checkcast ?
- (TypeBinding) scope.getTypeOrPackage(
- CharOperation.splitOn('/', CharOperation.subarray(typeConstantPoolName, 0, typeConstantPoolName.length)))
- : (TypeBinding) scope.getTypeOrPackage(
- CharOperation.splitOn('/', CharOperation.subarray(typeConstantPoolName, 1, typeConstantPoolName.length - 1)));
- if (!type.isValidBinding()) {
- ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) type;
- if ((problemReferenceBinding.problemId() & ProblemReasons.InternalNameProvided) != 0) {
- type = problemReferenceBinding.closestMatch();
- }
- }
- return type;
- }
- }
- private TypeBinding getANewArrayTypeBinding(char[] typeConstantPoolName, Scope scope) {
- if (typeConstantPoolName[0] == '[') {
- int dimensions = getDimensions(typeConstantPoolName);
- if (typeConstantPoolName.length - dimensions == 1) {
- // array of base types
- TypeBinding baseType = null;
- switch(typeConstantPoolName[typeConstantPoolName.length - 1]) {
- case 'Z':
- baseType = TypeBinding.BOOLEAN;
- break;
- case 'B':
- baseType = TypeBinding.BYTE;
- break;
- case 'C':
- baseType = TypeBinding.CHAR;
- break;
- case 'D':
- baseType = TypeBinding.DOUBLE;
- break;
- case 'F':
- baseType = TypeBinding.FLOAT;
- break;
- case 'I':
- baseType = TypeBinding.INT;
- break;
- case 'J':
- baseType = TypeBinding.LONG;
- break;
- case 'S':
- baseType = TypeBinding.SHORT;
- break;
- case 'V':
- baseType = TypeBinding.VOID;
- }
- return scope.createArrayType(baseType, dimensions);
- } else {
- // array of object types
- TypeBinding type = (TypeBinding) scope.getTypeOrPackage(
- CharOperation.splitOn('/', CharOperation.subarray(typeConstantPoolName, dimensions + 1, typeConstantPoolName.length - 1)));
- if (!type.isValidBinding()) {
- ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) type;
- if ((problemReferenceBinding.problemId() & ProblemReasons.InternalNameProvided) != 0) {
- type = problemReferenceBinding.closestMatch();
- }
- }
- return scope.createArrayType(type, dimensions);
- }
- } else {
- TypeBinding type = (TypeBinding) scope.getTypeOrPackage(
- CharOperation.splitOn('/', CharOperation.subarray(typeConstantPoolName, 0, typeConstantPoolName.length)));
- if (!type.isValidBinding()) {
- ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) type;
- if ((problemReferenceBinding.problemId() & ProblemReasons.InternalNameProvided) != 0) {
- type = problemReferenceBinding.closestMatch();
- }
- }
- return type;
- }
- }
-
- public List traverse(
- MethodBinding methodBinding,
- int maxLocals,
- byte[] bytecodes,
- int codeOffset,
- int codeLength,
- Map<Integer, StackMapFrame> frames,
- boolean isClinit,
- Scope scope) {
+ public List traverse(MethodBinding methodBinding, int maxLocals, byte[] bytecodes, int codeOffset, int codeLength, Map frames, boolean isClinit) {
Set realJumpTarget = new HashSet();
StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream;
@@ -6026,6 +5855,26 @@ public class ClassFile implements TypeConstants, TypeIds {
int framePositionsLength = framePositions.length;
int currentFramePosition = framePositions[0];
+ // set initial values for stack depth markers
+ int indexInStackDepthMarkers = 0;
+ StackDepthMarker[] stackDepthMarkers = stackMapFrameCodeStream.getStackDepthMarkers();
+ int stackDepthMarkersLength = stackDepthMarkers == null ? 0 : stackDepthMarkers.length;
+ boolean hasStackDepthMarkers = stackDepthMarkersLength != 0;
+ StackDepthMarker stackDepthMarker = null;
+ if (hasStackDepthMarkers) {
+ stackDepthMarker = stackDepthMarkers[0];
+ }
+
+ // set initial values for stack markers (used only in cldc mode)
+ int indexInStackMarkers = 0;
+ StackMarker[] stackMarkers = stackMapFrameCodeStream.getStackMarkers();
+ int stackMarkersLength = stackMarkers == null ? 0 : stackMarkers.length;
+ boolean hasStackMarkers = stackMarkersLength != 0;
+ StackMarker stackMarker = null;
+ if (hasStackMarkers) {
+ stackMarker = stackMarkers[0];
+ }
+
// set initial values for exception markers
int indexInExceptionMarkers = 0;
ExceptionMarker[] exceptionMarkers= stackMapFrameCodeStream.getExceptionMarkers();
@@ -6051,9 +5900,43 @@ public class ClassFile implements TypeConstants, TypeIds {
}
while (true) {
int currentPC = pc - codeOffset;
+ if (hasStackMarkers && stackMarker.pc == currentPC) {
+ VerificationTypeInfo[] infos = frame.stackItems;
+ VerificationTypeInfo[] tempInfos = new VerificationTypeInfo[frame.numberOfStackItems];
+ System.arraycopy(infos, 0, tempInfos, 0, frame.numberOfStackItems);
+ stackMarker.setInfos(tempInfos);
+ } else if (hasStackMarkers && stackMarker.destinationPC == currentPC) {
+ VerificationTypeInfo[] infos = stackMarker.infos;
+ frame.stackItems = infos;
+ frame.numberOfStackItems = infos.length;
+ indexInStackMarkers++;
+ if (indexInStackMarkers < stackMarkersLength) {
+ stackMarker = stackMarkers[indexInStackMarkers];
+ } else {
+ hasStackMarkers = false;
+ }
+ }
+ if (hasStackDepthMarkers && stackDepthMarker.pc == currentPC) {
+ TypeBinding typeBinding = stackDepthMarker.typeBinding;
+ if (typeBinding != null) {
+ if (stackDepthMarker.delta > 0) {
+ frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ } else {
+ frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(typeBinding);
+ }
+ } else {
+ frame.numberOfStackItems--;
+ }
+ indexInStackDepthMarkers++;
+ if (indexInStackDepthMarkers < stackDepthMarkersLength) {
+ stackDepthMarker = stackDepthMarkers[indexInStackDepthMarkers];
+ } else {
+ hasStackDepthMarkers = false;
+ }
+ }
if (hasExceptionMarkers && exceptionMarker.pc == currentPC) {
frame.numberOfStackItems = 0;
- frame.addStackItem(new VerificationTypeInfo(exceptionMarker.getBinding()));
+ frame.addStackItem(new VerificationTypeInfo(0, VerificationTypeInfo.ITEM_OBJECT, exceptionMarker.constantPoolName));
indexInExceptionMarkers++;
if (indexInExceptionMarkers < exceptionsMarkersLength) {
exceptionMarker = exceptionMarkers[indexInExceptionMarkers];
@@ -6073,13 +5956,12 @@ public class ClassFile implements TypeConstants, TypeIds {
}
if (currentFramePosition == currentPC) {
// need to build a new frame and create a stack map attribute entry
- StackMapFrame currentFrame = frames.get(Integer.valueOf(currentPC));
- if (currentFrame == null) {
- currentFrame = createNewFrame(currentPC, frame, isClinit, methodBinding);
- add(frames, currentFrame);
- } else {
- frame = currentFrame.merge(frame.duplicate(), scope).duplicate();
- }
+ StackMapFrame currentFrame = frame.duplicate();
+ currentFrame.pc = currentPC;
+ // initialize locals
+ initializeLocals(isClinit ? true : methodBinding.isStatic(), currentPC, currentFrame);
+ // insert a new frame
+ add(frames, currentFrame);
indexInFramePositions++;
if (indexInFramePositions < framePositionsLength) {
currentFramePosition = framePositions[indexInFramePositions];
@@ -6093,7 +5975,7 @@ public class ClassFile implements TypeConstants, TypeIds {
pc++;
break;
case Opcodes.OPC_aconst_null:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.NULL));
+ frame.addStackItem(TypeBinding.NULL);
pc++;
break;
case Opcodes.OPC_iconst_m1:
@@ -6103,31 +5985,31 @@ public class ClassFile implements TypeConstants, TypeIds {
case Opcodes.OPC_iconst_3:
case Opcodes.OPC_iconst_4:
case Opcodes.OPC_iconst_5:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
pc++;
break;
case Opcodes.OPC_lconst_0:
case Opcodes.OPC_lconst_1:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.LONG));
+ frame.addStackItem(TypeBinding.LONG);
pc++;
break;
case Opcodes.OPC_fconst_0:
case Opcodes.OPC_fconst_1:
case Opcodes.OPC_fconst_2:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
pc++;
break;
case Opcodes.OPC_dconst_0:
case Opcodes.OPC_dconst_1:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.DOUBLE));
+ frame.addStackItem(TypeBinding.DOUBLE);
pc++;
break;
case Opcodes.OPC_bipush:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.BYTE));
+ frame.addStackItem(TypeBinding.BYTE);
pc += 2;
break;
case Opcodes.OPC_sipush:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.SHORT));
+ frame.addStackItem(TypeBinding.SHORT);
pc += 3;
break;
case Opcodes.OPC_ldc:
@@ -6135,16 +6017,20 @@ public class ClassFile implements TypeConstants, TypeIds {
switch (u1At(poolContents, 0, constantPoolOffsets[index])) {
case ClassFileConstants.StringTag:
frame
- .addStackItem(new VerificationTypeInfo(scope.getJavaLangString()));
+ .addStackItem(new VerificationTypeInfo(
+ TypeIds.T_JavaLangString,
+ ConstantPool.JavaLangStringConstantPoolName));
break;
case ClassFileConstants.IntegerTag:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
break;
case ClassFileConstants.FloatTag:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
break;
case ClassFileConstants.ClassTag:
- frame.addStackItem(new VerificationTypeInfo(scope.getJavaLangClass()));
+ frame.addStackItem(new VerificationTypeInfo(
+ TypeIds.T_JavaLangClass,
+ ConstantPool.JavaLangClassConstantPoolName));
}
pc += 2;
break;
@@ -6153,16 +6039,20 @@ public class ClassFile implements TypeConstants, TypeIds {
switch (u1At(poolContents, 0, constantPoolOffsets[index])) {
case ClassFileConstants.StringTag:
frame
- .addStackItem(new VerificationTypeInfo(scope.getJavaLangString()));
+ .addStackItem(new VerificationTypeInfo(
+ TypeIds.T_JavaLangString,
+ ConstantPool.JavaLangStringConstantPoolName));
break;
case ClassFileConstants.IntegerTag:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
break;
case ClassFileConstants.FloatTag:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
break;
case ClassFileConstants.ClassTag:
- frame.addStackItem(new VerificationTypeInfo(scope.getJavaLangClass()));
+ frame.addStackItem(new VerificationTypeInfo(
+ TypeIds.T_JavaLangClass,
+ ConstantPool.JavaLangClassConstantPoolName));
}
pc += 3;
break;
@@ -6170,28 +6060,28 @@ public class ClassFile implements TypeConstants, TypeIds {
index = u2At(bytecodes, 1, pc);
switch (u1At(poolContents, 0, constantPoolOffsets[index])) {
case ClassFileConstants.DoubleTag:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.DOUBLE));
+ frame.addStackItem(TypeBinding.DOUBLE);
break;
case ClassFileConstants.LongTag:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.LONG));
+ frame.addStackItem(TypeBinding.LONG);
break;
}
pc += 3;
break;
case Opcodes.OPC_iload:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
pc += 2;
break;
case Opcodes.OPC_lload:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.LONG));
+ frame.addStackItem(TypeBinding.LONG);
pc += 2;
break;
case Opcodes.OPC_fload:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
pc += 2;
break;
case Opcodes.OPC_dload:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.DOUBLE));
+ frame.addStackItem(TypeBinding.DOUBLE);
pc += 2;
break;
case Opcodes.OPC_aload:
@@ -6204,28 +6094,28 @@ public class ClassFile implements TypeConstants, TypeIds {
case Opcodes.OPC_iload_1:
case Opcodes.OPC_iload_2:
case Opcodes.OPC_iload_3:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
pc++;
break;
case Opcodes.OPC_lload_0:
case Opcodes.OPC_lload_1:
case Opcodes.OPC_lload_2:
case Opcodes.OPC_lload_3:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.LONG));
+ frame.addStackItem(TypeBinding.LONG);
pc++;
break;
case Opcodes.OPC_fload_0:
case Opcodes.OPC_fload_1:
case Opcodes.OPC_fload_2:
case Opcodes.OPC_fload_3:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
pc++;
break;
case Opcodes.OPC_dload_0:
case Opcodes.OPC_dload_1:
case Opcodes.OPC_dload_2:
case Opcodes.OPC_dload_3:
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.DOUBLE));
+ frame.addStackItem(TypeBinding.DOUBLE);
pc++;
break;
case Opcodes.OPC_aload_0:
@@ -6254,22 +6144,22 @@ public class ClassFile implements TypeConstants, TypeIds {
break;
case Opcodes.OPC_iaload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
pc++;
break;
case Opcodes.OPC_laload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.LONG));
+ frame.addStackItem(TypeBinding.LONG);
pc++;
break;
case Opcodes.OPC_faload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
pc++;
break;
case Opcodes.OPC_daload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.DOUBLE));
+ frame.addStackItem(TypeBinding.DOUBLE);
pc++;
break;
case Opcodes.OPC_aaload:
@@ -6279,17 +6169,17 @@ public class ClassFile implements TypeConstants, TypeIds {
break;
case Opcodes.OPC_baload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.BYTE));
+ frame.addStackItem(TypeBinding.BYTE);
pc++;
break;
case Opcodes.OPC_caload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.CHAR));
+ frame.addStackItem(TypeBinding.CHAR);
pc++;
break;
case Opcodes.OPC_saload:
frame.numberOfStackItems -=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.SHORT));
+ frame.addStackItem(TypeBinding.SHORT);
pc++;
break;
case Opcodes.OPC_istore:
@@ -6612,7 +6502,7 @@ public class ClassFile implements TypeConstants, TypeIds {
case Opcodes.OPC_dcmpl:
case Opcodes.OPC_dcmpg:
frame.numberOfStackItems-=2;
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
pc++;
break;
case Opcodes.OPC_ifeq:
@@ -6622,8 +6512,7 @@ public class ClassFile implements TypeConstants, TypeIds {
case Opcodes.OPC_ifgt:
case Opcodes.OPC_ifle:
frame.numberOfStackItems--;
- int jumpPC = currentPC + i2At(bytecodes, 1, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i2At(bytecodes, 1, pc));
pc += 3;
break;
case Opcodes.OPC_if_icmpeq:
@@ -6635,25 +6524,21 @@ public class ClassFile implements TypeConstants, TypeIds {
case Opcodes.OPC_if_acmpeq:
case Opcodes.OPC_if_acmpne:
frame.numberOfStackItems -= 2;
- jumpPC = currentPC + i2At(bytecodes, 1, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i2At(bytecodes, 1, pc));
pc += 3;
break;
case Opcodes.OPC_goto:
- jumpPC = currentPC + i2At(bytecodes, 1, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i2At(bytecodes, 1, pc));
pc += 3;
addRealJumpTarget(realJumpTarget, pc - codeOffset);
break;
case Opcodes.OPC_tableswitch:
- frame.numberOfStackItems--;
pc++;
while (((pc - codeOffset) & 0x03) != 0) {
pc++;
}
// default offset
- jumpPC = currentPC + i4At(bytecodes, 0, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i4At(bytecodes, 0, pc));
pc += 4; // default
int low = i4At(bytecodes, 0, pc);
pc += 4;
@@ -6662,29 +6547,27 @@ public class ClassFile implements TypeConstants, TypeIds {
int length = high - low + 1;
for (int i = 0; i < length; i++) {
// pair offset
- jumpPC = currentPC + i4At(bytecodes, 0, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i4At(bytecodes, 0, pc));
pc += 4;
}
+ frame.numberOfStackItems--;
break;
case Opcodes.OPC_lookupswitch:
- frame.numberOfStackItems--;
pc++;
while (((pc - codeOffset) & 0x03) != 0) {
pc++;
}
- jumpPC = currentPC + i4At(bytecodes, 0, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i4At(bytecodes, 0, pc));
pc += 4; // default offset
int npairs = (int) u4At(bytecodes, 0, pc);
pc += 4; // npair value
for (int i = 0; i < npairs; i++) {
pc += 4; // case value
// pair offset
- jumpPC = currentPC + i4At(bytecodes, 0, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i4At(bytecodes, 0, pc));
pc += 4;
}
+ frame.numberOfStackItems--;
break;
case Opcodes.OPC_ireturn:
case Opcodes.OPC_lreturn:
@@ -6709,9 +6592,38 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index] + 3, u2At(
poolContents, 1,
constantPoolOffsets[utf8index]));
- TypeBinding typeBinding = getTypeBinding(descriptor, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (descriptor.length == 1) {
+ // base type
+ switch(descriptor[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else if (descriptor[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, descriptor));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(descriptor, 1, descriptor.length - 1)));
}
pc += 3;
break;
@@ -6730,9 +6642,38 @@ public class ClassFile implements TypeConstants, TypeIds {
poolContents, 1,
constantPoolOffsets[utf8index]));
frame.numberOfStackItems--;
- typeBinding = getTypeBinding(descriptor, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (descriptor.length == 1) {
+ // base type
+ switch(descriptor[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else if (descriptor[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, descriptor));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(descriptor, 1, descriptor.length - 1)));
}
pc += 3;
break;
@@ -6758,9 +6699,40 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index]));
frame.numberOfStackItems -= (getParametersCount(descriptor) + 1);
char[] returnType = getReturnType(descriptor);
- typeBinding = getTypeBinding(returnType, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (returnType.length == 1) {
+ // base type
+ switch(returnType[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else {
+ if (returnType[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, returnType));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(returnType, 1, returnType.length - 1)));
+ }
}
pc += 3;
break;
@@ -6776,9 +6748,40 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index]));
frame.numberOfStackItems -= getParametersCount(descriptor);
returnType = getReturnType(descriptor);
- typeBinding = getTypeBinding(returnType, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (returnType.length == 1) {
+ // base type
+ switch(returnType[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else {
+ if (returnType[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, returnType));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(returnType, 1, returnType.length - 1)));
+ }
}
pc += 5;
break;
@@ -6805,9 +6808,40 @@ public class ClassFile implements TypeConstants, TypeIds {
}
frame.numberOfStackItems--;
returnType = getReturnType(descriptor);
- typeBinding = getTypeBinding(returnType, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (returnType.length == 1) {
+ // base type
+ switch(returnType[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else {
+ if (returnType[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, returnType));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(returnType, 1, returnType.length - 1)));
+ }
}
pc += 3;
break;
@@ -6829,9 +6863,40 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index]));
frame.numberOfStackItems -= getParametersCount(descriptor);
returnType = getReturnType(descriptor);
- typeBinding = getTypeBinding(returnType, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (returnType.length == 1) {
+ // base type
+ switch(returnType[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else {
+ if (returnType[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, returnType));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(returnType, 1, returnType.length - 1)));
+ }
}
pc += 3;
break;
@@ -6856,9 +6921,40 @@ public class ClassFile implements TypeConstants, TypeIds {
// u1At(bytecodes, 4, pc); // extra args
frame.numberOfStackItems -= (getParametersCount(descriptor) + 1);
returnType = getReturnType(descriptor);
- typeBinding = getTypeBinding(returnType, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
+ if (returnType.length == 1) {
+ // base type
+ switch(returnType[0]) {
+ case 'Z':
+ frame.addStackItem(TypeBinding.BOOLEAN);
+ break;
+ case 'B':
+ frame.addStackItem(TypeBinding.BYTE);
+ break;
+ case 'C':
+ frame.addStackItem(TypeBinding.CHAR);
+ break;
+ case 'D':
+ frame.addStackItem(TypeBinding.DOUBLE);
+ break;
+ case 'F':
+ frame.addStackItem(TypeBinding.FLOAT);
+ break;
+ case 'I':
+ frame.addStackItem(TypeBinding.INT);
+ break;
+ case 'J':
+ frame.addStackItem(TypeBinding.LONG);
+ break;
+ case 'S':
+ frame.addStackItem(TypeBinding.SHORT);
+ break;
+ }
+ } else {
+ if (returnType[0] == '[') {
+ frame.addStackItem(new VerificationTypeInfo(0, returnType));
+ } else {
+ frame.addStackItem(new VerificationTypeInfo(0, CharOperation.subarray(returnType, 1, returnType.length - 1)));
+ }
}
pc += 5;
break;
@@ -6870,47 +6966,40 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index] + 3, u2At(
poolContents, 1,
constantPoolOffsets[utf8index]));
- typeBinding = (TypeBinding) scope.getTypeOrPackage(CharOperation.splitOn('/', className));
- if (!typeBinding.isValidBinding()) {
- ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) typeBinding;
- if ((problemReferenceBinding.problemId() & ProblemReasons.InternalNameProvided) != 0) {
- typeBinding = problemReferenceBinding.closestMatch();
- }
- }
- VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(VerificationTypeInfo.ITEM_UNINITIALIZED, typeBinding);
+ VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(0, VerificationTypeInfo.ITEM_UNINITIALIZED, className);
verificationTypeInfo.offset = currentPC;
frame.addStackItem(verificationTypeInfo);
pc += 3;
break;
case Opcodes.OPC_newarray:
- TypeBinding arrayType = null;
+ char[] constantPoolName = null;
switch (u1At(bytecodes, 1, pc)) {
case ClassFileConstants.INT_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.INT, 1);
+ constantPoolName = new char[] { '[', 'I' };
break;
case ClassFileConstants.BYTE_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.BYTE, 1);
+ constantPoolName = new char[] { '[', 'B' };
break;
case ClassFileConstants.BOOLEAN_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.BOOLEAN, 1);
+ constantPoolName = new char[] { '[', 'Z' };
break;
case ClassFileConstants.SHORT_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.SHORT, 1);
+ constantPoolName = new char[] { '[', 'S' };
break;
case ClassFileConstants.CHAR_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.CHAR, 1);
+ constantPoolName = new char[] { '[', 'C' };
break;
case ClassFileConstants.LONG_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.LONG, 1);
+ constantPoolName = new char[] { '[', 'J' };
break;
case ClassFileConstants.FLOAT_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.FLOAT, 1);
+ constantPoolName = new char[] { '[', 'F' };
break;
case ClassFileConstants.DOUBLE_ARRAY :
- arrayType = scope.createArrayType(TypeBinding.DOUBLE, 1);
+ constantPoolName = new char[] { '[', 'D' };
break;
}
- frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(arrayType);
+ frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(TypeIds.T_JavaLangObject, constantPoolName);
pc += 2;
break;
case Opcodes.OPC_anewarray:
@@ -6921,16 +7010,19 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index] + 3, u2At(
poolContents, 1,
constantPoolOffsets[utf8index]));
- frame.numberOfStackItems--;
- typeBinding = getANewArrayTypeBinding(className, scope);
- if (typeBinding != null) {
- if (typeBinding.isArrayType()) {
- ArrayBinding arrayBinding = (ArrayBinding) typeBinding;
- frame.addStackItem(new VerificationTypeInfo(scope.createArrayType(arrayBinding.elementsType(), arrayBinding.dimensions + 1)));
- } else {
- frame.addStackItem(new VerificationTypeInfo(scope.createArrayType(typeBinding, 1)));
- }
+ int classNameLength = className.length;
+ if (className[0] != '[') {
+ // this is a type name (class or interface). So we add appropriate '[', 'L' and ';'.
+ System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 3]), 2, classNameLength);
+ constantPoolName[0] = '[';
+ constantPoolName[1] = 'L';
+ constantPoolName[classNameLength + 2] = ';';
+ } else {
+ // if class name is already an array, we just need to add one dimension
+ System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 1]), 1, classNameLength);
+ constantPoolName[0] = '[';
}
+ frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(0, constantPoolName);
pc += 3;
break;
case Opcodes.OPC_arraylength:
@@ -6950,10 +7042,7 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index] + 3, u2At(
poolContents, 1,
constantPoolOffsets[utf8index]));
- typeBinding = getTypeBinding(className, scope, true);
- if (typeBinding != null) {
- frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(typeBinding);
- }
+ frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(0, className);
pc += 3;
break;
case Opcodes.OPC_instanceof:
@@ -6978,10 +7067,10 @@ public class ClassFile implements TypeConstants, TypeIds {
// need to handle iload, fload, aload, lload, dload, istore, fstore, astore, lstore or dstore
switch(opcode) {
case Opcodes.OPC_iload :
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.INT));
+ frame.addStackItem(TypeBinding.INT);
break;
case Opcodes.OPC_fload :
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.FLOAT));
+ frame.addStackItem(TypeBinding.FLOAT);
break;
case Opcodes.OPC_aload :
localsN = frame.locals[index];
@@ -6991,10 +7080,10 @@ public class ClassFile implements TypeConstants, TypeIds {
frame.addStackItem(localsN);
break;
case Opcodes.OPC_lload :
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.LONG));
+ frame.addStackItem(TypeBinding.LONG);
break;
case Opcodes.OPC_dload :
- frame.addStackItem(new VerificationTypeInfo(TypeBinding.DOUBLE));
+ frame.addStackItem(TypeBinding.DOUBLE);
break;
case Opcodes.OPC_istore :
frame.numberOfStackItems--;
@@ -7026,23 +7115,21 @@ public class ClassFile implements TypeConstants, TypeIds {
constantPoolOffsets[utf8index]));
int dimensions = u1At(bytecodes, 3, pc); // dimensions
frame.numberOfStackItems -= dimensions;
+ classNameLength = className.length;
// class name is already the name of the right array type with all dimensions
- typeBinding = getTypeBinding(className, scope, false);
- if (typeBinding != null) {
- frame.addStackItem(new VerificationTypeInfo(typeBinding));
- }
+ constantPoolName = new char[classNameLength];
+ System.arraycopy(className, 0, constantPoolName, 0, classNameLength);
+ frame.addStackItem(new VerificationTypeInfo(0, constantPoolName));
pc += 4;
break;
case Opcodes.OPC_ifnull:
case Opcodes.OPC_ifnonnull:
frame.numberOfStackItems--;
- jumpPC = currentPC + i2At(bytecodes, 1, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i2At(bytecodes, 1, pc));
pc += 3;
break;
case Opcodes.OPC_goto_w:
- jumpPC = currentPC + i4At(bytecodes, 1, pc);
- addRealJumpTarget(realJumpTarget, jumpPC, frames, createNewFrame(jumpPC, frame, isClinit, methodBinding));
+ addRealJumpTarget(realJumpTarget, currentPC + i4At(bytecodes, 1, pc));
pc += 5;
addRealJumpTarget(realJumpTarget, pc - codeOffset); // handle infinite loop
break;
@@ -7077,38 +7164,12 @@ public class ClassFile implements TypeConstants, TypeIds {
return filterFakeFrames(realJumpTarget, frames, codeLength);
}
- private StackMapFrame createNewFrame(int currentPC, StackMapFrame frame, boolean isClinit, MethodBinding methodBinding) {
- StackMapFrame newFrame = frame.duplicate();
- newFrame.pc = currentPC;
- // initialize locals
- initializeLocals(isClinit ? true : methodBinding.isStatic(), currentPC, newFrame);
- return newFrame;
- }
-
- private int getDimensions(char[] returnType) {
- int dimensions = 0;
- while (returnType[dimensions] == '[') {
- dimensions++;
- }
- return dimensions;
- }
-
private void addRealJumpTarget(Set realJumpTarget, int pc) {
realJumpTarget.add(Integer.valueOf(pc));
}
-
- private void addRealJumpTarget(Set realJumpTarget, int pc, Map frames, StackMapFrame frame) {
- realJumpTarget.add(Integer.valueOf(pc));
- add(frames, frame);
- }
-
private void add(Map frames, StackMapFrame frame) {
- Integer key = Integer.valueOf(frame.pc);
- if(!frames.containsKey(key)) {
- frames.put(Integer.valueOf(frame.pc), frame);
- }
+ frames.put(Integer.valueOf(frame.pc), frame);
}
-
private final int u1At(byte[] reference, int relativeOffset,
int structOffset) {
return (reference[relativeOffset + structOffset] & 0xFF);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index cc8cc807c8..1693b6ee2b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -354,7 +354,7 @@ public abstract class AbstractMethodDeclaration
codeStream.exitUserScope(this.scope);
codeStream.recordPositionsFrom(0, this.declarationSourceEnd);
try {
- classFile.completeCodeAttribute(codeAttributeOffset,this.scope);
+ classFile.completeCodeAttribute(codeAttributeOffset);
} catch(NegativeArraySizeException e) {
throw new AbortMethod(this.scope.referenceCompilationUnit().compilationResult, null);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
index ac2b281977..0119317431 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
@@ -66,7 +66,7 @@ public class ClassLiteralAccess extends Expression {
// in interface case, no caching occurs, since cannot make a cache field for interface
if (valueRequired) {
- codeStream.generateClassLiteralAccessForType(currentScope, this.type.resolvedType, this.syntheticField);
+ codeStream.generateClassLiteralAccessForType(this.type.resolvedType, this.syntheticField);
codeStream.generateImplicitConversion(this.implicitConversion);
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
index 7320fd11f0..f2b5b6e2e5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
@@ -201,7 +201,6 @@ public class Clinit extends AbstractMethodDeclaration {
if (this.assertionSyntheticFieldBinding != null) {
// generate code related to the activation of assertion for this class
codeStream.generateClassLiteralAccessForType(
- classScope,
classScope.outerMostClassScope().enclosingSourceType(),
this.classLiteralSyntheticField);
codeStream.invokeJavaLangClassDesiredAssertionStatus();
@@ -355,7 +354,7 @@ public class Clinit extends AbstractMethodDeclaration {
}
// Record the end of the clinit: point to the declaration of the class
codeStream.recordPositionsFrom(0, declaringType.sourceStart);
- classFile.completeCodeAttributeForClinit(codeAttributeOffset, classScope);
+ classFile.completeCodeAttributeForClinit(codeAttributeOffset);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
index 1210f0a237..a312f3e391 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -251,12 +251,8 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext,
return;
}
Constant cst = this.condition.optimizedBooleanConstant();
- if (cst == Constant.NotAConstant) {
- cst = this.condition.optimizedNullComparisonConstant();
- }
boolean needTruePart = !(cst != Constant.NotAConstant && cst.booleanValue() == false);
- boolean needFalsePart = !(cst != Constant.NotAConstant && cst.booleanValue() == true);
-
+ boolean needFalsePart = !(cst != Constant.NotAConstant && cst.booleanValue() == true);
endifLabel = new BranchLabel(codeStream);
// Generate code for the condition
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index 41ba8725da..a8c72d067b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -456,7 +456,7 @@ private void internalGenerateCode(ClassScope classScope, ClassFile classFile) {
codeStream.exitUserScope(this.scope);
codeStream.recordPositionsFrom(0, this.bodyEnd > 0 ? this.bodyEnd : this.sourceStart);
try {
- classFile.completeCodeAttribute(codeAttributeOffset, this.scope);
+ classFile.completeCodeAttribute(codeAttributeOffset);
} catch(NegativeArraySizeException e) {
throw new AbortMethod(this.scope.referenceCompilationUnit().compilationResult, null);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
index 0bdcfe669d..bdf1ed81fe 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
@@ -840,22 +840,6 @@ public class EqualExpression extends BinaryExpression {
public boolean isCompactableOperation() {
return false;
}
-
- @Override
- protected Constant optimizedNullComparisonConstant() {
- int operator = (this.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT;
- if (operator == OperatorIds.EQUAL_EQUAL) {
- if (this.left instanceof NullLiteral && this.right instanceof NullLiteral) {
- return BooleanConstant.fromValue(true);
- }
- } else if (operator == OperatorIds.NOT_EQUAL) {
- if (this.left instanceof NullLiteral && this.right instanceof NullLiteral) {
- return BooleanConstant.fromValue(false);
- }
- }
- return Constant.NotAConstant;
- }
-
@Override
public TypeBinding resolveType(BlockScope scope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index d7bf39d587..ba481e2e99 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -1317,8 +1317,4 @@ public Expression [] getPolyExpressions() {
public boolean isPotentiallyCompatibleWith(TypeBinding targetType, Scope scope) {
return isCompatibleWith(targetType, scope); // for all but functional expressions, potential compatibility is the same as compatibility.
}
-
-protected Constant optimizedNullComparisonConstant() {
- return Constant.NotAConstant;
-}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
index ae0633d514..d680669dcc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
@@ -1300,7 +1300,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
codeStream.exitUserScope(this.scope);
codeStream.recordPositionsFrom(0, this.sourceEnd); // WAS declarationSourceEnd.
try {
- classFile.completeCodeAttribute(codeAttributeOffset, this.scope);
+ classFile.completeCodeAttribute(codeAttributeOffset);
} catch(NegativeArraySizeException e) {
throw new AbortMethod(this.scope.referenceCompilationUnit().compilationResult, null);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index 4cddf3aeb5..56b3ca3987 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -201,7 +201,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
if (needValueStore()) {
alreadyGeneratedExpression = true;
this.expression.generateCode(currentScope, codeStream, needValue()); // no value needed if non-returning subroutine
- generateStoreSaveValueIfNecessary(currentScope, codeStream);
+ generateStoreSaveValueIfNecessary(codeStream);
}
// generation of code responsible for invoking the finally blocks in sequence
@@ -223,7 +223,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
if (this.expression != null && !alreadyGeneratedExpression) {
this.expression.generateCode(currentScope, codeStream, true);
// hook necessary for Code Snippet
- generateStoreSaveValueIfNecessary(currentScope, codeStream);
+ generateStoreSaveValueIfNecessary(codeStream);
}
// output the suitable return bytecode or wrap the value inside a descriptor for doits
generateReturnBytecode(codeStream);
@@ -246,7 +246,7 @@ public void generateReturnBytecode(CodeStream codeStream) {
codeStream.generateReturnBytecode(this.expression);
}
-public void generateStoreSaveValueIfNecessary(Scope scope, CodeStream codeStream){
+public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
if (this.saveValueVariable != null) {
codeStream.store(this.saveValueVariable, false);
// the variable is visible as soon as the local is stored
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
index 803240ddb7..5f4cc19307 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -1726,7 +1726,7 @@ public void generateBoxingConversion(int unboxedTypeID) {
/**
* Macro for building a class descriptor object
*/
-public void generateClassLiteralAccessForType(Scope scope, TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
+public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
getTYPE(accessedType.id);
return;
@@ -1790,7 +1790,7 @@ public void generateClassLiteralAccessForType(Scope scope, TypeBinding accessedT
on the stack, which means that the stack may not be empty at this point in the
above code gen. So we save its state and restart it from 1. */
- pushExceptionOnStack(scope.getJavaLangClassNotFoundException());
+ pushExceptionOnStack(TypeBinding.NULL);/*represents ClassNotFoundException*/
classNotFoundExceptionHandler.place();
// Transform the current exception, and repush and throw a
@@ -2509,7 +2509,7 @@ public void generateSyntheticBodyForFactoryMethod(SyntheticMethodBinding methodB
public void generateSyntheticBodyForEnumValueOf(SyntheticMethodBinding methodBinding) {
initializeMaxLocals(methodBinding);
final ReferenceBinding declaringClass = methodBinding.declaringClass;
- generateClassLiteralAccessForType(((SourceTypeBinding) methodBinding.declaringClass).scope, declaringClass, null);
+ generateClassLiteralAccessForType(declaringClass, null);
aload_0();
invokeJavaLangEnumvalueOf(declaringClass);
this.checkcast(declaringClass);
@@ -3065,7 +3065,7 @@ public void generateSyntheticBodyForSwitchTable(SyntheticMethodBinding methodBin
anyExceptionHandler.placeEnd();
goto_(endLabel);
// Generate the body of the exception handler
- pushExceptionOnStack(scope.getJavaLangNoSuchFieldError());
+ pushExceptionOnStack(TypeBinding.LONG /*represents NoSuchFieldError*/);
anyExceptionHandler.place();
pop(); // we don't use it so we can pop it
endLabel.place();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java
index c2ef996a6c..a646ac829c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java
@@ -14,10 +14,8 @@
package org.eclipse.jdt.internal.compiler.codegen;
import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
public class StackMapFrame {
@@ -39,156 +37,127 @@ public class StackMapFrame {
private int numberOfDifferentLocals = -1;
public int tagBits;
- public StackMapFrame(int initialLocalSize) {
- this.locals = new VerificationTypeInfo[initialLocalSize];
- this.numberOfLocals = -1;
- this.numberOfDifferentLocals = -1;
+public StackMapFrame(int initialLocalSize) {
+ this.locals = new VerificationTypeInfo[initialLocalSize];
+ this.numberOfLocals = -1;
+ this.numberOfDifferentLocals = -1;
+}
+public int getFrameType(StackMapFrame prevFrame) {
+ final int offsetDelta = getOffsetDelta(prevFrame);
+ switch(this.numberOfStackItems) {
+ case 0 :
+ switch(numberOfDifferentLocals(prevFrame)) {
+ case 0 :
+ return offsetDelta <= 63 ? SAME_FRAME : SAME_FRAME_EXTENDED;
+ case 1 :
+ case 2 :
+ case 3 :
+ return APPEND_FRAME;
+ case -1 :
+ case -2 :
+ case -3 :
+ return CHOP_FRAME;
+ }
+ break;
+ case 1 :
+ switch(numberOfDifferentLocals(prevFrame)) {
+ case 0 :
+ return offsetDelta <= 63 ? SAME_LOCALS_1_STACK_ITEMS : SAME_LOCALS_1_STACK_ITEMS_EXTENDED;
+ }
}
-
- public int getFrameType(StackMapFrame prevFrame) {
- final int offsetDelta = getOffsetDelta(prevFrame);
- switch (this.numberOfStackItems) {
- case 0:
- switch (numberOfDifferentLocals(prevFrame)) {
- case 0:
- return offsetDelta <= 63 ? SAME_FRAME : SAME_FRAME_EXTENDED;
- case 1:
- case 2:
- case 3:
- return APPEND_FRAME;
- case -1:
- case -2:
- case -3:
- return CHOP_FRAME;
- }
- break;
- case 1:
- switch (numberOfDifferentLocals(prevFrame)) {
- case 0:
- return offsetDelta <= 63 ? SAME_LOCALS_1_STACK_ITEMS : SAME_LOCALS_1_STACK_ITEMS_EXTENDED;
- }
+ return FULL_FRAME;
+}
+public void addLocal(int resolvedPosition, VerificationTypeInfo info) {
+ if (this.locals == null) {
+ this.locals = new VerificationTypeInfo[resolvedPosition + 1];
+ this.locals[resolvedPosition] = info;
+ } else {
+ final int length = this.locals.length;
+ if (resolvedPosition >= length) {
+ System.arraycopy(this.locals, 0, this.locals = new VerificationTypeInfo[resolvedPosition + 1], 0, length);
}
- return FULL_FRAME;
+ this.locals[resolvedPosition] = info;
}
-
- public void addLocal(int resolvedPosition, VerificationTypeInfo info) {
- if (this.locals == null) {
- this.locals = new VerificationTypeInfo[resolvedPosition + 1];
- this.locals[resolvedPosition] = info;
- } else {
- final int length = this.locals.length;
- if (resolvedPosition >= length) {
- System.arraycopy(this.locals, 0, this.locals = new VerificationTypeInfo[resolvedPosition + 1], 0,
- length);
- }
- this.locals[resolvedPosition] = info;
- }
+}
+public void addStackItem(VerificationTypeInfo info) {
+ if (info == null) {
+ throw new IllegalArgumentException("info cannot be null"); //$NON-NLS-1$
}
-
- public void addStackItem(VerificationTypeInfo info) {
- if (info == null) {
- throw new IllegalArgumentException("info cannot be null"); //$NON-NLS-1$
- }
- if (this.stackItems == null) {
- this.stackItems = new VerificationTypeInfo[1];
- this.stackItems[0] = info;
- this.numberOfStackItems = 1;
- } else {
- final int length = this.stackItems.length;
- if (this.numberOfStackItems == length) {
- System.arraycopy(this.stackItems, 0, this.stackItems = new VerificationTypeInfo[length + 1], 0, length);
- }
- this.stackItems[this.numberOfStackItems++] = info;
+ if (this.stackItems == null) {
+ this.stackItems = new VerificationTypeInfo[1];
+ this.stackItems[0] = info;
+ this.numberOfStackItems = 1;
+ } else {
+ final int length = this.stackItems.length;
+ if (this.numberOfStackItems == length) {
+ System.arraycopy(this.stackItems, 0, this.stackItems = new VerificationTypeInfo[length + 1], 0, length);
}
+ this.stackItems[this.numberOfStackItems++] = info;
}
-
- public StackMapFrame duplicate() {
- Map<VerificationTypeInfo, VerificationTypeInfo> cache = new HashMap<VerificationTypeInfo, VerificationTypeInfo>();
- int length = this.locals.length;
- StackMapFrame result = new StackMapFrame(length);
- result.numberOfLocals = -1;
- result.numberOfDifferentLocals = -1;
- result.pc = this.pc;
- result.numberOfStackItems = this.numberOfStackItems;
-
- if (length != 0) {
- result.locals = new VerificationTypeInfo[length];
- for (int i = 0; i < length; i++) {
- final VerificationTypeInfo verificationTypeInfo = this.locals[i];
- result.locals[i] = getCachedValue(cache, verificationTypeInfo);
- }
- }
- length = this.numberOfStackItems;
- if (length != 0) {
- result.stackItems = new VerificationTypeInfo[length];
- for (int i = 0; i < length; i++) {
- final VerificationTypeInfo verificationTypeInfo = this.stackItems[i];
- result.stackItems[i] = getCachedValue(cache, verificationTypeInfo);
- }
+}
+public void addStackItem(TypeBinding binding) {
+ if (this.stackItems == null) {
+ this.stackItems = new VerificationTypeInfo[1];
+ this.stackItems[0] = new VerificationTypeInfo(binding);
+ this.numberOfStackItems = 1;
+ } else {
+ final int length = this.stackItems.length;
+ if (this.numberOfStackItems == length) {
+ System.arraycopy(this.stackItems, 0, this.stackItems = new VerificationTypeInfo[length + 1], 0, length);
}
- return result;
+ this.stackItems[this.numberOfStackItems++] = new VerificationTypeInfo(binding);
}
+}
+public StackMapFrame duplicate() {
+ int length = this.locals.length;
+ StackMapFrame result = new StackMapFrame(length);
+ result.numberOfLocals = -1;
+ result.numberOfDifferentLocals = -1;
+ result.pc = this.pc;
+ result.numberOfStackItems = this.numberOfStackItems;
- private VerificationTypeInfo getCachedValue(Map<VerificationTypeInfo, VerificationTypeInfo> cache, VerificationTypeInfo value) {
- VerificationTypeInfo cachedValue = value;
- if (value != null) {
- if (value.tag == VerificationTypeInfo.ITEM_UNINITIALIZED || value.tag == VerificationTypeInfo.ITEM_UNINITIALIZED_THIS) {
- // we use the cache only for uninitialized info
- cachedValue = cache.get(value);
- if (cachedValue == null) {
- cachedValue = value.duplicate();
- cache.put(value, cachedValue);
- }
- } else {
- cachedValue = value.duplicate();
+ if (length != 0) {
+ result.locals = new VerificationTypeInfo[length];
+ for (int i = 0; i < length; i++) {
+ final VerificationTypeInfo verificationTypeInfo = this.locals[i];
+ if (verificationTypeInfo != null) {
+ result.locals[i] = verificationTypeInfo.duplicate();
}
}
- return cachedValue;
}
- public int numberOfDifferentLocals(StackMapFrame prevFrame) {
- if (this.numberOfDifferentLocals != -1)
- return this.numberOfDifferentLocals;
- if (prevFrame == null) {
- this.numberOfDifferentLocals = 0;
- return 0;
+ length = this.numberOfStackItems;
+ if (length != 0) {
+ result.stackItems = new VerificationTypeInfo[length];
+ for (int i = 0; i < length; i++) {
+ result.stackItems[i] = this.stackItems[i].duplicate();
}
- VerificationTypeInfo[] prevLocals = prevFrame.locals;
- VerificationTypeInfo[] currentLocals = this.locals;
- int prevLocalsLength = prevLocals == null ? 0 : prevLocals.length;
- int currentLocalsLength = currentLocals == null ? 0 : currentLocals.length;
- int prevNumberOfLocals = prevFrame.getNumberOfLocals();
- int currentNumberOfLocals = getNumberOfLocals();
+ }
+ return result;
+}
+public int numberOfDifferentLocals(StackMapFrame prevFrame) {
+ if (this.numberOfDifferentLocals != -1) return this.numberOfDifferentLocals;
+ if (prevFrame == null) {
+ this.numberOfDifferentLocals = 0;
+ return 0;
+ }
+ VerificationTypeInfo[] prevLocals = prevFrame.locals;
+ VerificationTypeInfo[] currentLocals = this.locals;
+ int prevLocalsLength = prevLocals == null ? 0 : prevLocals.length;
+ int currentLocalsLength = currentLocals == null ? 0 : currentLocals.length;
+ int prevNumberOfLocals = prevFrame.getNumberOfLocals();
+ int currentNumberOfLocals = getNumberOfLocals();
- int result = 0;
- if (prevNumberOfLocals == 0) {
- if (currentNumberOfLocals != 0) {
- // need to check if there is a hole in the locals
- result = currentNumberOfLocals; // append if no hole and currentNumberOfLocals <= 3
- int counter = 0;
- for (int i = 0; i < currentLocalsLength && counter < currentNumberOfLocals; i++) {
- if (currentLocals[i] != null) {
- switch (currentLocals[i].id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
- i++;
- }
- counter++;
- } else {
- result = Integer.MAX_VALUE;
- this.numberOfDifferentLocals = result;
- return result;
- }
- }
- }
- } else if (currentNumberOfLocals == 0) {
- // need to check if there is a hole in the prev locals
+ int result = 0;
+ if (prevNumberOfLocals == 0) {
+ if (currentNumberOfLocals != 0) {
+ // need to check if there is a hole in the locals
+ result = currentNumberOfLocals; // append if no hole and currentNumberOfLocals <= 3
int counter = 0;
- result = -prevNumberOfLocals; // chop frame if no hole and prevNumberOfLocals <= 3
- for (int i = 0; i < prevLocalsLength && counter < prevNumberOfLocals; i++) {
- if (prevLocals[i] != null) {
- switch (prevLocals[i].id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
+ for(int i = 0; i < currentLocalsLength && counter < currentNumberOfLocals; i++) {
+ if (currentLocals[i] != null) {
+ switch(currentLocals[i].id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
i++;
}
counter++;
@@ -198,220 +167,216 @@ public class StackMapFrame {
return result;
}
}
- } else {
- // need to see if prevLocals matches with currentLocals
- int indexInPrevLocals = 0;
- int indexInCurrentLocals = 0;
- int currentLocalsCounter = 0;
- int prevLocalsCounter = 0;
- currentLocalsLoop: for (; indexInCurrentLocals < currentLocalsLength
- && currentLocalsCounter < currentNumberOfLocals; indexInCurrentLocals++) {
- VerificationTypeInfo currentLocal = currentLocals[indexInCurrentLocals];
- if (currentLocal != null) {
- currentLocalsCounter++;
- switch (currentLocal.id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
- indexInCurrentLocals++; // next entry is null
- }
+ }
+ } else if (currentNumberOfLocals == 0) {
+ // need to check if there is a hole in the prev locals
+ int counter = 0;
+ result = -prevNumberOfLocals; // chop frame if no hole and prevNumberOfLocals <= 3
+ for(int i = 0; i < prevLocalsLength && counter < prevNumberOfLocals; i++) {
+ if (prevLocals[i] != null) {
+ switch(prevLocals[i].id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
+ i++;
+ }
+ counter++;
+ } else {
+ result = Integer.MAX_VALUE;
+ this.numberOfDifferentLocals = result;
+ return result;
+ }
+ }
+ } else {
+ // need to see if prevLocals matches with currentLocals
+ int indexInPrevLocals = 0;
+ int indexInCurrentLocals = 0;
+ int currentLocalsCounter = 0;
+ int prevLocalsCounter = 0;
+ currentLocalsLoop: for (;indexInCurrentLocals < currentLocalsLength && currentLocalsCounter < currentNumberOfLocals; indexInCurrentLocals++) {
+ VerificationTypeInfo currentLocal = currentLocals[indexInCurrentLocals];
+ if (currentLocal != null) {
+ currentLocalsCounter++;
+ switch(currentLocal.id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
+ indexInCurrentLocals++; // next entry is null
}
- if (indexInPrevLocals < prevLocalsLength && prevLocalsCounter < prevNumberOfLocals) {
- VerificationTypeInfo prevLocal = prevLocals[indexInPrevLocals];
- if (prevLocal != null) {
- prevLocalsCounter++;
- switch (prevLocal.id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
- indexInPrevLocals++; // next entry is null
- }
+ }
+ if (indexInPrevLocals < prevLocalsLength && prevLocalsCounter < prevNumberOfLocals) {
+ VerificationTypeInfo prevLocal = prevLocals[indexInPrevLocals];
+ if (prevLocal != null) {
+ prevLocalsCounter++;
+ switch(prevLocal.id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
+ indexInPrevLocals++; // next entry is null
}
- // now we need to check if prevLocal matches with currentLocal
- // the index must be the same
- if (equals(prevLocal, currentLocal) && indexInPrevLocals == indexInCurrentLocals) {
- if (result != 0) {
- result = Integer.MAX_VALUE;
- this.numberOfDifferentLocals = result;
- return result;
- }
- } else {
- // locals at the same location are not equals - this has to be a full frame
+ }
+ // now we need to check if prevLocal matches with currentLocal
+ // the index must be the same
+ if (equals(prevLocal, currentLocal) && indexInPrevLocals == indexInCurrentLocals) {
+ if (result != 0) {
result = Integer.MAX_VALUE;
this.numberOfDifferentLocals = result;
return result;
}
- indexInPrevLocals++;
- continue currentLocalsLoop;
- }
- // process remaining current locals
- if (currentLocal != null) {
- result++;
} else {
+ // locals at the same location are not equals - this has to be a full frame
result = Integer.MAX_VALUE;
this.numberOfDifferentLocals = result;
return result;
}
- indexInCurrentLocals++;
- break currentLocalsLoop;
+ indexInPrevLocals++;
+ continue currentLocalsLoop;
}
- if (currentLocalsCounter < currentNumberOfLocals) {
- for (; indexInCurrentLocals < currentLocalsLength
- && currentLocalsCounter < currentNumberOfLocals; indexInCurrentLocals++) {
- VerificationTypeInfo currentLocal = currentLocals[indexInCurrentLocals];
- if (currentLocal == null) {
- result = Integer.MAX_VALUE;
- this.numberOfDifferentLocals = result;
- return result;
- }
- result++;
- currentLocalsCounter++;
- switch (currentLocal.id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
- indexInCurrentLocals++; // next entry is null
- }
- }
- } else if (prevLocalsCounter < prevNumberOfLocals) {
- result = -result;
- // process possible remaining prev locals
- for (; indexInPrevLocals < prevLocalsLength
- && prevLocalsCounter < prevNumberOfLocals; indexInPrevLocals++) {
- VerificationTypeInfo prevLocal = prevLocals[indexInPrevLocals];
- if (prevLocal == null) {
- result = Integer.MAX_VALUE;
- this.numberOfDifferentLocals = result;
- return result;
- }
- result--;
- prevLocalsCounter++;
- switch (prevLocal.id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
- indexInPrevLocals++; // next entry is null
- }
- }
+ // process remaining current locals
+ if (currentLocal != null) {
+ result++;
+ } else {
+ result = Integer.MAX_VALUE;
+ this.numberOfDifferentLocals = result;
+ return result;
}
+ indexInCurrentLocals++;
+ break currentLocalsLoop;
}
- this.numberOfDifferentLocals = result;
- return result;
- }
-
- public int getNumberOfLocals() {
- if (this.numberOfLocals != -1) {
- return this.numberOfLocals;
- }
- int result = 0;
- final int length = this.locals == null ? 0 : this.locals.length;
- for (int i = 0; i < length; i++) {
- if (this.locals[i] != null) {
- switch (this.locals[i].id()) {
- case TypeIds.T_double:
- case TypeIds.T_long:
- i++;
+ if (currentLocalsCounter < currentNumberOfLocals) {
+ for(;indexInCurrentLocals < currentLocalsLength && currentLocalsCounter < currentNumberOfLocals; indexInCurrentLocals++) {
+ VerificationTypeInfo currentLocal = currentLocals[indexInCurrentLocals];
+ if (currentLocal == null) {
+ result = Integer.MAX_VALUE;
+ this.numberOfDifferentLocals = result;
+ return result;
}
result++;
+ currentLocalsCounter++;
+ switch(currentLocal.id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
+ indexInCurrentLocals++; // next entry is null
+ }
}
- }
- this.numberOfLocals = result;
- return result;
- }
-
- public int getOffsetDelta(StackMapFrame prevFrame) {
- if (prevFrame == null)
- return this.pc;
- return prevFrame.pc == -1 ? this.pc : this.pc - prevFrame.pc - 1;
- }
-
- @Override
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- printFrame(buffer, this);
- return String.valueOf(buffer);
- }
-
- private void printFrame(StringBuffer buffer, StackMapFrame frame) {
- String pattern = "[pc : {0} locals: {1} stack items: {2}\nlocals: {3}\nstack: {4}\n]"; //$NON-NLS-1$
- int localsLength = frame.locals == null ? 0 : frame.locals.length;
- buffer.append(MessageFormat.format(pattern,
- new Object[] { Integer.toString(frame.pc), Integer.toString(frame.getNumberOfLocals()),
- Integer.toString(frame.numberOfStackItems), print(frame.locals, localsLength),
- print(frame.stackItems, frame.numberOfStackItems) }));
- }
-
- private String print(VerificationTypeInfo[] infos, int length) {
- StringBuffer buffer = new StringBuffer();
- buffer.append('[');
- if (infos != null) {
- for (int i = 0; i < length; i++) {
- if (i != 0)
- buffer.append(',');
- VerificationTypeInfo verificationTypeInfo = infos[i];
- if (verificationTypeInfo == null) {
- buffer.append("top"); //$NON-NLS-1$
- continue;
+ } else if (prevLocalsCounter < prevNumberOfLocals) {
+ result = -result;
+ // process possible remaining prev locals
+ for(; indexInPrevLocals < prevLocalsLength && prevLocalsCounter < prevNumberOfLocals; indexInPrevLocals++) {
+ VerificationTypeInfo prevLocal = prevLocals[indexInPrevLocals];
+ if (prevLocal == null) {
+ result = Integer.MAX_VALUE;
+ this.numberOfDifferentLocals = result;
+ return result;
+ }
+ result--;
+ prevLocalsCounter++;
+ switch(prevLocal.id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
+ indexInPrevLocals++; // next entry is null
}
- buffer.append(verificationTypeInfo);
}
}
- buffer.append(']');
- return String.valueOf(buffer);
}
-
- public void putLocal(int resolvedPosition, VerificationTypeInfo info) {
- if (this.locals == null) {
- this.locals = new VerificationTypeInfo[resolvedPosition + 1];
- this.locals[resolvedPosition] = info;
- } else {
- final int length = this.locals.length;
- if (resolvedPosition >= length) {
- System.arraycopy(this.locals, 0, this.locals = new VerificationTypeInfo[resolvedPosition + 1], 0,
- length);
+ this.numberOfDifferentLocals = result;
+ return result;
+}
+public int getNumberOfLocals() {
+ if (this.numberOfLocals != -1) {
+ return this.numberOfLocals;
+ }
+ int result = 0;
+ final int length = this.locals == null ? 0 : this.locals.length;
+ for(int i = 0; i < length; i++) {
+ if (this.locals[i] != null) {
+ switch(this.locals[i].id()) {
+ case TypeIds.T_double :
+ case TypeIds.T_long :
+ i++;
}
- this.locals[resolvedPosition] = info;
+ result++;
}
}
-
- public void replaceWithElementType() {
- VerificationTypeInfo info = this.stackItems[this.numberOfStackItems - 1];
- VerificationTypeInfo info2 = info.duplicate();
- info2.replaceWithElementType();
- this.stackItems[this.numberOfStackItems - 1] = info2;
- }
-
- public int getIndexOfDifferentLocals(int differentLocalsCount) {
- for (int i = this.locals.length - 1; i >= 0; i--) {
- VerificationTypeInfo currentLocal = this.locals[i];
- if (currentLocal == null) {
- // check the previous slot
+ this.numberOfLocals = result;
+ return result;
+}
+public int getOffsetDelta(StackMapFrame prevFrame) {
+ if (prevFrame == null) return this.pc;
+ return prevFrame.pc == -1 ? this.pc : this.pc - prevFrame.pc - 1;
+}
+@Override
+public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ printFrame(buffer, this);
+ return String.valueOf(buffer);
+}
+private void printFrame(StringBuffer buffer, StackMapFrame frame) {
+ String pattern = "[pc : {0} locals: {1} stack items: {2}\nlocals: {3}\nstack: {4}\n]"; //$NON-NLS-1$
+ int localsLength = frame.locals == null ? 0 : frame.locals.length;
+ buffer.append(MessageFormat.format(
+ pattern,
+ new Object[] {
+ Integer.toString(frame.pc),
+ Integer.toString(frame.getNumberOfLocals()),
+ Integer.toString(frame.numberOfStackItems),
+ print(frame.locals, localsLength),
+ print(frame.stackItems, frame.numberOfStackItems)
+ }
+ ));
+}
+private String print(VerificationTypeInfo[] infos, int length) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append('[');
+ if (infos != null) {
+ for (int i = 0; i < length; i++) {
+ if (i != 0) buffer.append(',');
+ VerificationTypeInfo verificationTypeInfo = infos[i];
+ if (verificationTypeInfo == null) {
+ buffer.append("top"); //$NON-NLS-1$
continue;
- } else {
- differentLocalsCount--;
- }
- if (differentLocalsCount == 0) {
- return i;
}
+ buffer.append(verificationTypeInfo);
}
- return 0;
}
-
- private boolean equals(VerificationTypeInfo info, VerificationTypeInfo info2) {
- if (info == null) {
- return info2 == null;
+ buffer.append(']');
+ return String.valueOf(buffer);
+}
+public void putLocal(int resolvedPosition, VerificationTypeInfo info) {
+ if (this.locals == null) {
+ this.locals = new VerificationTypeInfo[resolvedPosition + 1];
+ this.locals[resolvedPosition] = info;
+ } else {
+ final int length = this.locals.length;
+ if (resolvedPosition >= length) {
+ System.arraycopy(this.locals, 0, this.locals = new VerificationTypeInfo[resolvedPosition + 1], 0, length);
}
- if (info2 == null)
- return false;
- return info.equals(info2);
+ this.locals[resolvedPosition] = info;
}
-
- public StackMapFrame merge(StackMapFrame frame, Scope scope) {
- if (frame.pc == -1) {
- // branching
- return this;
+}
+public void replaceWithElementType() {
+ VerificationTypeInfo info = this.stackItems[this.numberOfStackItems - 1];
+ VerificationTypeInfo info2 = info.duplicate();
+ info2.replaceWithElementType();
+ this.stackItems[this.numberOfStackItems - 1] = info2;
+}
+public int getIndexOfDifferentLocals(int differentLocalsCount) {
+ for (int i = this.locals.length - 1; i >= 0; i--) {
+ VerificationTypeInfo currentLocal = this.locals[i];
+ if (currentLocal == null) {
+ // check the previous slot
+ continue;
+ } else {
+ differentLocalsCount--;
}
- if (this.numberOfStackItems == frame.numberOfStackItems) {
- for (int i = 0, max = this.numberOfStackItems; i < max; i++) {
- this.stackItems[i] = this.stackItems[i].merge(frame.stackItems[i], scope);
- }
+ if (differentLocalsCount == 0) {
+ return i;
}
- return this;
}
+ return 0;
+}
+private boolean equals(VerificationTypeInfo info, VerificationTypeInfo info2) {
+ if (info == null) {
+ return info2 == null;
+ }
+ if (info2 == null) return false;
+ return info.equals(info2);
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
index 3e44c49bf1..8d0fffe528 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
@@ -33,17 +33,16 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
-@SuppressWarnings({ "rawtypes", "unchecked" })
+@SuppressWarnings({"rawtypes", "unchecked"})
public class StackMapFrameCodeStream extends CodeStream {
public static class ExceptionMarker implements Comparable {
- private TypeBinding binding;
+ public char[] constantPoolName;
public int pc;
- public ExceptionMarker(int pc, TypeBinding typeBinding) {
+ public ExceptionMarker(int pc, char[] constantPoolName) {
this.pc = pc;
- this.binding = typeBinding;
+ this.constantPoolName = constantPoolName;
}
-
@Override
public int compareTo(Object o) {
if (o instanceof ExceptionMarker) {
@@ -51,29 +50,93 @@ public class StackMapFrameCodeStream extends CodeStream {
}
return 0;
}
-
@Override
public boolean equals(Object obj) {
if (obj instanceof ExceptionMarker) {
ExceptionMarker marker = (ExceptionMarker) obj;
- return this.pc == marker.pc && this.binding.equals(marker.binding);
+ return this.pc == marker.pc && CharOperation.equals(this.constantPoolName, marker.constantPoolName);
}
return false;
}
+ @Override
+ public int hashCode() {
+ return this.pc + CharOperation.hashCode(this.constantPoolName);
+ }
+ @Override
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append('(').append(this.pc).append(',').append(this.constantPoolName).append(')');
+ return String.valueOf(buffer);
+ }
+ }
- public TypeBinding getBinding() {
- return this.binding;
+ public static class StackDepthMarker {
+ public int pc;
+ public int delta;
+ public TypeBinding typeBinding;
+
+ public StackDepthMarker(int pc, int delta, TypeBinding typeBinding) {
+ this.pc = pc;
+ this.typeBinding = typeBinding;
+ this.delta = delta;
+ }
+
+ public StackDepthMarker(int pc, int delta) {
+ this.pc = pc;
+ this.delta = delta;
}
@Override
- public int hashCode() {
- return this.pc + CharOperation.hashCode(this.binding.constantPoolName());
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append('(').append(this.pc).append(',').append(this.delta);
+ if (this.typeBinding != null) {
+ if (this.typeBinding.isBaseType()) {
+ buffer
+ .append(',')
+ .append(this.typeBinding.qualifiedSourceName());
+ } else {
+ buffer
+ .append(',')
+ .append(this.typeBinding.qualifiedPackageName())
+ .append('.')
+ .append(this.typeBinding.qualifiedSourceName());
+ }
+ }
+ buffer.append(')');
+ return String.valueOf(buffer);
+ }
+ }
+
+ public static class StackMarker {
+ public int pc;
+ public int destinationPC;
+ public VerificationTypeInfo[] infos;
+
+ public StackMarker(int pc, int destinationPC) {
+ this.pc = pc;
+ this.destinationPC = destinationPC;
+ }
+
+ public void setInfos(VerificationTypeInfo[] infos) {
+ this.infos = infos;
}
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
- buffer.append('(').append(this.pc).append(',').append(this.binding.constantPoolName()).append(')');
+ buffer
+ .append("[copy stack items from ") //$NON-NLS-1$
+ .append(this.pc)
+ .append(" to ") //$NON-NLS-1$
+ .append(this.destinationPC);
+ if (this.infos!= null) {
+ for (int i = 0, max = this.infos.length; i < max; i++) {
+ if (i > 0) buffer.append(',');
+ buffer.append(this.infos[i]);
+ }
+ }
+ buffer.append(']');
return String.valueOf(buffer);
}
}
@@ -89,434 +152,483 @@ public class StackMapFrameCodeStream extends CodeStream {
public ArrayList stackDepthMarkers;
public ArrayList stackMarkers;
- public StackMapFrameCodeStream(ClassFile givenClassFile) {
- super(givenClassFile);
- this.generateAttributes |= ClassFileConstants.ATTR_STACK_MAP;
- }
-
- @Override
- public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
- // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
- for (int i = 0; i < this.visibleLocalsCount; i++) {
- LocalVariableBinding localBinding = this.visibleLocals[i];
- if (localBinding != null) {
- // Check if the local is definitely assigned
- boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
- if (!isDefinitelyAssigned) {
- continue;
- } else {
- if ((localBinding.initializationCount == 0)
- || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1)
- + 1] != -1)) {
- /*
- * There are two cases: 1) there is no initialization interval opened ==> add an opened interval
- * 2) there is already some initialization intervals but the last one is closed ==> add an
- * opened interval An opened interval means that the value at
- * localBinding.initializationPCs[localBinding.initializationCount - 1][1] is equals to -1.
- * initializationPCs is a collection of pairs of int: first value is the startPC and second
- * value is the endPC. -1 one for the last value means that the interval is not closed yet.
- */
- localBinding.recordInitializationStartPC(this.position);
- }
+public StackMapFrameCodeStream(ClassFile givenClassFile) {
+ super(givenClassFile);
+ this.generateAttributes |= ClassFileConstants.ATTR_STACK_MAP;
+}
+@Override
+public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
+ // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
+ for (int i = 0; i < this.visibleLocalsCount; i++) {
+ LocalVariableBinding localBinding = this.visibleLocals[i];
+ if (localBinding != null) {
+ // Check if the local is definitely assigned
+ boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
+ if (!isDefinitelyAssigned) {
+ continue;
+ } else {
+ if ((localBinding.initializationCount == 0) || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1) + 1] != -1)) {
+ /* There are two cases:
+ * 1) there is no initialization interval opened ==> add an opened interval
+ * 2) there is already some initialization intervals but the last one is closed ==> add an opened interval
+ * An opened interval means that the value at localBinding.initializationPCs[localBinding.initializationCount - 1][1]
+ * is equals to -1.
+ * initializationPCs is a collection of pairs of int:
+ * first value is the startPC and second value is the endPC. -1 one for the last value means that the interval
+ * is not closed yet.
+ */
+ localBinding.recordInitializationStartPC(this.position);
}
}
}
}
-
- public void addExceptionMarker(int pc, TypeBinding typeBinding) {
- if (this.exceptionMarkers == null) {
- this.exceptionMarkers = new HashSet();
+}
+public void addExceptionMarker(int pc, TypeBinding typeBinding) {
+ if (this.exceptionMarkers == null) {
+ this.exceptionMarkers = new HashSet();
+ }
+ if (typeBinding == null) {
+ this.exceptionMarkers.add(new ExceptionMarker(pc, ConstantPool.JavaLangThrowableConstantPoolName));
+ } else {
+ switch(typeBinding.id) {
+ case TypeIds.T_null :
+ this.exceptionMarkers.add(new ExceptionMarker(pc, ConstantPool.JavaLangClassNotFoundExceptionConstantPoolName));
+ break;
+ case TypeIds.T_long :
+ this.exceptionMarkers.add(new ExceptionMarker(pc, ConstantPool.JavaLangNoSuchFieldErrorConstantPoolName));
+ break;
+ default:
+ this.exceptionMarkers.add(new ExceptionMarker(pc, typeBinding.constantPoolName()));
}
-
- this.exceptionMarkers.add(new ExceptionMarker(pc, typeBinding));
}
-
- public void addFramePosition(int pc) {
- Integer newEntry = Integer.valueOf(pc);
- FramePosition value;
- if ((value = (FramePosition) this.framePositions.get(newEntry)) != null) {
- value.counter++;
- } else {
- this.framePositions.put(newEntry, new FramePosition());
- }
+}
+public void addFramePosition(int pc) {
+ Integer newEntry = Integer.valueOf(pc);
+ FramePosition value;
+ if ((value = (FramePosition) this.framePositions.get(newEntry)) != null) {
+ value.counter++;
+ } else {
+ this.framePositions.put(newEntry, new FramePosition());
}
-
- @Override
- public void optimizeBranch(int oldPosition, BranchLabel lbl) {
- super.optimizeBranch(oldPosition, lbl);
- removeFramePosition(oldPosition);
+}
+@Override
+public void optimizeBranch(int oldPosition, BranchLabel lbl) {
+ super.optimizeBranch(oldPosition, lbl);
+ removeFramePosition(oldPosition);
+ removeStackMapMarkers(oldPosition);
+}
+public void removeFramePosition(int pc) {
+ Integer entry = Integer.valueOf(pc);
+ FramePosition value;
+ if ((value = (FramePosition) this.framePositions.get(entry)) != null) {
+ value.counter--;
+ if (value.counter <= 0) {
+ this.framePositions.remove(entry);
+ }
}
-
- public void removeFramePosition(int pc) {
- Integer entry = Integer.valueOf(pc);
- FramePosition value;
- if ((value = (FramePosition) this.framePositions.get(entry)) != null) {
- value.counter--;
- if (value.counter <= 0) {
- this.framePositions.remove(entry);
+}
+public void removeStackMapMarkers(int markerOldPosition) {
+ if (this.stackDepthMarkers != null) {
+ for (int i = this.stackDepthMarkers.size() - 1; i >= 0; i--) {
+ StackDepthMarker marker = (StackDepthMarker) this.stackDepthMarkers.get(i);
+ if (marker.pc == markerOldPosition) {
+ this.stackDepthMarkers.remove(i);
+ break;
}
}
}
-
- @Override
- public void addVariable(LocalVariableBinding localBinding) {
- if (localBinding.initializationPCs == null) {
- record(localBinding);
+}
+@Override
+public void addVariable(LocalVariableBinding localBinding) {
+ if (localBinding.initializationPCs == null) {
+ record(localBinding);
+ }
+ localBinding.recordInitializationStartPC(this.position);
+}
+private void addStackMarker(int pc, int destinationPC) {
+ if (this.stackMarkers == null) {
+ this.stackMarkers = new ArrayList();
+ this.stackMarkers.add(new StackMarker(pc, destinationPC));
+ } else {
+ int size = this.stackMarkers.size();
+ if (size == 0 || ((StackMarker) this.stackMarkers.get(size - 1)).pc != this.position) {
+ this.stackMarkers.add(new StackMarker(pc, destinationPC));
}
- localBinding.recordInitializationStartPC(this.position);
}
-
- @Override
- public void recordExpressionType(TypeBinding typeBinding, int delta, boolean adjustStackDepth) {
- if (adjustStackDepth) {
- // optimized goto
- // the break label already adjusted the stack depth (-1 or -2 depending on the return type)
- // we need to adjust back to what it was
- switch (typeBinding.id) {
- case TypeIds.T_long:
- case TypeIds.T_double:
- this.stackDepth += 2;
- break;
- case TypeIds.T_void:
- break;
- default:
- this.stackDepth++;
- break;
+}
+private void addStackDepthMarker(int pc, int delta, TypeBinding typeBinding) {
+ if (this.stackDepthMarkers == null) {
+ this.stackDepthMarkers = new ArrayList();
+ this.stackDepthMarkers.add(new StackDepthMarker(pc, delta, typeBinding));
+ } else {
+ int size = this.stackDepthMarkers.size();
+ if (size == 0) {
+ this.stackDepthMarkers.add(new StackDepthMarker(pc, delta, typeBinding));
+ } else {
+ StackDepthMarker stackDepthMarker = (StackDepthMarker) this.stackDepthMarkers.get(size - 1);
+ if (stackDepthMarker.pc != this.position) {
+ this.stackDepthMarkers.add(new StackDepthMarker(pc, delta, typeBinding));
+ } else {
+ // We replace the recorded stack depth marker with a new value that contains the given typeBinding
+ // This case can happen when multiple conditional expression are nested see bug 362591
+ this.stackDepthMarkers.set(size - 1, new StackDepthMarker(pc, delta, typeBinding));
}
}
}
-
- /**
- * Macro for building a class descriptor object
- */
- @Override
- public void generateClassLiteralAccessForType(Scope scope, TypeBinding accessedType,
- FieldBinding syntheticFieldBinding) {
- if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
- getTYPE(accessedType.id);
- return;
+}
+@Override
+public void decrStackSize(int offset) {
+ super.decrStackSize(offset);
+ addStackDepthMarker(this.position, -1, null);
+}
+@Override
+public void recordExpressionType(TypeBinding typeBinding) {
+ addStackDepthMarker(this.position, 0, typeBinding);
+}
+@Override
+public void recordExpressionType(TypeBinding typeBinding, int delta, boolean adjustStackDepth) {
+ addStackDepthMarker(this.position, delta, typeBinding);
+ if (adjustStackDepth) {
+ // optimized goto
+ // the break label already adjusted the stack depth (-1 or -2 depending on the return type)
+ // we need to adjust back to what it was
+ switch(typeBinding.id) {
+ case TypeIds.T_long :
+ case TypeIds.T_double :
+ this.stackDepth+=2;
+ break;
+ case TypeIds.T_void :
+ break;
+ default :
+ this.stackDepth++;
+ break;
+ }
+ }
+}
+/**
+ * Macro for building a class descriptor object
+ */
+@Override
+public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
+ if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
+ getTYPE(accessedType.id);
+ return;
+ }
+
+ if (this.targetLevel >= ClassFileConstants.JDK1_5) {
+ // generation using the new ldc_w bytecode
+ this.ldc(accessedType);
+ } else {
+ // use in CLDC mode
+ BranchLabel endLabel = new BranchLabel(this);
+ if (syntheticFieldBinding != null) { // non interface case
+ fieldAccess(Opcodes.OPC_getstatic, syntheticFieldBinding, null /* default declaringClass */);
+ dup();
+ ifnonnull(endLabel);
+ pop();
}
- if (this.targetLevel >= ClassFileConstants.JDK1_5) {
- // generation using the new ldc_w bytecode
- this.ldc(accessedType);
- } else {
- // use in CLDC mode
- BranchLabel endLabel = new BranchLabel(this);
- if (syntheticFieldBinding != null) { // non interface case
- fieldAccess(Opcodes.OPC_getstatic, syntheticFieldBinding, null /* default declaringClass */);
- dup();
- ifnonnull(endLabel);
- pop();
- }
-
- /*
- * Macro for building a class descriptor object... using or not a field cache to store it into... this
- * sequence is responsible for building the actual class descriptor.
- *
- * If the fieldCache is set, then it is supposed to be the body of a synthetic access method factoring the
- * actual descriptor creation out of the invocation site (saving space). If the fieldCache is nil, then we
- * are dumping the bytecode on the invocation site, since we have no way to get a hand on the field cache to
- * do better.
- */
-
- // Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
-
- ExceptionLabel classNotFoundExceptionHandler = new ExceptionLabel(this,
- TypeBinding.NULL /* represents ClassNotFoundException */);
- classNotFoundExceptionHandler.placeStart();
- this.ldc(accessedType == TypeBinding.NULL ? "java.lang.Object" //$NON-NLS-1$
- : String.valueOf(accessedType.constantPoolName()).replace('/', '.'));
- invokeClassForName();
-
- /*
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565 if (accessedType == BaseTypes.NullBinding) {
- * this.ldc("java.lang.Object"); //$NON-NLS-1$ } else if (accessedType.isArrayType()) {
- * this.ldc(String.valueOf(accessedType.constantPoolName()).replace('/', '.')); } else { // we make it an
- * array type (to avoid class initialization) this.ldc("[L" +
- * String.valueOf(accessedType.constantPoolName()).replace('/', '.') + ";"); //$NON-NLS-1$//$NON-NLS-2$ }
- * this.invokeClassForName(); if (!accessedType.isArrayType()) { // extract the component type, which
- * doesn't initialize the class this.invokeJavaLangClassGetComponentType(); }
- */
- /*
- * We need to protect the runtime code from binary inconsistencies in case the accessedType is missing, the
- * ClassNotFoundException has to be converted into a NoClassDefError(old ex message), we thus need to build
- * an exception handler for this one.
- */
- classNotFoundExceptionHandler.placeEnd();
-
- if (syntheticFieldBinding != null) { // non interface case
- dup();
- fieldAccess(Opcodes.OPC_putstatic, syntheticFieldBinding, null /* default declaringClass */);
- }
- goto_(endLabel);
- int savedStackDepth = this.stackDepth;
- // Generate the body of the exception handler
- /*
- * ClassNotFoundException on stack -- the class literal could be doing more things on the stack, which means
- * that the stack may not be empty at this point in the above code gen. So we save its state and restart it
- * from 1.
- */
+ /* Macro for building a class descriptor object... using or not a field cache to store it into...
+ this sequence is responsible for building the actual class descriptor.
- pushExceptionOnStack(scope.getJavaLangClassNotFoundException());
- classNotFoundExceptionHandler.place();
+ If the fieldCache is set, then it is supposed to be the body of a synthetic access method
+ factoring the actual descriptor creation out of the invocation site (saving space).
+ If the fieldCache is nil, then we are dumping the bytecode on the invocation site, since
+ we have no way to get a hand on the field cache to do better. */
- // Transform the current exception, and repush and throw a
- // NoClassDefFoundError(ClassNotFound.getMessage())
- newNoClassDefFoundError();
- dup_x1();
- swap();
+ // Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
- // Retrieve the message from the old exception
- invokeThrowableGetMessage();
+ ExceptionLabel classNotFoundExceptionHandler = new ExceptionLabel(this, TypeBinding.NULL /*represents ClassNotFoundException*/);
+ classNotFoundExceptionHandler.placeStart();
+ this.ldc(accessedType == TypeBinding.NULL ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); //$NON-NLS-1$
+ invokeClassForName();
- // Send the constructor taking a message string as an argument
- invokeNoClassDefFoundErrorStringConstructor();
- athrow();
- endLabel.place();
- this.stackDepth = savedStackDepth;
+ /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565
+ if (accessedType == BaseTypes.NullBinding) {
+ this.ldc("java.lang.Object"); //$NON-NLS-1$
+ } else if (accessedType.isArrayType()) {
+ this.ldc(String.valueOf(accessedType.constantPoolName()).replace('/', '.'));
+ } else {
+ // we make it an array type (to avoid class initialization)
+ this.ldc("[L" + String.valueOf(accessedType.constantPoolName()).replace('/', '.') + ";"); //$NON-NLS-1$//$NON-NLS-2$
}
- }
-
- @Override
- public void generateOuterAccess(Object[] mappingSequence, ASTNode invocationSite, Binding target, Scope scope) {
- int currentPosition = this.position;
- super.generateOuterAccess(mappingSequence, invocationSite, target, scope);
- if (currentPosition == this.position) {
- // no code has been generate during outer access => no enclosing instance is available
- throw new AbortMethod(scope.referenceCompilationUnit().compilationResult, null);
+ this.invokeClassForName();
+ if (!accessedType.isArrayType()) { // extract the component type, which doesn't initialize the class
+ this.invokeJavaLangClassGetComponentType();
}
- }
-
- public ExceptionMarker[] getExceptionMarkers() {
- Set exceptionMarkerSet = this.exceptionMarkers;
- if (this.exceptionMarkers == null)
- return null;
- int size = exceptionMarkerSet.size();
- ExceptionMarker[] markers = new ExceptionMarker[size];
- int n = 0;
- for (Iterator iterator = exceptionMarkerSet.iterator(); iterator.hasNext();) {
- markers[n++] = (ExceptionMarker) iterator.next();
+ */
+ /* We need to protect the runtime code from binary inconsistencies
+ in case the accessedType is missing, the ClassNotFoundException has to be converted
+ into a NoClassDefError(old ex message), we thus need to build an exception handler for this one. */
+ classNotFoundExceptionHandler.placeEnd();
+
+ if (syntheticFieldBinding != null) { // non interface case
+ dup();
+ fieldAccess(Opcodes.OPC_putstatic, syntheticFieldBinding, null /* default declaringClass */);
}
- Arrays.sort(markers);
+ int fromPC = this.position;
+ goto_(endLabel);
+ int savedStackDepth = this.stackDepth;
+ // Generate the body of the exception handler
+ /* ClassNotFoundException on stack -- the class literal could be doing more things
+ on the stack, which means that the stack may not be empty at this point in the
+ above code gen. So we save its state and restart it from 1. */
+
+ pushExceptionOnStack(TypeBinding.NULL);/*represents ClassNotFoundException*/
+ classNotFoundExceptionHandler.place();
+
+ // Transform the current exception, and repush and throw a
+ // NoClassDefFoundError(ClassNotFound.getMessage())
+
+ newNoClassDefFoundError();
+ dup_x1();
+ swap();
+
+ // Retrieve the message from the old exception
+ invokeThrowableGetMessage();
+
+ // Send the constructor taking a message string as an argument
+ invokeNoClassDefFoundErrorStringConstructor();
+ athrow();
+ endLabel.place();
+ addStackMarker(fromPC, this.position);
+ this.stackDepth = savedStackDepth;
+ }
+}
+@Override
+public void generateOuterAccess(Object[] mappingSequence, ASTNode invocationSite, Binding target, Scope scope) {
+ int currentPosition = this.position;
+ super.generateOuterAccess(mappingSequence, invocationSite, target, scope);
+ if (currentPosition == this.position) {
+ // no code has been generate during outer access => no enclosing instance is available
+ throw new AbortMethod(scope.referenceCompilationUnit().compilationResult, null);
+ }
+}
+public ExceptionMarker[] getExceptionMarkers() {
+ Set exceptionMarkerSet = this.exceptionMarkers;
+ if (this.exceptionMarkers == null) return null;
+ int size = exceptionMarkerSet.size();
+ ExceptionMarker[] markers = new ExceptionMarker[size];
+ int n = 0;
+ for (Iterator iterator = exceptionMarkerSet.iterator(); iterator.hasNext(); ) {
+ markers[n++] = (ExceptionMarker) iterator.next();
+ }
+ Arrays.sort(markers);
// System.out.print('[');
// for (int n = 0; n < size; n++) {
// if (n != 0) System.out.print(',');
// System.out.print(positions[n]);
// }
// System.out.println(']');
- return markers;
- }
-
- public int[] getFramePositions() {
- Set set = this.framePositions.keySet();
- int size = set.size();
- int[] positions = new int[size];
- int n = 0;
- for (Iterator iterator = set.iterator(); iterator.hasNext();) {
- positions[n++] = ((Integer) iterator.next()).intValue();
- }
- Arrays.sort(positions);
+ return markers;
+}
+public int[] getFramePositions() {
+ Set set = this.framePositions.keySet();
+ int size = set.size();
+ int[] positions = new int[size];
+ int n = 0;
+ for (Iterator iterator = set.iterator(); iterator.hasNext(); ) {
+ positions[n++] = ((Integer) iterator.next()).intValue();
+ }
+ Arrays.sort(positions);
// System.out.print('[');
// for (int n = 0; n < size; n++) {
// if (n != 0) System.out.print(',');
// System.out.print(positions[n]);
// }
// System.out.println(']');
- return positions;
+ return positions;
+}
+public StackDepthMarker[] getStackDepthMarkers() {
+ if (this.stackDepthMarkers == null) return null;
+ int length = this.stackDepthMarkers.size();
+ if (length == 0) return null;
+ StackDepthMarker[] result = new StackDepthMarker[length];
+ this.stackDepthMarkers.toArray(result);
+ return result;
+}
+public StackMarker[] getStackMarkers() {
+ if (this.stackMarkers == null) return null;
+ int length = this.stackMarkers.size();
+ if (length == 0) return null;
+ StackMarker[] result = new StackMarker[length];
+ this.stackMarkers.toArray(result);
+ return result;
+}
+public boolean hasFramePositions() {
+ return this.framePositions.size() != 0;
+}
+@Override
+public void init(ClassFile targetClassFile) {
+ super.init(targetClassFile);
+ this.stateIndexesCounter = 0;
+ if (this.framePositions != null) {
+ this.framePositions.clear();
}
-
- public boolean hasFramePositions() {
- return this.framePositions.size() != 0;
+ if (this.exceptionMarkers != null) {
+ this.exceptionMarkers.clear();
}
-
- @Override
- public void init(ClassFile targetClassFile) {
- super.init(targetClassFile);
- this.stateIndexesCounter = 0;
- if (this.framePositions != null) {
- this.framePositions.clear();
- }
- if (this.exceptionMarkers != null) {
- this.exceptionMarkers.clear();
- }
- if (this.stackDepthMarkers != null) {
- this.stackDepthMarkers.clear();
- }
- if (this.stackMarkers != null) {
- this.stackMarkers.clear();
- }
+ if (this.stackDepthMarkers != null) {
+ this.stackDepthMarkers.clear();
}
-
- @Override
- public void initializeMaxLocals(MethodBinding methodBinding) {
- super.initializeMaxLocals(methodBinding);
- if (this.framePositions == null) {
- this.framePositions = new HashMap();
- } else {
- this.framePositions.clear();
- }
+ if (this.stackMarkers != null) {
+ this.stackMarkers.clear();
}
+}
- public void popStateIndex() {
- this.stateIndexesCounter--;
+@Override
+public void initializeMaxLocals(MethodBinding methodBinding) {
+ super.initializeMaxLocals(methodBinding);
+ if (this.framePositions == null) {
+ this.framePositions = new HashMap();
+ } else {
+ this.framePositions.clear();
}
-
- public void pushStateIndex(int naturalExitMergeInitStateIndex) {
- if (this.stateIndexes == null) {
- this.stateIndexes = new int[3];
- }
- int length = this.stateIndexes.length;
- if (length == this.stateIndexesCounter) {
- // resize
- System.arraycopy(this.stateIndexes, 0, (this.stateIndexes = new int[length * 2]), 0, length);
- }
- this.stateIndexes[this.stateIndexesCounter++] = naturalExitMergeInitStateIndex;
+}
+public void popStateIndex() {
+ this.stateIndexesCounter--;
+}
+public void pushStateIndex(int naturalExitMergeInitStateIndex) {
+ if (this.stateIndexes == null) {
+ this.stateIndexes = new int[3];
}
-
- @Override
- public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
- int index = this.visibleLocalsCount;
- loop: for (int i = 0; i < index; i++) {
- LocalVariableBinding localBinding = this.visibleLocals[i];
- if (localBinding != null && localBinding.initializationCount > 0) {
- boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
- if (!isDefinitelyAssigned) {
- if (this.stateIndexes != null) {
- for (int j = 0, max = this.stateIndexesCounter; j < max; j++) {
- if (isDefinitelyAssigned(scope, this.stateIndexes[j], localBinding)) {
- continue loop;
- }
+ int length = this.stateIndexes.length;
+ if (length == this.stateIndexesCounter) {
+ // resize
+ System.arraycopy(this.stateIndexes, 0, (this.stateIndexes = new int[length * 2]), 0, length);
+ }
+ this.stateIndexes[this.stateIndexesCounter++] = naturalExitMergeInitStateIndex;
+}
+@Override
+public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
+ int index = this.visibleLocalsCount;
+ loop : for (int i = 0; i < index; i++) {
+ LocalVariableBinding localBinding = this.visibleLocals[i];
+ if (localBinding != null && localBinding.initializationCount > 0) {
+ boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
+ if (!isDefinitelyAssigned) {
+ if (this.stateIndexes != null) {
+ for (int j = 0, max = this.stateIndexesCounter; j < max; j++) {
+ if (isDefinitelyAssigned(scope, this.stateIndexes[j], localBinding)) {
+ continue loop;
}
}
- localBinding.recordInitializationEndPC(this.position);
}
+ localBinding.recordInitializationEndPC(this.position);
}
}
}
-
- @Override
- public void reset(ClassFile givenClassFile) {
- super.reset(givenClassFile);
- this.stateIndexesCounter = 0;
- if (this.framePositions != null) {
- this.framePositions.clear();
- }
- if (this.exceptionMarkers != null) {
- this.exceptionMarkers.clear();
- }
- if (this.stackDepthMarkers != null) {
- this.stackDepthMarkers.clear();
- }
- if (this.stackMarkers != null) {
- this.stackMarkers.clear();
- }
- }
-
- @Override
- protected void writePosition(BranchLabel label) {
- super.writePosition(label);
- addFramePosition(label.position);
- }
-
- @Override
- protected void writePosition(BranchLabel label, int forwardReference) {
- super.writePosition(label, forwardReference);
- addFramePosition(label.position);
- }
-
- @Override
- protected void writeSignedWord(int pos, int value) {
- super.writeSignedWord(pos, value);
- addFramePosition(this.position);
- }
-
- @Override
- protected void writeWidePosition(BranchLabel label) {
- super.writeWidePosition(label);
- addFramePosition(label.position);
- }
-
- @Override
- public void areturn() {
- super.areturn();
- addFramePosition(this.position);
- }
-
- @Override
- public void ireturn() {
- super.ireturn();
- addFramePosition(this.position);
- }
-
- @Override
- public void lreturn() {
- super.lreturn();
- addFramePosition(this.position);
- }
-
- @Override
- public void freturn() {
- super.freturn();
- addFramePosition(this.position);
- }
-
- @Override
- public void dreturn() {
- super.dreturn();
- addFramePosition(this.position);
- }
-
- @Override
- public void return_() {
- super.return_();
- addFramePosition(this.position);
- }
-
- @Override
- public void athrow() {
- super.athrow();
- addFramePosition(this.position);
- }
-
- @Override
- public void pushExceptionOnStack(TypeBinding binding) {
- super.pushExceptionOnStack(binding);
- addExceptionMarker(this.position, binding);
- }
-
- @Override
- public void goto_(BranchLabel label) {
- super.goto_(label);
- addFramePosition(this.position);
+}
+@Override
+public void reset(ClassFile givenClassFile) {
+ super.reset(givenClassFile);
+ this.stateIndexesCounter = 0;
+ if (this.framePositions != null) {
+ this.framePositions.clear();
}
-
- @Override
- public void goto_w(BranchLabel label) {
- super.goto_w(label);
- addFramePosition(this.position);
+ if (this.exceptionMarkers != null) {
+ this.exceptionMarkers.clear();
}
-
- @Override
- public void resetInWideMode() {
- this.resetSecretLocals();
- super.resetInWideMode();
+ if (this.stackDepthMarkers != null) {
+ this.stackDepthMarkers.clear();
}
-
- @Override
- public void resetForCodeGenUnusedLocals() {
- this.resetSecretLocals();
- super.resetForCodeGenUnusedLocals();
+ if (this.stackMarkers != null) {
+ this.stackMarkers.clear();
}
-
- public void resetSecretLocals() {
- for (int i = 0, max = this.locals.length; i < max; i++) {
- LocalVariableBinding localVariableBinding = this.locals[i];
- if (localVariableBinding != null && localVariableBinding.isSecret()) {
- // all other locals are reinitialized inside the computation of their resolved positions
- localVariableBinding.resetInitializations();
- }
+}
+@Override
+protected void writePosition(BranchLabel label) {
+ super.writePosition(label);
+ addFramePosition(label.position);
+}
+@Override
+protected void writePosition(BranchLabel label, int forwardReference) {
+ super.writePosition(label, forwardReference);
+ addFramePosition(label.position);
+}
+@Override
+protected void writeSignedWord(int pos, int value) {
+ super.writeSignedWord(pos, value);
+ addFramePosition(this.position);
+}
+@Override
+protected void writeWidePosition(BranchLabel label) {
+ super.writeWidePosition(label);
+ addFramePosition(label.position);
+}
+@Override
+public void areturn() {
+ super.areturn();
+ addFramePosition(this.position);
+}
+@Override
+public void ireturn() {
+ super.ireturn();
+ addFramePosition(this.position);
+}
+@Override
+public void lreturn() {
+ super.lreturn();
+ addFramePosition(this.position);
+}
+@Override
+public void freturn() {
+ super.freturn();
+ addFramePosition(this.position);
+}
+@Override
+public void dreturn() {
+ super.dreturn();
+ addFramePosition(this.position);
+}
+@Override
+public void return_() {
+ super.return_();
+ addFramePosition(this.position);
+}
+@Override
+public void athrow() {
+ super.athrow();
+ addFramePosition(this.position);
+}
+@Override
+public void pushOnStack(TypeBinding binding) {
+ super.pushOnStack(binding);
+ addStackDepthMarker(this.position, 1, binding);
+}
+@Override
+public void pushExceptionOnStack(TypeBinding binding) {
+ super.pushExceptionOnStack(binding);
+ addExceptionMarker(this.position, binding);
+}
+@Override
+public void goto_(BranchLabel label) {
+ super.goto_(label);
+ addFramePosition(this.position);
+}
+@Override
+public void goto_w(BranchLabel label) {
+ super.goto_w(label);
+ addFramePosition(this.position);
+}
+@Override
+public void resetInWideMode() {
+ this.resetSecretLocals();
+ super.resetInWideMode();
+}
+@Override
+public void resetForCodeGenUnusedLocals() {
+ this.resetSecretLocals();
+ super.resetForCodeGenUnusedLocals();
+}
+public void resetSecretLocals() {
+ for (int i = 0, max = this.locals.length; i < max; i++) {
+ LocalVariableBinding localVariableBinding = this.locals[i];
+ if (localVariableBinding != null && localVariableBinding.isSecret()) {
+ // all other locals are reinitialized inside the computation of their resolved positions
+ localVariableBinding.resetInitializations();
}
}
}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java
index d3afd5ba1b..38c24a35f9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java
@@ -13,237 +13,234 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.codegen;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
-import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
public class VerificationTypeInfo {
/**
* The tag value representing top variable info
- *
* @since 3.2
*/
public static final int ITEM_TOP = 0;
/**
* The tag value representing integer variable info
- *
* @since 3.2
*/
public static final int ITEM_INTEGER = 1;
/**
* The tag value representing float variable info
- *
* @since 3.2
*/
public static final int ITEM_FLOAT = 2;
/**
* The tag value representing double variable info
- *
* @since 3.2
*/
public static final int ITEM_DOUBLE = 3;
/**
* The tag value representing long variable info
- *
* @since 3.2
*/
public static final int ITEM_LONG = 4;
/**
* The tag value representing null variable info
- *
* @since 3.2
*/
public static final int ITEM_NULL = 5;
/**
* The tag value representing uninitialized this variable info
- *
* @since 3.2
*/
public static final int ITEM_UNINITIALIZED_THIS = 6;
/**
* The tag value representing object variable info
- *
* @since 3.2
*/
public static final int ITEM_OBJECT = 7;
/**
* The tag value representing uninitialized variable info
- *
* @since 3.2
*/
public static final int ITEM_UNINITIALIZED = 8;
public int tag;
private int id;
- private TypeBinding binding;
- public int offset; // where the new opcode is used
- private List<TypeBinding> bindings;
-
- public VerificationTypeInfo(int tag, TypeBinding binding) {
- this(binding);
- this.tag = tag;
- }
-
- public VerificationTypeInfo(TypeBinding binding) {
- if (binding == null) return;
- this.id = binding.id;
- this.binding = binding;
- switch (binding.id) {
- case TypeIds.T_boolean:
- case TypeIds.T_byte:
- case TypeIds.T_char:
- case TypeIds.T_int:
- case TypeIds.T_short:
- this.tag = VerificationTypeInfo.ITEM_INTEGER;
- break;
- case TypeIds.T_float:
- this.tag = VerificationTypeInfo.ITEM_FLOAT;
- break;
- case TypeIds.T_long:
- this.tag = VerificationTypeInfo.ITEM_LONG;
- break;
- case TypeIds.T_double:
- this.tag = VerificationTypeInfo.ITEM_DOUBLE;
- break;
- case TypeIds.T_null:
- this.tag = VerificationTypeInfo.ITEM_NULL;
- break;
- default:
- this.tag = VerificationTypeInfo.ITEM_OBJECT;
- }
- }
-
- public void setBinding(TypeBinding binding) {
- final int typeBindingId = binding.id;
- this.id = typeBindingId;
- switch (typeBindingId) {
- case TypeIds.T_boolean:
- case TypeIds.T_byte:
- case TypeIds.T_char:
- case TypeIds.T_int:
- case TypeIds.T_short:
- this.tag = VerificationTypeInfo.ITEM_INTEGER;
- break;
- case TypeIds.T_float:
- this.tag = VerificationTypeInfo.ITEM_FLOAT;
- break;
- case TypeIds.T_long:
- this.tag = VerificationTypeInfo.ITEM_LONG;
- break;
- case TypeIds.T_double:
- this.tag = VerificationTypeInfo.ITEM_DOUBLE;
- break;
- case TypeIds.T_null:
- this.tag = VerificationTypeInfo.ITEM_NULL;
- break;
- default:
- this.tag = VerificationTypeInfo.ITEM_OBJECT;
- }
- }
-
- public int id() {
- return this.id;
- }
-
- @Override
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- switch (this.tag) {
- case VerificationTypeInfo.ITEM_UNINITIALIZED_THIS:
- buffer.append("uninitialized_this(").append(readableName()).append(")"); //$NON-NLS-1$//$NON-NLS-2$
- break;
- case VerificationTypeInfo.ITEM_UNINITIALIZED:
- buffer.append("uninitialized(").append(readableName()).append(")"); //$NON-NLS-1$//$NON-NLS-2$
- break;
- case VerificationTypeInfo.ITEM_OBJECT:
- buffer.append(readableName());
- break;
- case VerificationTypeInfo.ITEM_DOUBLE:
- buffer.append('D');
- break;
- case VerificationTypeInfo.ITEM_FLOAT:
- buffer.append('F');
- break;
- case VerificationTypeInfo.ITEM_INTEGER:
- buffer.append('I');
- break;
- case VerificationTypeInfo.ITEM_LONG:
- buffer.append('J');
- break;
- case VerificationTypeInfo.ITEM_NULL:
- buffer.append("null"); //$NON-NLS-1$
- break;
- case VerificationTypeInfo.ITEM_TOP:
- buffer.append("top"); //$NON-NLS-1$
- break;
- }
- return String.valueOf(buffer);
- }
-
- public VerificationTypeInfo duplicate() {
- VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo(this.tag, this.binding);
- verificationTypeInfo.offset = this.offset;
- return verificationTypeInfo;
- }
+ private char[] constantPoolName;
+ public int offset;
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof VerificationTypeInfo) {
- VerificationTypeInfo info1 = (VerificationTypeInfo) obj;
- return info1.tag == this.tag && CharOperation.equals(info1.constantPoolName(), constantPoolName());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return this.tag + this.id + this.binding.constantPoolName().length;
+private VerificationTypeInfo() {
+ // for duplication
+}
+public VerificationTypeInfo(int id, char[] constantPoolName) {
+ this(id, VerificationTypeInfo.ITEM_OBJECT, constantPoolName);
+}
+public VerificationTypeInfo(int id, int tag, char[] constantPoolName) {
+ this.id = id;
+ this.tag = tag;
+ this.constantPoolName = constantPoolName;
+}
+public VerificationTypeInfo(int tag, TypeBinding binding) {
+ this(binding);
+ this.tag = tag;
+}
+public VerificationTypeInfo(TypeBinding binding) {
+ this.id = binding.id;
+ switch(binding.id) {
+ case TypeIds.T_boolean :
+ case TypeIds.T_byte :
+ case TypeIds.T_char :
+ case TypeIds.T_int :
+ case TypeIds.T_short :
+ this.tag = VerificationTypeInfo.ITEM_INTEGER;
+ break;
+ case TypeIds.T_float :
+ this.tag = VerificationTypeInfo.ITEM_FLOAT;
+ break;
+ case TypeIds.T_long :
+ this.tag = VerificationTypeInfo.ITEM_LONG;
+ break;
+ case TypeIds.T_double :
+ this.tag = VerificationTypeInfo.ITEM_DOUBLE;
+ break;
+ case TypeIds.T_null :
+ this.tag = VerificationTypeInfo.ITEM_NULL;
+ break;
+ default:
+ this.tag = VerificationTypeInfo.ITEM_OBJECT;
+ this.constantPoolName = binding.constantPoolName();
}
-
- public char[] constantPoolName() {
- return this.binding.constantPoolName();
+}
+public void setBinding(TypeBinding binding) {
+ this.constantPoolName = binding.constantPoolName();
+ final int typeBindingId = binding.id;
+ this.id = typeBindingId;
+ switch(typeBindingId) {
+ case TypeIds.T_boolean :
+ case TypeIds.T_byte :
+ case TypeIds.T_char :
+ case TypeIds.T_int :
+ case TypeIds.T_short :
+ this.tag = VerificationTypeInfo.ITEM_INTEGER;
+ break;
+ case TypeIds.T_float :
+ this.tag = VerificationTypeInfo.ITEM_FLOAT;
+ break;
+ case TypeIds.T_long :
+ this.tag = VerificationTypeInfo.ITEM_LONG;
+ break;
+ case TypeIds.T_double :
+ this.tag = VerificationTypeInfo.ITEM_DOUBLE;
+ break;
+ case TypeIds.T_null :
+ this.tag = VerificationTypeInfo.ITEM_NULL;
+ break;
+ default:
+ this.tag = VerificationTypeInfo.ITEM_OBJECT;
}
-
- public char[] readableName() {
- return this.constantPoolName();
+}
+public int id() {
+ return this.id;
+}
+@Override
+public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ switch(this.tag) {
+ case VerificationTypeInfo.ITEM_UNINITIALIZED_THIS :
+ buffer.append("uninitialized_this(").append(readableName()).append(")"); //$NON-NLS-1$//$NON-NLS-2$
+ break;
+ case VerificationTypeInfo.ITEM_UNINITIALIZED :
+ buffer.append("uninitialized(").append(readableName()).append(")"); //$NON-NLS-1$//$NON-NLS-2$
+ break;
+ case VerificationTypeInfo.ITEM_OBJECT :
+ buffer.append(readableName());
+ break;
+ case VerificationTypeInfo.ITEM_DOUBLE :
+ buffer.append('D');
+ break;
+ case VerificationTypeInfo.ITEM_FLOAT :
+ buffer.append('F');
+ break;
+ case VerificationTypeInfo.ITEM_INTEGER :
+ buffer.append('I');
+ break;
+ case VerificationTypeInfo.ITEM_LONG :
+ buffer.append('J');
+ break;
+ case VerificationTypeInfo.ITEM_NULL :
+ buffer.append("null"); //$NON-NLS-1$
+ break;
+ case VerificationTypeInfo.ITEM_TOP :
+ buffer.append("top"); //$NON-NLS-1$
+ break;
}
-
- public void replaceWithElementType() {
- ArrayBinding arrayBinding = (ArrayBinding) this.binding;
- this.binding = arrayBinding.elementsType();
- this.id = this.binding.id;
+ return String.valueOf(buffer);
+}
+public VerificationTypeInfo duplicate() {
+ final VerificationTypeInfo verificationTypeInfo = new VerificationTypeInfo();
+ verificationTypeInfo.id = this.id;
+ verificationTypeInfo.tag = this.tag;
+ verificationTypeInfo.constantPoolName = this.constantPoolName;
+ verificationTypeInfo.offset = this.offset;
+ return verificationTypeInfo;
+}
+@Override
+public boolean equals(Object obj) {
+ if (obj instanceof VerificationTypeInfo) {
+ VerificationTypeInfo info1 = (VerificationTypeInfo) obj;
+ return info1.tag == this.tag && CharOperation.equals(info1.constantPoolName(), constantPoolName());
}
-
- public VerificationTypeInfo merge(VerificationTypeInfo verificationTypeInfo, Scope scope) {
- if (this.binding.isBaseType() && verificationTypeInfo.binding.isBaseType()) {
- return this;
- }
- if (!this.binding.equals(verificationTypeInfo.binding)) {
- if (this.bindings == null) {
- this.bindings = new ArrayList<TypeBinding>();
- this.bindings.add(this.binding);
- }
- this.bindings.add(verificationTypeInfo.binding);
- this.binding = scope.lowerUpperBound(this.bindings.toArray(new TypeBinding[this.bindings.size()]));
- if (this.binding != null) {
- this.id = this.binding.id;
- switch (this.id) {
- case TypeIds.T_null:
- this.tag = VerificationTypeInfo.ITEM_NULL;
- break;
- default:
- this.tag = VerificationTypeInfo.ITEM_OBJECT;
- }
- } else {
- this.binding = scope.getJavaLangObject();
- this.tag = VerificationTypeInfo.ITEM_OBJECT;
+ return false;
+}
+@Override
+public int hashCode() {
+ return this.tag + this.id + this.constantPoolName.length + this.offset;
+}
+public char[] constantPoolName() {
+ return this.constantPoolName;
+}
+public char[] readableName() {
+ return this.constantPoolName;
+}
+public void replaceWithElementType() {
+ if (this.constantPoolName[1] == 'L') {
+ this.constantPoolName = CharOperation.subarray(this.constantPoolName, 2, this.constantPoolName.length - 1);
+ } else {
+ this.constantPoolName = CharOperation.subarray(this.constantPoolName, 1, this.constantPoolName.length);
+ if (this.constantPoolName.length == 1) {
+ switch(this.constantPoolName[0]) {
+ case 'I' :
+ this.id = TypeIds.T_int;
+ break;
+ case 'B' :
+ this.id = TypeIds.T_byte;
+ break;
+ case 'S' :
+ this.id = TypeIds.T_short;
+ break;
+ case 'C' :
+ this.id = TypeIds.T_char;
+ break;
+ case 'J' :
+ this.id = TypeIds.T_long;
+ break;
+ case 'F' :
+ this.id = TypeIds.T_float;
+ break;
+ case 'D' :
+ this.id = TypeIds.T_double;
+ break;
+ case 'Z' :
+ this.id = TypeIds.T_boolean;
+ break;
+ case 'N' :
+ this.id = TypeIds.T_null;
+ break;
+ case 'V' :
+ this.id = TypeIds.T_void;
+ break;
}
}
- return this;
}
}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index b12939745a..5be2772bb6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -2839,16 +2839,6 @@ public abstract class Scope {
unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_CLONEABLE);
return unitScope.environment.getResolvedJavaBaseType(TypeConstants.JAVA_LANG_CLONEABLE, this);
}
- public final ReferenceBinding getJavaLangClassNotFoundException() {
- CompilationUnitScope unitScope = compilationUnitScope();
- unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_CLASSNOTFOUNDEXCEPTION);
- return unitScope.environment.getResolvedJavaBaseType(TypeConstants.JAVA_LANG_CLASSNOTFOUNDEXCEPTION, this);
- }
- public final ReferenceBinding getJavaLangNoSuchFieldError() {
- CompilationUnitScope unitScope = compilationUnitScope();
- unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_NOSUCHFIELDERROR);
- return unitScope.environment.getResolvedJavaBaseType(TypeConstants.JAVA_LANG_NOSUCHFIELDERROR, this);
- }
public final ReferenceBinding getJavaLangEnum() {
CompilationUnitScope unitScope = compilationUnitScope();
unitScope.recordQualifiedReference(TypeConstants.JAVA_LANG_ENUM);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index 8ad5e710c3..f3387f47fc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -144,7 +144,6 @@ public interface TypeConstants {
char[][] JAVA_LANG_ASSERTIONERROR = {JAVA, LANG, "AssertionError".toCharArray()}; //$NON-NLS-1$
char[][] JAVA_LANG_CLASS = {JAVA, LANG, "Class".toCharArray()}; //$NON-NLS-1$
char[][] JAVA_LANG_CLASSNOTFOUNDEXCEPTION = {JAVA, LANG, "ClassNotFoundException".toCharArray()}; //$NON-NLS-1$
- char[][] JAVA_LANG_NOSUCHFIELDERROR = {JAVA, LANG, "NoSuchFieldError".toCharArray()}; //$NON-NLS-1$
char[][] JAVA_LANG_CLONEABLE = {JAVA, LANG, "Cloneable".toCharArray()}; //$NON-NLS-1$
char[][] JAVA_LANG_ENUM = {JAVA, LANG, "Enum".toCharArray()}; //$NON-NLS-1$
char[][] JAVA_LANG_EXCEPTION = {JAVA, LANG, "Exception".toCharArray()}; //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
index 920630b2c9..ee4ab7141f 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
@@ -62,7 +62,7 @@ public void generateReturnBytecode(CodeStream codeStream) {
codeStream.return_();
}
@Override
-public void generateStoreSaveValueIfNecessary(Scope scope, CodeStream codeStream){
+public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
// push receiver
codeStream.aload_0();
@@ -73,7 +73,7 @@ public void generateStoreSaveValueIfNecessary(Scope scope, CodeStream codeStream
codeStream.aconst_null();
// void.class
- codeStream.generateClassLiteralAccessForType(scope, TypeBinding.VOID, null);
+ codeStream.generateClassLiteralAccessForType(TypeBinding.VOID, null);
} else {
// swap with expression
int valueTypeID = this.expression.resolvedType.id;
@@ -90,7 +90,7 @@ public void generateStoreSaveValueIfNecessary(Scope scope, CodeStream codeStream
}
// generate the expression type
- codeStream.generateClassLiteralAccessForType(scope, this.expression.resolvedType, null);
+ codeStream.generateClassLiteralAccessForType(this.expression.resolvedType, null);
}
// generate the invoke virtual to "setResult(Object,Class)"

Back to the top