mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
synchronized block start should really flush fields
This commit is contained in:
@@ -718,8 +718,8 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
boolean resetNullability = isNotNull(field);
|
||||
flushVariable(field);
|
||||
if (resetNullability) {
|
||||
getVariableState(field).setNullable(false);
|
||||
}
|
||||
getVariableState(field).setNullable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,15 +728,15 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
return;
|
||||
}
|
||||
|
||||
doFlash(variable);
|
||||
doFlush(variable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushVariableOutOfScope(DfaVariableValue variable) {
|
||||
doFlash(variable);
|
||||
doFlush(variable);
|
||||
}
|
||||
|
||||
private void doFlash(DfaVariableValue varPlain) {
|
||||
private void doFlush(DfaVariableValue varPlain) {
|
||||
DfaVariableValue varNegated = (DfaVariableValue)varPlain.createNegated();
|
||||
|
||||
final int idPlain = varPlain.getID();
|
||||
|
||||
@@ -150,6 +150,9 @@ public abstract class InstructionVisitor {
|
||||
}
|
||||
|
||||
public DfaInstructionState[] visitPush(PushInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
|
||||
if (instruction.isFieldReference()) {
|
||||
memState.fieldReferenced();
|
||||
}
|
||||
memState.push(instruction.getValue());
|
||||
return nextInstruction(instruction, runner, memState);
|
||||
}
|
||||
|
||||
+6
@@ -31,6 +31,8 @@ import com.intellij.codeInspection.dataFlow.InstructionVisitor;
|
||||
import com.intellij.codeInspection.dataFlow.value.DfaUnknownValue;
|
||||
import com.intellij.codeInspection.dataFlow.value.DfaValue;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiReferenceExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PushInstruction extends Instruction {
|
||||
@@ -59,4 +61,8 @@ public class PushInstruction extends Instruction {
|
||||
public String toString() {
|
||||
return "PUSH " + myValue;
|
||||
}
|
||||
|
||||
public boolean isFieldReference() {
|
||||
return myPlace instanceof PsiReferenceExpression && ((PsiReferenceExpression)myPlace).resolve() instanceof PsiField;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user