void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiExpressionList argumentList = expression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length != 1) { return; } final PsiExpression boxedExpression = arguments[0]; final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String referenceName = methodExpression.getReferenceName(); if (!"valueOf".equals(referenceName)) { return; } final PsiMethod method = ObjectUtils.tryCast(methodExpression.resolve(), PsiMethod.class); if (method == null) { return; } final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return; } final String canonicalText = aClass.getQualifiedName(); if (canonicalText == null || !TypeConversionUtil.isPrimitiveWrapper(canonicalText)) { return; } final PsiType boxedExpressionType = boxedExpression.getType(); if (TypeUtils.isJavaLangString(boxedExpressionType)) { final PsiType expectedType = ExpectedTypeUtils.findExpectedType(expression, false, true); final PsiType methodReturnType = method.getReturnType(); if (expectedType instanceof PsiPrimitiveType) { final String parseMethod = JavaPsiBoxingUtils.getParseMethod(methodReturnType); if (parseMethod != null) { registerMethodCallError(expression, methodReturnType, parseMethod); } } return; } if (!(boxedExpressionType instanceof PsiPrimitiveType)) { return; } if (isBoxingNecessary(expression, boxedExpression)) { return; } if (onlyReportSuperfluouslyBoxed) { final PsiType expectedType = ExpectedTypeUtils.findExpectedType(expression, false, true); if (!(expectedType instanceof PsiPrimitiveType)) { return; } } registerMethodCallError(expression); }