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

(-)compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java (-1 / +2 lines)
Lines 110-116 Link Here
110
				(loopingContext.initsOnBreak.tagBits &
110
				(loopingContext.initsOnBreak.tagBits &
111
					FlowInfo.UNREACHABLE) != 0 ?
111
					FlowInfo.UNREACHABLE) != 0 ?
112
					loopingContext.initsOnBreak :
112
					loopingContext.initsOnBreak :
113
					flowInfo.addInitializationsFrom(loopingContext.initsOnBreak), // recover upstream null info
113
					flowInfo.unconditionalCopy().addInitializationsFrom(loopingContext.initsOnBreak), 
114
						// recover upstream null info
114
				isConditionOptimizedTrue,
115
				isConditionOptimizedTrue,
115
				(condInfo.tagBits & FlowInfo.UNREACHABLE) == 0 ?
116
				(condInfo.tagBits & FlowInfo.UNREACHABLE) == 0 ?
116
						flowInfo.addInitializationsFrom(condInfo.initsWhenFalse()) : condInfo, 
117
						flowInfo.addInitializationsFrom(condInfo.initsWhenFalse()) : condInfo, 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java (+25 lines)
Lines 664-669 Link Here
664
		"The local variable x may not have been initialized\n" + 
664
		"The local variable x may not have been initialized\n" + 
665
		"----------\n");
665
		"----------\n");
666
}
666
}
667
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=132974
668
public void test024() {
669
	this.runNegativeTest(
670
		new String[] {
671
			"X.java",
672
			"public class X {\n" + 
673
			"  public void foo(boolean b) {\n" + 
674
			"    final Object l;\n" + 
675
			"    do {\n" + 
676
			"      if (b) {\n" + 
677
			"        l = new Object();\n" + 
678
			"        break;\n" + 
679
			"      }\n" + 
680
			"    } while (false);\n" + 
681
			"    l.toString();\n" + 
682
			"  }\n" + 
683
			"}"
684
		},
685
		"----------\n" + 
686
		"1. ERROR in X.java (at line 10)\n" + 
687
		"	l.toString();\n" + 
688
		"	^\n" + 
689
		"The local variable l may not have been initialized\n" + 
690
		"----------\n");
691
}
667
public static Class testClass() {
692
public static Class testClass() {
668
	return FlowAnalysisTest.class;
693
	return FlowAnalysisTest.class;
669
}
694
}

Return to bug 132974