void (@NotNull PsiMethodCallExpression call) { super.visitMethodCallExpression(call); final PsiReferenceExpression methodExpression = call.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if (!"equals".equals(methodName)) { return; } final PsiExpressionList argumentList = call.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length != 1) { return; } final PsiElement context = call.getParent(); final boolean useIsEmpty = PsiUtil.isLanguageLevel6OrHigher(call); if (!useIsEmpty && context instanceof PsiExpressionStatement) { // cheesy, but necessary, because otherwise the quickfix will // produce uncompilable code (out of merely incorrect code). return; } final PsiExpression qualifier = methodExpression.getQualifierExpression(); boolean addNullCheck = false; final PsiExpression argument = arguments[0]; if (ExpressionUtils.isEmptyStringLiteral(qualifier)) { final PsiType type = argument.getType(); if (!TypeUtils.isJavaLangString(type)) return; PsiExpression expression = getCheckedExpression(useIsEmpty, argument); addNullCheck = expression == argument && NullabilityUtil.getExpressionNullability(expression, true) != Nullability.NOT_NULL; if (addNullCheck && !ExpressionUtils.isSafelyRecomputableExpression(expression)) return; } else if (ExpressionUtils.isEmptyStringLiteral(argument)) { if (qualifier == null) return; final PsiType type = qualifier.getType(); if (!TypeUtils.isJavaLangString(type)) return; } else { return; } if (addNullCheck && SUPPRESS_FOR_VALUES_WHICH_COULD_BE_NULL) { return; } registerMethodCallError(call, useIsEmpty, addNullCheck); }