private static boolean isSafeStringMethod(UExpression expression, final Set<? super PsiModifierListOwner> nonNlsTargets) {
    UElement parent = UastUtils.skipParenthesizedExprUp(expression.getUastParent());
    if (parent instanceof UBinaryExpression binOp) {
      if (STRING_COMPARISON_OPS.contains(binOp.getOperator())) {
        UResolvable left = ObjectUtils.tryCast(UastUtils.skipParenthesizedExprDown(binOp.getLeftOperand()), UResolvable.class);
        UResolvable right = ObjectUtils.tryCast(UastUtils.skipParenthesizedExprDown(binOp.getRightOperand()), UResolvable.class);
        return left != null && isNonNlsCall(left, nonNlsTargets) ||
               right != null && isNonNlsCall(right, nonNlsTargets);
      }
    }
    if (!(parent instanceof UQualifiedReferenceExpression)) return false;
    UExpression selector = ((UQualifiedReferenceExpression)parent).getSelector();
    if (!(selector instanceof UCallExpression call)) return false;
    if (STRING_EQUALS.uCallMatches(call)) {
      final List<UExpression> expressions = call.getValueArguments();
      if (expressions.size() != 1) return false;
      final UExpression arg = UastUtils.skipParenthesizedExprDown(expressions.get(0));
      UReferenceExpression ref = ObjectUtils.tryCast(arg, UReferenceExpression.class);
      if (ref != null) {
        return isNonNlsCall(ref, nonNlsTargets);
      }
      return false;
    }
    if (STRING_LENGTH.uCallMatches(call)) {
      return true;
    }
    return false;
  }
private static boolean isSafeStringMethod(UExpression expression, final Set<? super PsiModifierListOwner> nonNlsTargets)