boolean (@NotNull PsiElement element, @NotNull final JavaSliceUsage parent, @NotNull final Processor<? super SliceUsage> processor) { PsiExpression expression = getMethodCallTarget(element); JavaSliceBuilder builder = JavaSliceBuilder.create(parent).dropSyntheticField(); if (expression != null && !builder.process(expression, processor)) { return false; } Pair<PsiElement, PsiSubstitutor> pair = getAssignmentTarget(element, parent); if (pair != null) { PsiElement target = pair.getFirst(); if (target instanceof PsiParameter parameter && parameter.getDeclarationScope() instanceof PsiMethod method) { final PsiSubstitutor substitutor = pair.getSecond(); final int parameterIndex = method.getParameterList().getParameterIndex(parameter); Processor<PsiMethod> myProcessor = override -> { if (!parent.getScope().contains(override)) return true; final PsiSubstitutor superSubstitutor = method == override ? substitutor : MethodSignatureUtil.getSuperMethodSignatureSubstitutor(method.getSignature(substitutor), override.getSignature( substitutor)); PsiParameter[] parameters = override.getParameterList().getParameters(); if (parameters.length <= parameterIndex || superSubstitutor == null) return true; PsiParameter actualParam = parameters[parameterIndex]; return builder.withSubstitutor(superSubstitutor).process(actualParam, processor); }; if (!myProcessor.process(method)) return false; return OverridingMethodsSearch.search(method, parent.getScope().toSearchScope(), true).forEach(myProcessor); } return builder.process(target, processor); } if (element instanceof PsiReferenceExpression ref) { PsiElement resolved = ref.resolve(); if (!(resolved instanceof PsiVariable variable)) return true; return processAssignedFrom(variable, ref, parent, processor); } if (element instanceof PsiVariable) { return processAssignedFrom(element, element, parent, processor); } if (element instanceof PsiMethod) { return processAssignedFrom(element, element, parent, processor); } return true; }