View | Details | Raw Unified | Return to bug 200158 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java (-1 / +1 lines)
Lines 1364-1370 Link Here
1364
// labeled loop
1364
// labeled loop
1365
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=200158
1365
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=200158
1366
// contrast this with test049
1366
// contrast this with test049
1367
public void _test048() {
1367
public void test048() {
1368
	runTest(
1368
	runTest(
1369
		new String[] {
1369
		new String[] {
1370
			"X.java",
1370
			"X.java",
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java (-20 / +17 lines)
Lines 51-76 Link Here
51
		} else {
51
		} else {
52
			LabelFlowContext labelContext;
52
			LabelFlowContext labelContext;
53
			FlowInfo statementInfo, mergedInfo;
53
			FlowInfo statementInfo, mergedInfo;
54
			if (((statementInfo = statement
54
			statementInfo = statement.analyseCode(
55
					.analyseCode(
55
				currentScope,
56
						currentScope,
56
				(labelContext =
57
						(labelContext =
57
					new LabelFlowContext(
58
							new LabelFlowContext(
58
						flowContext,
59
								flowContext,
59
						this,
60
								this,
60
						label,
61
								label,
61
						(targetLabel = new BranchLabel()),
62
								(targetLabel = new BranchLabel()),
62
						currentScope)),
63
								currentScope)),
63
				flowInfo);
64
						flowInfo)).tagBits & FlowInfo.UNREACHABLE) != 0) {
64
			boolean reinjectNullInfo = (statementInfo.tagBits & FlowInfo.UNREACHABLE) != 0 &&
65
				if ((labelContext.initsOnBreak.tagBits & FlowInfo.UNREACHABLE) == 0) {
65
				(labelContext.initsOnBreak.tagBits & FlowInfo.UNREACHABLE) == 0;
66
					// an embedded loop has had no chance to reinject forgotten null info
66
			mergedInfo = statementInfo.mergedWith(labelContext.initsOnBreak);
67
					mergedInfo = flowInfo.unconditionalCopy().
67
			if (reinjectNullInfo) {
68
						addInitializationsFrom(labelContext.initsOnBreak);
68
				// an embedded loop has had no chance to reinject forgotten null info
69
				} else {
69
				((UnconditionalFlowInfo)mergedInfo).addInitializationsFrom(flowInfo.unconditionalFieldLessCopy()).
70
					mergedInfo = labelContext.initsOnBreak;
70
					addInitializationsFrom(labelContext.initsOnBreak.unconditionalFieldLessCopy());
71
				}
72
			} else {
73
				mergedInfo = statementInfo.mergedWith(labelContext.initsOnBreak);
74
			}
71
			}
75
			mergedInitStateIndex =
72
			mergedInitStateIndex =
76
				currentScope.methodScope().recordInitializationStates(mergedInfo);
73
				currentScope.methodScope().recordInitializationStates(mergedInfo);

Return to bug 200158