View | Details | Raw Unified | Return to bug 178895
Collapse All | Expand All

(-)org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java (+1 lines)
Lines 96-101 Link Here
96
				continueLabel, scope);
96
				continueLabel, scope);
97
		UnconditionalFlowInfo actionInfo = 
97
		UnconditionalFlowInfo actionInfo = 
98
			condInfo.nullInfoLessUnconditionalCopy();
98
			condInfo.nullInfoLessUnconditionalCopy();
99
		actionInfo.markAsDefinitelyUnknown(this.elementVariable.binding);
99
		FlowInfo exitBranch;
100
		FlowInfo exitBranch;
100
		if (!(action == null || (action.isEmptyBlock() 
101
		if (!(action == null || (action.isEmptyBlock() 
101
		        	&& currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3))) {
102
		        	&& currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3))) {
(-)org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java (-1 / +26 lines)
Lines 6490-6496 Link Here
6490
// suggested by https://bugs.eclipse.org/bugs/show_bug.cgi?id=127570
6490
// suggested by https://bugs.eclipse.org/bugs/show_bug.cgi?id=127570
6491
// the issue is that we cannot do less than full aliasing analysis to
6491
// the issue is that we cannot do less than full aliasing analysis to
6492
// catch this one
6492
// catch this one
6493
// TODO (maxime) reconsider when/if we bring full aliasing in
6493
// PREMATURE (maxime) reconsider when/if we bring full aliasing in
6494
public void _test0738_for_unknown_protection() {
6494
public void _test0738_for_unknown_protection() {
6495
	this.runConformTest(
6495
	this.runConformTest(
6496
		new String[] {
6496
		new String[] {
Lines 6515-6520 Link Here
6515
		"");
6515
		"");
6516
}
6516
}
6517
6517
6518
// null analysis -- for
6519
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=178895
6520
public void test0739_for() {
6521
	if (COMPLIANCE_1_5.compareTo(this.complianceLevel) <= 0) {
6522
		this.runConformTest(
6523
			new String[] {
6524
				"X.java",
6525
				"import java.util.List;\n" +
6526
				"public class X {\n" + 
6527
				"  void foo(List<Object> l, boolean b) {\n" +
6528
				"    for (Object o : l) {\n" +
6529
				"      if (b) {\n" +
6530
				"        if (o != null) {\n" +
6531
				"          return;\n" +
6532
				"        }\n" +
6533
				"      } else {\n" + 
6534
				"        o.toString();\n" +
6535
				"      }\n" +
6536
				"    }\n" +
6537
				"  }\n" + 
6538
				"}\n"},
6539
			"");
6540
	}
6541
}
6542
6518
// null analysis -- switch
6543
// null analysis -- switch
6519
public void test0800_switch() {
6544
public void test0800_switch() {
6520
	this.runConformTest(
6545
	this.runConformTest(

Return to bug 178895