mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Flush canonicalized variable if requested one not found
Fixes IDEA-207441 False-positive "variable is always null" on linked-list like data structure
This commit is contained in:
+6
-1
@@ -1530,7 +1530,12 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
private void removeEquivalence(DfaValue var) {
|
||||
int varID = var.getID();
|
||||
Integer varClassIndex = myIdToEqClassesIndices.get(varID);
|
||||
if (varClassIndex == null) return;
|
||||
if (varClassIndex == null) {
|
||||
var = canonicalize(var);
|
||||
varID = var.getID();
|
||||
varClassIndex = myIdToEqClassesIndices.get(varID);
|
||||
if (varClassIndex == null) return;
|
||||
}
|
||||
|
||||
EqClass varClass = myEqClasses.get(varClassIndex);
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class IntHashMap {
|
||||
|
||||
public void minTest() {
|
||||
initEntries();
|
||||
|
||||
for (Entry entry : table) {
|
||||
if (entry != null) {
|
||||
Entry tmp = entry;
|
||||
Entry tmpNext;
|
||||
|
||||
while (tmp != null) {
|
||||
tmpNext = tmp.next;
|
||||
tmp.next = null;
|
||||
tmp = tmpNext;
|
||||
System.out.println("tmpNext " + ((tmpNext == null) ? "is null" : "is not null"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Entry[] table = new Entry[16];
|
||||
|
||||
private class Entry {
|
||||
@Nullable Entry next;
|
||||
}
|
||||
|
||||
|
||||
private void initEntries() {
|
||||
table[0] = new Entry();
|
||||
table[0].next = new Entry();
|
||||
|
||||
table[1] = new Entry();
|
||||
|
||||
table[3] = new Entry();
|
||||
|
||||
table[5] = new Entry();
|
||||
table[5].next = new Entry();
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
IntHashMap map = new IntHashMap();
|
||||
map.minTest();
|
||||
}
|
||||
}
|
||||
@@ -214,6 +214,7 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase {
|
||||
public void testPrimitiveGetters() { doTest(); }
|
||||
public void testUnknownOnStack() { doTest(); }
|
||||
public void testMapUpdateInlining() { doTestWithCustomAnnotations(); }
|
||||
public void testHashMapImplementation() { doTest(); }
|
||||
|
||||
public void testOptionalTooComplex() { doTest(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user