private static boolean isTrivial(@Nullable UExpression bodyExpression, @Nullable Predicate<? super UExpression> trivialPredicate) {
    if (bodyExpression == null) return true;
    final List<UExpression> expressions;
    if (bodyExpression instanceof UBlockExpression) {
      expressions = ((UBlockExpression)bodyExpression).getExpressions();
    } else {
      expressions = List.of(bodyExpression);
    }
    if (expressions.size() == 0) return true;
    for (UExpression expression : expressions) {
      ProgressManager.checkCanceled();
      if (expression instanceof UastEmptyExpression || trivialPredicate != null && trivialPredicate.test(expression)) continue;
      if (expression instanceof UReturnExpression returnExpression) {
        final UExpression returnedExpression = returnExpression.getReturnExpression();
        if (returnedExpression != null && !(UastUtils.skipParenthesizedExprDown(returnedExpression) instanceof ULiteralExpression)) {
          return false;
        }
      }
      else if (expression instanceof UIfExpression ifExpression) {
        final UExpression condition = ifExpression.getCondition();
        final Object result = condition.evaluate();
        if (result == null || !result.equals(Boolean.FALSE)) return false;
      }
      else if (expression instanceof UCallExpression) {
        final String methodName = ((UCallExpression)expression).getMethodName();
        if (methodName != null && !methodName.equals(PsiKeyword.SUPER) && !methodName.equals("<init>")) return false;
      }
      else return false;
    }
    return true;
  }
private static boolean isTrivial(@Nullable UExpression bodyExpression, @Nullable Predicate<? super UExpression> trivialPredicate)