Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thomann2020-01-06 20:36:43 +0000
committerAndrey Loskutov2020-01-06 20:56:00 +0000
commitf6ca35bc46a58901d24a836b1dc77576044bdb13 (patch)
tree2e560e63b3aec5f028b1bebc6dcf61d9aa836dd7
parent256ddbc372ca0b473cf9e1359cd51a98fe2f20d9 (diff)
downloadeclipse.jdt.core-f6ca35bc46a58901d24a836b1dc77576044bdb13.tar.gz
eclipse.jdt.core-f6ca35bc46a58901d24a836b1dc77576044bdb13.tar.xz
eclipse.jdt.core-f6ca35bc46a58901d24a836b1dc77576044bdb13.zip
Bug 558844 - ? : Operator causes java.lang.VerifyError: Inconsistent
stackmap frames Change-Id: I8d871ef103e1ac2098fb393b2738c2a4f3223e9f 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/StackMapAttributeTest.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java6
4 files changed, 39 insertions, 6 deletions
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 ce9e6cf0d0..ed924e0d97 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
@@ -8830,4 +8830,35 @@ public class StackMapAttributeTest extends AbstractRegressionTest {
},
"SUCCESS");
}
+ public void test558844() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " \n" +
+ " public static void main( String[] args ) {\n" +
+ " System.out.println(new X().getText());\n" +
+ " }\n" +
+ "\n" +
+ " public String getText() {\n" +
+ " Long lValue1 = getValue1();\n" +
+ " Long lValue2 = getValue2();\n" +
+ " return ( isValue1() ? \"\" : ( lValue1 == null ? \"\" : lValue1.toString() ) + \"-\" ) + ( lValue2 == null ? \"\" : lValue2.toString() );\n" +
+ " }\n" +
+ "\n" +
+ " private Long getValue1() {\n" +
+ " return Long.valueOf( 1 );\n" +
+ " }\n" +
+ "\n" +
+ " private Long getValue2() {\n" +
+ " return Long.valueOf( 1 );\n" +
+ " }\n" +
+ "\n" +
+ " private boolean isValue1() {\n" +
+ " return false;\n" +
+ " }\n" +
+ "}",
+ },
+ "1-1");
+ }
}
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..42b9d2600a 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
@@ -6059,12 +6059,12 @@ public void multianewarray(
this.bCodeStream[this.classFileOffset++] = (byte) dimensions;
}
-// We didn't call it new, because there is a conflit with the new keyword
+// We didn't call it new, because there is a conflict with the new keyword
public void new_(TypeBinding typeBinding) {
this.new_(null, typeBinding);
}
-// We didn't call it new, because there is a conflit with the new keyword
+// We didn't call it new, because there is a conflict with the new keyword
public void new_(TypeReference typeReference, TypeBinding typeBinding) {
this.countLabels = 0;
this.stackDepth++;
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..a0fc8e25b3 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
@@ -129,7 +129,7 @@ public class StackMapFrame {
return result;
}
- private VerificationTypeInfo getCachedValue(Map<VerificationTypeInfo, VerificationTypeInfo> cache, VerificationTypeInfo value) {
+ private static 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) {
@@ -393,7 +393,7 @@ public class StackMapFrame {
return 0;
}
- private boolean equals(VerificationTypeInfo info, VerificationTypeInfo info2) {
+ private static boolean equals(VerificationTypeInfo info, VerificationTypeInfo info2) {
if (info == null) {
return info2 == null;
}
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..7f3be5a786 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
@@ -195,14 +195,16 @@ public class VerificationTypeInfo {
public boolean equals(Object obj) {
if (obj instanceof VerificationTypeInfo) {
VerificationTypeInfo info1 = (VerificationTypeInfo) obj;
- return info1.tag == this.tag && CharOperation.equals(info1.constantPoolName(), constantPoolName());
+ return info1.tag == this.tag
+ && info1.offset == this.offset
+ && CharOperation.equals(info1.constantPoolName(), constantPoolName());
}
return false;
}
@Override
public int hashCode() {
- return this.tag + this.id + this.binding.constantPoolName().length;
+ return this.tag + this.offset + CharOperation.hashCode(constantPoolName());
}
public char[] constantPoolName() {

Back to the top