Skip to content

v0.5.0

Latest

Choose a tag to compare

@alexandru alexandru released this 30 Aug 08:47
· 4 commits to main since this release
7096157

This release changes the asynchronous task API and improves cancellation handling.

Breaking changes

AsyncFun<T> now receives a single public Continuation<? super T> and returns void.

Task.fromAsync(continuation -> {
    Executor executor = continuation.getExecutor();

    continuation.invokeOnCancellation(() -> {
        // Cleanup
    });

    executor.execute(() -> continuation.onSuccess("done"));
});

Previously, asynchronous functions received an Executor and CompletionCallback, then returned a Cancellable.

Continuation now:

  • Extends CompletionCallback
  • Provides the task's Executor through getExecutor()
  • Registers cancellation cleanup through invokeOnCancellation()
  • Separates cancellation cleanup from onCancellation(), which signals task completion

This change is source and binary incompatible.

Other changes

  • Improved cancellation race handling for asynchronous tasks, blocking I/O, futures, and Kotlin coroutines.
  • Corrected JSpecify annotations and nullable generic bounds.
  • Added NullAway and Error Prone checks for Java sources.
  • Updated Kotlin to 2.4.10 and kotlinx-coroutines to 1.11.0.
  • Expanded cancellation and cancellable-future test coverage.
  • Updated publishing and dependency automation.

Full changelog: v0.4.1...v0.5.0