boolean (PsiReference reference) { final PsiElement element = reference.getElement(); final PsiElement parent = element.getParent(); if (!(parent instanceof PsiNewExpression)) { newOnlyAssignedToField = false; return false; } final PsiElement grandParent = parent.getParent(); if (field.equals(grandParent)) { return true; } if (!(grandParent instanceof PsiAssignmentExpression assignmentExpression)) { newOnlyAssignedToField = false; return false; } final PsiExpression lhs = assignmentExpression.getLExpression(); if (!(lhs instanceof PsiReferenceExpression referenceExpression)) { newOnlyAssignedToField = false; return false; } final PsiElement target = referenceExpression.resolve(); if (!field.equals(target)) { newOnlyAssignedToField = false; return false; } return true; }