void (@NotNull PsiReferenceExpression expression) { super.visitReferenceExpression(expression); final PsiExpression qualifier = expression.getQualifierExpression(); if (qualifier == null || qualifier instanceof PsiThisExpression) { return; } if (ignoreEquals) { final PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class); if (MethodUtils.isEquals(method)) { return; } } final PsiElement referent = expression.resolve(); if (!(referent instanceof PsiField field)) { return; } if (ignoreSameClass) { final PsiClass parent = PsiTreeUtil.getParentOfType(expression, PsiClass.class); final PsiClass containingClass = field.getContainingClass(); if (parent != null && (parent.equals(containingClass) || ignoreInnerClasses && PsiTreeUtil.isAncestor(containingClass, parent, true))) { return; } } if (!field.hasModifierProperty(PsiModifier.PRIVATE) && !field.hasModifierProperty(PsiModifier.PROTECTED)) { return; } if (field.hasModifierProperty(PsiModifier.STATIC)) { return; } final PsiElement fieldNameElement = expression.getReferenceNameElement(); if (fieldNameElement == null) { return; } registerError(fieldNameElement, field); }