private @NotNull <T> CancellablePromise<T> compute(@NotNull Function<? super Obsolescent, ? extends T> function) {
    AsyncPromise<T> promise = new AsyncPromise<>();
    if (invoker != null) {
      invoker.compute(() -> function.apply((Obsolescent)promise::isDone))
        .onError(promise::setError)
        .onSuccess(result -> EventQueue.invokeLater(() -> {
          if (!promise.isDone()) promise.setResult(result);
        }));
    }
    else if (!EventQueue.isDispatchThread()) {
      EventQueue.invokeLater(() -> computeOnEDT(function, promise));
    }
    else {
      computeOnEDT(function, promise);
    }
    return promise;
  }
private @NotNull <T> CancellablePromise<T> compute(@NotNull Function<? super Obsolescent, ? extends T> function)