void (@NotNull PsiReferenceExpression expression) { super.visitReferenceExpression(expression); @NonNls final String name = expression.getReferenceName(); @NonNls final String replacement; if ("EMPTY_LIST".equals(name)) { replacement = "emptyList()"; } else if ("EMPTY_MAP".equals(name)) { replacement = "emptyMap()"; } else if ("EMPTY_SET".equals(name)) { replacement = "emptySet()"; } else { return; } final PsiElement target = expression.resolve(); if (!(target instanceof PsiField field)) { return; } final PsiClass containingClass = field.getContainingClass(); if (containingClass == null) { return; } final String qualifiedName = containingClass.getQualifiedName(); if (!CommonClassNames.JAVA_UTIL_COLLECTIONS.equals(qualifiedName)) { return; } final PsiElement parent = ParenthesesUtils.getParentSkipParentheses(expression); if (parent instanceof PsiExpression && ComparisonUtils.isEqualityComparison((PsiExpression)parent)) { return; } registerError(expression, expression, replacement); }