void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if (!HardcodedMethodConstants.TO_STRING.equals(methodName)) { return; } final PsiExpression qualifier = PsiUtil.deparenthesizeExpression(methodExpression.getQualifierExpression()); if (!(qualifier instanceof PsiNewExpression newExpression)) { return; } final PsiExpressionList argumentList = newExpression.getArgumentList(); if (argumentList == null) { return; } final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length < 1) { return; } final PsiExpression argument = arguments[0]; final PsiType argumentType = argument.getType(); if (argumentType != null && argumentType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) { return; } final PsiType type = qualifier.getType(); if (type == null) { return; } final String typeName = type.getCanonicalText(); if (!s_basicTypes.contains(typeName)) { return; } registerNewExpressionError(newExpression, newExpression); }