diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/SideEffectVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/SideEffectVisitor.java index 001c7a3b1230..6cce47db6866 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/SideEffectVisitor.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/SideEffectVisitor.java @@ -1,10 +1,7 @@ // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.dataFlow; -import com.intellij.codeInspection.dataFlow.instructions.AssignInstruction; -import com.intellij.codeInspection.dataFlow.instructions.FlushVariableInstruction; -import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction; -import com.intellij.codeInspection.dataFlow.instructions.ReturnInstruction; +import com.intellij.codeInspection.dataFlow.instructions.*; import com.intellij.codeInspection.dataFlow.value.DfaValue; import com.intellij.codeInspection.dataFlow.value.DfaVariableValue; import org.jetbrains.annotations.NotNull; @@ -24,12 +21,19 @@ public class SideEffectVisitor extends StandardInstructionVisitor { return false; } + @Override + public DfaInstructionState[] visitFlushFields(FlushFieldsInstruction instruction, + DataFlowRunner runner, + DfaMemoryState memState) { + runner.cancel(); + return super.visitFlushFields(instruction, runner, memState); + } + @Override public DfaInstructionState[] visitFlushVariable(FlushVariableInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { - final DfaVariableValue variable = instruction.getVariable(); - if (variable == null || !isModificationAllowed(variable)) { + if (!isModificationAllowed(instruction.getVariable())) { runner.cancel(); } return super.visitFlushVariable(instruction, runner, memState);