dfa: don't forget facts coming from boxed booleans after they're flushed

This commit is contained in:
peter
2014-09-23 18:42:57 +02:00
parent 4636b7d9b9
commit 66e2d53805
3 changed files with 23 additions and 1 deletions
@@ -705,7 +705,10 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
}
DfaBoxedValue.Factory boxedFactory = myFactory.getBoxedFactory();
return applyRelation(boxedFactory.createUnboxed(dfaLeft), boxedFactory.createUnboxed(dfaRight), negated);
DfaValue unboxedLeft = boxedFactory.createUnboxed(dfaLeft);
DfaValue unboxedRight = boxedFactory.createUnboxed(dfaRight);
return applyRelation(unboxedLeft, unboxedRight, negated) &&
checkCompareWithBooleanLiteral(unboxedLeft, unboxedRight, negated);
}
private boolean checkCompareWithBooleanLiteral(DfaValue dfaLeft, DfaValue dfaRight, boolean negated) {
@@ -716,6 +719,9 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
if (!applyRelation(dfaLeft, negVal, !negated)) {
return false;
}
if (!applyRelation(dfaLeft.createNegated(), negVal, negated)) {
return false;
}
}
}
return true;
@@ -35,5 +35,11 @@
<line>51</line>
<description>Condition &lt;code&gt;o&lt;/code&gt; at the left side of assignment expression is always &lt;code&gt;false&lt;/code&gt;. Can be simplified.</description>
</problem>
<problem>
<file>Test.java</file>
<line>62</line>
<description>Condition &lt;code&gt;o&lt;/code&gt; is always &lt;code&gt;true&lt;/code&gt;</description>
</problem>
</problems>
@@ -52,4 +52,14 @@ public class S {
if (o) {
}
}
public void flushOriginal(boolean b){
boolean o;
{
Boolean c = Boolean.FALSE;
o = !c;
}
if (o) {
}
}
}