void (@NotNull PsiMethodCallExpression call) { if (!STRING_REPLACE.test(call)) return; PsiLiteralExpression qualifier = tryCast( PsiUtil.skipParenthesizedExprDown(call.getMethodExpression().getQualifierExpression()), PsiLiteralExpression.class); if (qualifier == null || qualifier.getTextLength() > MAX_QUALIFIER_LENGTH) return; String str = tryCast(qualifier.getValue(), String.class); if (str == null) return; PsiExpression pattern = PsiUtil.skipParenthesizedExprDown(call.getArgumentList().getExpressions()[0]); String name = call.getMethodExpression().getReferenceName(); if (!isRedundant(str, pattern, "replace".equals(name))) return; PsiElement refName = Objects.requireNonNull(call.getMethodExpression().getReferenceNameElement()); holder.registerProblem(call, InspectionGadgetsBundle.message("inspection.replace.on.literal.display.name"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, TextRange.create(refName.getTextRangeInParent().getStartOffset(), call.getTextLength()), ExpressionUtils.isVoidContext(call) ? LocalQuickFix.EMPTY_ARRAY : new LocalQuickFix[]{new ReplaceOnLiteralWithQualifierFix()}); }