Condition<PsiElement> (PsiField psiField, List<? super UsageInfo> usages, PsiElement[] allElementsToDelete) { Condition<PsiElement> isInsideDeleted = getUsageInsideDeletedFilter(allElementsToDelete); Set<PsiParameter> parameters = new LinkedHashSet<>(); ReferencesSearch.search(psiField).forEach(reference -> { if (!isInsideDeleted.value(reference.getElement())) { PsiElement element = reference.getElement(); PsiElement parent = element.getParent(); if (parent instanceof PsiAssignmentExpression assignment && element == assignment.getLExpression()) { usages.add(new SafeDeleteFieldWriteReference(assignment, psiField)); PsiExpression rExpression = PsiUtil.skipParenthesizedExprDown(assignment.getRExpression()); if (rExpression instanceof PsiReferenceExpression ref && ref.resolve() instanceof PsiParameter parameter && parameter.getDeclarationScope() instanceof PsiMethod method && method.isConstructor()) { parameters.add(parameter); } } else { TextRange range = reference.getRangeInElement(); usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(reference.getElement(), psiField, range.getStartOffset(), range.getEndOffset(), false, PsiTreeUtil.getParentOfType(element, PsiImportStaticStatement.class) != null)); } } return true; }); PsiClass containingClass = psiField.getContainingClass(); if (containingClass != null) { PsiMethod setterPrototype = PropertyUtilBase.generateSetterPrototype(psiField, containingClass); PsiParameter setterParameter = setterPrototype.getParameterList().getParameters()[0]; for (PsiParameter parameter : parameters) { PsiElement scope = parameter.getDeclarationScope(); if (scope instanceof PsiMethod) { if (!ReferencesSearch.search(parameter, new LocalSearchScope(scope)).forEach(ref -> { PsiElement element = ref.getElement(); if (element instanceof PsiReferenceExpression) { PsiElement parent = PsiUtil.skipParenthesizedExprUp(element.getParent()); if (parent instanceof PsiAssignmentExpression) { PsiExpression lExpression = PsiUtil.skipParenthesizedExprDown(((PsiAssignmentExpression)parent).getLExpression()); if (lExpression instanceof PsiReferenceExpression && ((PsiReferenceExpression)lExpression).resolve() == psiField) { return true; } } } return false; })) continue; usages.add(createParameterCallHierarchyUsageInfo(setterPrototype, setterParameter, (PsiMethod)scope, parameter)); } } } else { LOG.assertTrue(!psiField.isPhysical(), "No containing class for field: " + psiField.getClass()); } appendCallees(psiField, usages); return isInsideDeleted; }