boolean (@NotNull CFGBuilder builder, @NotNull PsiMethodCallExpression call) { if (!INDEX_OF.test(call)) return false; PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if (qualifier == null) return false; PsiExpression arg = call.getArgumentList().getExpressions()[0]; DfaVariableValue res = builder.createTempVariable(PsiTypes.intType()); String name = call.getMethodExpression().getReferenceName(); RelationType relationType = RelationType.LT; if ("lastIndexOf".equals(name) && TypeUtils.isJavaLangString(arg.getType())) { String strArg = ObjectUtils.tryCast(ExpressionUtils.computeConstantExpression(arg), String.class); if (strArg == null || strArg.isEmpty()) { // a.lastIndexOf(b) could equal to a.length() if b is an empty string relationType = RelationType.LE; } } builder.pushExpression(qualifier) .dup() .pushExpression(arg) .call(call) .assignTo(res) .splice(2, 0, 0, 1) .unwrap(SpecialField.STRING_LENGTH) .compare(relationType) .ensure(RelationType.EQ, DfTypes.TRUE, new UnsatisfiedConditionProblem() { }, null) .pop(); return true; }