void (@NotNull PsiParameter parameter, @NotNull List<? super UsageInfo> usages) { PsiMethod method = (PsiMethod)parameter.getDeclarationScope(); int parameterIndex = method.getParameterList().getParameterIndex(parameter); if (parameterIndex < 0) return; //search for refs to current method only, do not search for refs to overriding methods, they'll be searched separately ReferencesSearch.search(method).forEach(reference -> { PsiElement element = reference.getElement(); JavaSafeDeleteDelegate safeDeleteDelegate = JavaSafeDeleteDelegate.EP.forLanguage(element.getLanguage()); if (safeDeleteDelegate != null) { safeDeleteDelegate.createUsageInfoForParameter(reference, usages, parameter, parameterIndex, parameter.isVarArgs()); } if (!parameter.isVarArgs() && !JavaPsiConstructorUtil.isSuperConstructorCall(element.getParent())) { PsiParameter paramInCaller = SafeDeleteJavaCallerChooser.isTheOnlyOneParameterUsage(element.getParent(), parameterIndex, method); if (paramInCaller != null) { PsiMethod callerMethod = (PsiMethod)paramInCaller.getDeclarationScope(); usages.add(createParameterCallHierarchyUsageInfo( method, parameter, callerMethod, paramInCaller)); } } return true; }); ReferencesSearch.search(parameter).forEach(reference -> { PsiElement element = reference.getElement(); PsiDocTag docTag = PsiTreeUtil.getParentOfType(element, PsiDocTag.class); if (docTag != null) { usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(docTag, parameter, true)); return true; } boolean isSafeDelete = false; if (element.getParent().getParent() instanceof PsiMethodCallExpression call) { if (JavaPsiConstructorUtil.isSuperConstructorCall(call)) { isSafeDelete = true; } else if (call.getMethodExpression().getQualifierExpression() instanceof PsiSuperExpression) { PsiMethod superMethod = call.resolveMethod(); if (superMethod != null && MethodSignatureUtil.isSuperMethod(superMethod, method)) { isSafeDelete = true; } } } usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, isSafeDelete)); return true; }); findFunctionalExpressions(usages, method); }