void (@NotNull final Set<? super PsiElement> res, @NotNull final Instruction instruction, int index) { if (instruction instanceof WriteVariableInstruction) { WriteVariableInstruction instructionW = (WriteVariableInstruction)instruction; if (psiManager.areElementsEquivalent(instructionW.variable, def)) { final PsiElement element = flow.getElement(index); element.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression ref) { if (PsiUtil.isAccessedForWriting(ref) && psiManager.areElementsEquivalent(ref.resolve(), def)) { res.add(ref); } } @Override public void visitVariable(@NotNull PsiVariable var) { if ((var instanceof PsiParameter || var.hasInitializer()) && psiManager.areElementsEquivalent(var, def)) { res.add(var); } } }); } } }