boolean (@NotNull PsiElement from, @NotNull PsiElement context, @NotNull JavaSliceUsage parent, @NotNull final Processor<? super SliceUsage> processor) { if (from instanceof PsiLocalVariable) { return searchReferencesAndProcessAssignmentTarget(from, context, parent, processor); } if (from instanceof PsiParameter parameter) { PsiElement scope = parameter.getDeclarationScope(); Collection<PsiParameter> parametersToAnalyze = new HashSet<>(); if (scope instanceof PsiMethod method && ((PsiMethod)scope).hasModifierProperty(PsiModifier.ABSTRACT)) { int index = method.getParameterList().getParameterIndex(parameter); final Set<PsiMethod> implementors = new HashSet<>(); if (!OverridingMethodsSearch.search(method, parent.getScope().toSearchScope(), true).forEach(sub -> { ProgressManager.checkCanceled(); implementors.add(sub); return true; })) return false; for (PsiMethod implementor : implementors) { ProgressManager.checkCanceled(); if (!parent.params.scope.contains(implementor)) continue; if (implementor instanceof PsiCompiledElement) implementor = (PsiMethod)implementor.getNavigationElement(); PsiParameter[] parameters = implementor.getParameterList().getParameters(); if (index != -1 && index < parameters.length) { parametersToAnalyze.add(parameters[index]); } } } else { parametersToAnalyze.add(parameter); } for (final PsiParameter psiParameter : parametersToAnalyze) { ProgressManager.checkCanceled(); if (!searchReferencesAndProcessAssignmentTarget(psiParameter, null, parent, processor)) return false; } return true; } else if (from instanceof PsiField) { return searchReferencesAndProcessAssignmentTarget(from, null, parent, processor); } if (from instanceof PsiMethod) { PsiMethod method = (PsiMethod)from; Collection<PsiMethod> superMethods = ContainerUtil.newHashSet(method.findDeepestSuperMethods()); superMethods.add(method); final Set<PsiReference> processed = new HashSet<>(); //usages of super method and overridden method can overlap for (final PsiMethod containingMethod : superMethods) { if (!MethodReferencesSearch.search(containingMethod, parent.getScope().toSearchScope(), true).forEach(reference -> { ProgressManager.checkCanceled(); synchronized (processed) { if (!processed.add(reference)) return true; } PsiElement element = reference.getElement().getParent(); return processAssignmentTarget(element, parent, processor); })) { return false; } } } return true; }