diff options
author | Jay Arthanareeswaran | 2021-06-03 16:21:49 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2021-06-09 05:49:54 +0000 |
commit | 14a49912f4619af22219949b6c07b2e2758a32b5 (patch) | |
tree | 1992bdb6a0ad3f9575cf0ddb57681b3a18f3f51f | |
parent | 0fc92c07cc21c7828eda0293e01fda98392e50b8 (diff) | |
download | eclipse.jdt.core-R4_20_maintenance.tar.gz eclipse.jdt.core-R4_20_maintenance.tar.xz eclipse.jdt.core-R4_20_maintenance.zip |
Bug 572431 - Lef out scenarioS4_20_0_RC2aR4_20I20210611-1600I20210610-1250I20210610-1220I20210610-0400I20210609-0520I20210609-0400I20210609-0220R4_20_maintenance
Change-Id: I1cc9e153e9e79de32e8dbe1412daf048371f2875
Also-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/181658
Tested-by: JDT Bot <jdt-bot@eclipse.org>
Reviewed-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
2 files changed, 27 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java index bcb28a1428..36c96df9ea 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java @@ -3812,4 +3812,30 @@ public class PatternMatching16Test extends AbstractRegressionTest { options); } + public void testBug572431_6() { + Map<String, String> options = getCompilerOptions(false); + runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " static public void something () {\n" + + " boolean bool = true;\n" + + " Object object = null;\n" + + " for (int i = 0; i < 10; i++) {\n" + + " if (object instanceof String string) {\n" + + " System.out.println(i);\n" + + " } else if (bool) {\n" + + " if (i == 4) continue;\n" + + " System.out.println(i);\n" + + " }\n" + + " }\n" + + " }\n" + + " static public void main (String[] args) throws Exception {\n" + + " }\n" + + "}", + }, + "", + options); + + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java index 2a8745f271..e4d0bcedff 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java @@ -74,7 +74,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context - flowInfo = FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); + flowInfo = FlowInfo.conditional(initsWhenTrue.copy(), flowInfo.copy()); } else if (this.expression instanceof Reference) { if (currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); |