diff options
author | Stephan Herrmann | 2012-10-18 17:29:36 +0000 |
---|---|---|
committer | Stephan Herrmann | 2012-11-15 13:16:32 +0000 |
commit | 897917a9c4d05a0c86bc6c8df155949d1c5640c7 (patch) | |
tree | 142eacb2cf3bb11eaebea4cd0cf2728911e50ae7 | |
parent | aff037e4075d974a1198e8a25c9e7f07acc35fc1 (diff) | |
download | eclipse.jdt.core-897917a9c4d05a0c86bc6c8df155949d1c5640c7.tar.gz eclipse.jdt.core-897917a9c4d05a0c86bc6c8df155949d1c5640c7.tar.xz eclipse.jdt.core-897917a9c4d05a0c86bc6c8df155949d1c5640c7.zip |
Bug 391517 - java.lang.VerifyError on code that runs correctly in
Eclipse 3.7 and eclipse 3.6
2 files changed, 40 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java index 7c02b9dfd8..97e02afa2d 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java @@ -12,6 +12,7 @@ * bug 349326 - [1.7] new warning for missing try-with-resources * bug 360328 - [compiler][null] detect null problems in nested code (local class inside a loop) * bug 383690 - [compiler] location of error re uninitialized final field should be aligned + * bug 391517 - java.lang.VerifyError on code that runs correctly in Eclipse 3.7 and eclipse 3.6 *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -2603,6 +2604,41 @@ public void testBug380750() { }, ""); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=391517 +// java.lang.VerifyError on code that runs correctly in Eclipse 3.7 and eclipse 3.6 +public void testBug391517() { + this.runConformTest( + new String[] { + "X.java", + "import java.io.PrintWriter;\n" + + "\n" + + "public class X {\n" + + "\n" + + " private static final int CONSTANT = 0;\n" + + "\n" + + " public static void main(String[] args) {\n" + + " // TODO Auto-generated method stub\n" + + "\n" + + " }\n" + + "\n" + + " static void addStackTrace(String prefix) {\n" + + " if (CONSTANT == 0) {\n" + + " return;\n" + + " }\n" + + " PrintWriter pw = null;\n" + + " new Exception().printStackTrace(pw);\n" + + " if (bar() == null) {\n" + + " System.out.println();\n" + + " }\n" + + " }\n" + + "\n" + + " static Object bar() {\n" + + " return null;\n" + + " }\n" + + "}" + }, + ""); +} public static Class testClass() { return FlowAnalysisTest.class; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java index b176b9bcc1..9939437185 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java @@ -7,7 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Stephan Herrmann - Contribution for bug 332637 - Dead Code detection removing code that isn't dead + * Stephan Herrmann - Contributions for + * bug 332637 - Dead Code detection removing code that isn't dead + * bug 391517 - java.lang.VerifyError on code that runs correctly in Eclipse 3.7 and eclipse 3.6 *******************************************************************************/ package org.eclipse.jdt.internal.compiler.flow; @@ -27,6 +29,7 @@ ConditionalFlowInfo(FlowInfo initsWhenTrue, FlowInfo initsWhenFalse){ this.initsWhenTrue = initsWhenTrue; this.initsWhenFalse = initsWhenFalse; + this.tagBits = initsWhenTrue.tagBits & initsWhenFalse.tagBits & UNREACHABLE; } public FlowInfo addInitializationsFrom(FlowInfo otherInits) { |