ControlFlowAnalyzer: repeat unboxing for every case label if necessary

Without this it was possible (at least on the incorrect code) that boxed and unboxed classes for the same value get united, which in turn caused repeating entry in DfaMemoryStateImpl#myIdToEqClassesIndices, which could cause NPE when performing successive flush for given variable.
Now we throw directly at classes unification attempt to catch illegal state earlier
Fixes EA-118152 - IAE: EqClass.$$$reportNull$$$
This commit is contained in:
Tagir Valeev
2018-07-12 13:07:16 +07:00
parent 7730b97ee4
commit 583f188ef6
5 changed files with 29 additions and 2 deletions
@@ -0,0 +1,20 @@
public enum Test {
VALUE;
void test() {
Integer code = getCode();
switch (code) {
case VALUE.value()<EOLError descr="':' expected"></EOLError>
}
if (code == VALUE.value()) {
getCode();
}
}
int value() {
return ordinal();
}
public native Integer getCode();
}
@@ -96,6 +96,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
public void testNotEqualsDoesntImplyNotNullity() { doTest(); }
public void testEqualsEnumConstant() { doTest(); }
public void testSwitchEnumConstant() { doTest(); }
public void testIncompleteSwitchEnum() { doTest(); }
public void testEnumConstantNotNull() { doTest(); }
public void testCheckEnumConstantConstructor() { doTest(); }
public void testCompareToEnumConstant() { doTest(); }