code: private static <X extends Exception> X newWithCause(
        Class<X> exceptionClass, Throwable cause) {
      // getConstructors() guarantees this as long as we don't modify the array.
      @SuppressWarnings("unchecked")
      List<Constructor<X>> constructors =
          (List) Arrays.asList(exceptionClass.getConstructors());
      for (Constructor<X> constructor : preferringStrings(constructors)) {
        @Nullable X instance = newFromConstructor(constructor, cause);
        if (instance != null) {
          if (instance.getCause() == null) {
            instance.initCause(cause);
          }
          return instance;
        }
      }
      throw new IllegalArgumentException(
          "No appropriate constructor for exception of type " + exceptionClass
              + " in response to chained exception", cause);
    }
docs: /*
  Arguably we don't need a timed getUnchecked because any operation slow
  enough to require a timeout is heavyweight enough to throw a checked
  exception and therefore be inappropriate to use with getUnchecked. Further,
  it's not clear that converting the checked TimeoutException to a
  RuntimeException -- especially to an UncheckedExecutionException, since it
  wasn't thrown by the computation -- makes sense, and if we don't convert
  it, the user still has to write a try-catch block.
  
  If you think you would use this method, let us know.