diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/CommonDataflow.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/CommonDataflow.java index 9c6a3bb7363c..12e75ba97794 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/CommonDataflow.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/CommonDataflow.java @@ -1,6 +1,7 @@ // Copyright 2000-2018 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.ArrayAccessInstruction; import com.intellij.codeInspection.dataFlow.instructions.BinopInstruction; import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction; import com.intellij.codeInspection.dataFlow.instructions.PushInstruction; @@ -97,6 +98,17 @@ public class CommonDataflow { return states; } + @Override + public DfaInstructionState[] visitArrayAccess(ArrayAccessInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { + DfaInstructionState[] states = super.visitArrayAccess(instruction, runner, memState); + PsiArrayAccessExpression anchor = instruction.getExpression(); + for (DfaInstructionState state : states) { + DfaMemoryState afterState = state.getMemoryState(); + dfr.add(anchor, (DfaMemoryStateImpl)afterState, afterState.peek()); + } + return states; + } + @Override public DfaInstructionState[] visitBinop(BinopInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { DfaInstructionState[] states = super.visitBinop(instruction, runner, memState);