Bug 558844 - ? : Operator causes java.lang.VerifyError: Inconsistent
stackmap frames

Change-Id: I8d871ef103e1ac2098fb393b2738c2a4f3223e9f
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
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 ce9e6cf..ed924e0 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 @@
             },
 			"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 803240d..42b9d26 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 @@
 	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 c2ef996..a0fc8e2 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 @@
 		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 @@
 		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 d3afd5b..7f3be5a 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 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() {