mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[r=peter] dfa regression. Even finals must be flashed when they leave their declaration scope
This commit is contained in:
@@ -58,4 +58,6 @@ public interface DfaMemoryState {
|
||||
boolean canBeNaN(DfaValue dfaValue);
|
||||
|
||||
boolean isNotNull(DfaVariableValue dfaVar);
|
||||
|
||||
void flushVariableOutOfScope(DfaVariableValue variable);
|
||||
}
|
||||
|
||||
@@ -691,6 +691,12 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
doFlash((DfaVariableValue)variable.createNegated());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushVariableOutOfScope(DfaVariableValue variable) {
|
||||
doFlash(variable);
|
||||
doFlash((DfaVariableValue)variable.createNegated());
|
||||
}
|
||||
|
||||
private void doFlash(DfaVariableValue variable) {
|
||||
final int id = variable.getID();
|
||||
int size = myEqClasses.size();
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class InstructionVisitor {
|
||||
public DfaInstructionState[] visitFlushVariable(FlushVariableInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
|
||||
final DfaVariableValue variable = instruction.getVariable();
|
||||
if (variable != null) {
|
||||
memState.flushVariable(variable);
|
||||
memState.flushVariableOutOfScope(variable);
|
||||
} else {
|
||||
memState.flushFields(runner);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems/>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
public class AAA {
|
||||
public static void main(String[] args) {
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
final String element = args[i];
|
||||
|
||||
if (i == 1) {
|
||||
if (element != null) { // !!!!! WRONG: element[1] == null
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (element == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,8 @@ public class DataFlowInspectionTest extends InspectionTestCase {
|
||||
public void testIDEADEV74518_2() throws Exception { doTest(); }
|
||||
public void testIDEADEV77819() throws Exception { doTest(); }
|
||||
|
||||
public void testRegressionByPti() throws Exception { doTest(); }
|
||||
|
||||
public void testNotNullable() throws Exception { doTest15(); }
|
||||
|
||||
public void testNotNullableParameter() throws Exception { doTest15(); }
|
||||
|
||||
Reference in New Issue
Block a user