ProblemDescriptor (PsiMethodCallExpression call) { PsiExpression secondArg = call.getArgumentList().getExpressions()[1]; PsiExpression stripped = PsiUtil.skipParenthesizedExprDown(secondArg); // s.lastIndexOf(..., s.length()) or s.lastIndexOf(..., s.length() - 1) if (stripped instanceof PsiBinaryExpression binOp && binOp.getOperationTokenType() == JavaTokenType.MINUS && ExpressionUtils.isLiteral(PsiUtil.skipParenthesizedExprDown(binOp.getROperand()), 1)) { stripped = binOp.getLOperand(); } PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if (!isLengthOf(stripped, qualifier)) return null; return getRedundantArgumentProblem(secondArg, "inspection.redundant.string.length.argument.message"); }