public static boolean isSuspiciousFormatCall(PsiMethodCallExpression expression, PsiTypeCastExpression cast) {
    FormatArgument formatArgument =
      FormatArgument.extract(expression, Collections.emptyList(), Collections.emptyList());
    if (formatArgument == null) {
      return false;
    }

    String value = formatArgument.calculateValue();
    if (value == null) {
      return false;
    }

    int formatArgumentIndex = formatArgument.getIndex();

    PsiExpression[] arguments = expression.getArgumentList().getExpressions();

    final Validator[] validators;
    try {
      validators = decode(value, arguments.length - formatArgumentIndex);
    }
    catch (IllegalFormatException e) {
      return false;
    }

    if (validators.length == 0) {
      return false;
    }

    int idx = IntStream.range(0, arguments.length)
      .filter(i -> PsiTreeUtil.isAncestor(arguments[i], cast, false)).findFirst()
      .orElse(-1);

    if (idx < formatArgumentIndex) {
      return false;
    }

    Validator validator = validators[idx - formatArgumentIndex];
    PsiTypeElement castType = cast.getCastType();
    return validator.valid(Objects.requireNonNull(castType).getType()) &&
           !validator.valid(Objects.requireNonNull(cast.getOperand()).getType());
  }
public static boolean isSuspiciousFormatCall(PsiMethodCallExpression expression, PsiTypeCastExpression cast)