void (PsiExpression expression) { if (expression == null) return; final PsiType type = expression.getType(); if (!(type instanceof PsiClassType classType)) return; if (IGNORE_TOSTRING && MethodUtils.isToString(PsiTreeUtil.getParentOfType(expression, PsiMethod.class))) return; if (IGNORE_EXCEPTION && ( ExceptionUtils.isExceptionArgument(expression) || PsiTreeUtil.getParentOfType(expression, PsiThrowStatement.class, true, PsiCodeBlock.class, PsiClass.class) != null)) return; if (IGNORE_ASSERT && PsiTreeUtil.getParentOfType(expression, PsiAssertStatement.class, true, PsiCodeBlock.class, PsiClass.class) != null) { return; } if (IGNORE_NONNLS && NonNlsUtils.isNonNlsAnnotatedUse(expression)) return; if (type.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return; final PsiClass referencedClass = classType.resolve(); if (referencedClass == null || referencedClass instanceof PsiTypeParameter) return; if (referencedClass.isEnum() || referencedClass.isInterface()) return; if (referencedClass.hasModifierProperty(PsiModifier.ABSTRACT) && !(expression instanceof PsiSuperExpression)) return; if (hasGoodToString(referencedClass)) return; registerError(expression); }