Lines 41-47
Link Here
|
41 |
} |
41 |
} |
42 |
|
42 |
|
43 |
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, |
43 |
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, |
44 |
FlowInfo flowInfo) { |
44 |
FlowInfo flowInfo) { |
|
|
45 |
int initialComplaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0 ? Statement.COMPLAINED_FAKE_REACHABLE : Statement.NOT_COMPLAINED; |
45 |
Constant cst = this.condition.optimizedBooleanConstant(); |
46 |
Constant cst = this.condition.optimizedBooleanConstant(); |
46 |
boolean isConditionOptimizedTrue = cst != Constant.NotAConstant && cst.booleanValue() == true; |
47 |
boolean isConditionOptimizedTrue = cst != Constant.NotAConstant && cst.booleanValue() == true; |
47 |
boolean isConditionOptimizedFalse = cst != Constant.NotAConstant && cst.booleanValue() == false; |
48 |
boolean isConditionOptimizedFalse = cst != Constant.NotAConstant && cst.booleanValue() == false; |
Lines 53-61
Link Here
|
53 |
FlowInfo trueFlowInfo = flowInfo.initsWhenTrue().copy(); |
54 |
FlowInfo trueFlowInfo = flowInfo.initsWhenTrue().copy(); |
54 |
if (isConditionOptimizedFalse) { |
55 |
if (isConditionOptimizedFalse) { |
55 |
if ((mode & FlowInfo.UNREACHABLE) == 0) { |
56 |
if ((mode & FlowInfo.UNREACHABLE) == 0) { |
56 |
currentScope.problemReporter().fakeReachable(this.valueIfTrue); |
|
|
57 |
trueFlowInfo.setReachMode(FlowInfo.UNREACHABLE); |
57 |
trueFlowInfo.setReachMode(FlowInfo.UNREACHABLE); |
58 |
} |
58 |
} |
|
|
59 |
if (!isKnowDeadCodePattern(this.condition) || currentScope.compilerOptions().reportDeadCodeInTrivialIfStatement) { |
60 |
this.valueIfTrue.complainIfUnreachable(trueFlowInfo, currentScope, initialComplaintLevel); |
61 |
} |
59 |
} |
62 |
} |
60 |
this.trueInitStateIndex = currentScope.methodScope().recordInitializationStates(trueFlowInfo); |
63 |
this.trueInitStateIndex = currentScope.methodScope().recordInitializationStates(trueFlowInfo); |
61 |
trueFlowInfo = this.valueIfTrue.analyseCode(currentScope, flowContext, trueFlowInfo); |
64 |
trueFlowInfo = this.valueIfTrue.analyseCode(currentScope, flowContext, trueFlowInfo); |
Lines 64-72
Link Here
|
64 |
FlowInfo falseFlowInfo = flowInfo.initsWhenFalse().copy(); |
67 |
FlowInfo falseFlowInfo = flowInfo.initsWhenFalse().copy(); |
65 |
if (isConditionOptimizedTrue) { |
68 |
if (isConditionOptimizedTrue) { |
66 |
if ((mode & FlowInfo.UNREACHABLE) == 0) { |
69 |
if ((mode & FlowInfo.UNREACHABLE) == 0) { |
67 |
currentScope.problemReporter().fakeReachable(this.valueIfFalse); |
|
|
68 |
falseFlowInfo.setReachMode(FlowInfo.UNREACHABLE); |
70 |
falseFlowInfo.setReachMode(FlowInfo.UNREACHABLE); |
69 |
} |
71 |
} |
|
|
72 |
if (!isKnowDeadCodePattern(this.condition) || currentScope.compilerOptions().reportDeadCodeInTrivialIfStatement) { |
73 |
this.valueIfFalse.complainIfUnreachable(falseFlowInfo, currentScope, initialComplaintLevel); |
74 |
} |
70 |
} |
75 |
} |
71 |
this.falseInitStateIndex = currentScope.methodScope().recordInitializationStates(falseFlowInfo); |
76 |
this.falseInitStateIndex = currentScope.methodScope().recordInitializationStates(falseFlowInfo); |
72 |
falseFlowInfo = this.valueIfFalse.analyseCode(currentScope, flowContext, falseFlowInfo); |
77 |
falseFlowInfo = this.valueIfFalse.analyseCode(currentScope, flowContext, falseFlowInfo); |