Skip to content

Releases: Kotlin/kotlinx.coroutines

1.11.0

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 08 May 12:49

Various

  • Kotlin was updated to 2.2.20 (#4545).
  • Improved the published jar files (#3842, #4599).
  • Various documentation improvements, including complete rewrites of structured concurrency and error handling-related KDoc (#4433, #4596).

Breaking changes and deprecations

  • Moved Promise-related functions from JS and Wasm/JS to the new web target. On Wasm/JS, this is a breaking change. Before the change, Promise on Wasm/JS could work with arbitrary Kotlin types, but now, only JsAny subtypes are accepted (#4563).
  • Changed handling of coroutine exceptions that can't be propagated on JS and Wasm/JS. B
    efore, exceptions were logged, but now, they are reported to the JS runtime (#4451, #4631).
  • Deprecated using CoroutineDispatcher as the coroutine context key; now, ContinuationInterceptor has to be used instead (#4333).
  • Advanced the deprecation levels on kotlinx-coroutines-test APIs (#4604).
  • Added lint functions that mark passing a Job to coroutine builders as deprecated (#4435).

Bug fixes and improvements

  • Added a callsInPlace(EXACTLY_ONCE) contract to runBlocking in code shared between JVM and Native (#4368).
  • Added a callsInPlace(EXACTLY_ONCE) contract to suspendCancellableCoroutine (#4574).
  • Fixed flowOn incorrectly handling ThreadContextElement updates (#4403).
  • Fixed exceptions in user-supplied Thread.UncaughtExceptionHandler instances causing the internal coroutines machinery to fail (#4516).
  • Fixed CoroutineDispatcher.asScheduler in the RxJava integration not cancelling outstanding work when a Worker gets cancelled, which led to memory leaks in some scenarios (#4615).
  • Fixed SharedFlow entering an invalid state when a subscriber and an emitter are cancelled simultaneously (#4583).
  • Fixed an R8 optimization leading to shareIn/stateIn coroutines getting garbage-collected (#4646). Thanks, @solevic!

Small additions

  • Added CompletableDeferred.asDeferred for obtaining a read-only Deferred view (#4408).
  • Added SharedFlow.asFlow for obtaining a Flow view with hidden hot flow semantics (#4530). Thanks, @g000sha256!
  • Added a StateFlow.collectLatest overload returning Nothing to assist with finding unreachable code (#4454).
  • Added ReceiveChannel.consumeTo for consuming a ReceiveChannel into a MutableCollection (#4520).
  • Added a StateFlow<T>.onSubscription overload returning a StateFlow<T>, similar to SharedFlow<T>.onSubscription returning SharedFlow<T> (#4275). Thanks, @xit0c!
  • Added terminal Flow operators for collecting a Flow to a Map (#1541).

Changelog relative to version 1.11.0

No changes, only the version is increased.

1.11.0-rc02

1.11.0-rc02 Pre-release
Pre-release

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 27 Apr 14:08

Restored binary compatibility with 1.10.2 and older versions on Wasm/JS for usages of Promise-related functions (#4661).

1.11.0-rc01

1.11.0-rc01 Pre-release
Pre-release

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 15 Apr 14:00

Various

  • Kotlin was updated to 2.2.20 (#4545).
  • Improved the published jar files (#3842, #4599).
  • Various documentation improvements, including complete rewrites of structured concurrency and error handling-related KDoc (#4433, #4596).

Breaking changes and deprecations

  • Moved Promise-related functions from JS and Wasm/JS to the new web target. On Wasm/JS, this is a breaking change. Before the change, Promise on Wasm/JS could work with arbitrary Kotlin types, but now, only JsAny subtypes are accepted (#4563).
  • Changed handling of coroutine exceptions that can't be propagated on JS and Wasm/JS. Before, exceptions were logged, but now, they are reported to the JS runtime (#4451, #4631).
  • Deprecated using CoroutineDispatcher as the coroutine context key; now, ContinuationInterceptor has to be used instead (#4333).
  • Advanced the deprecation levels on kotlinx-coroutines-test APIs (#4604).
  • Added lint functions that mark passing a Job to coroutine builders as deprecated (#4435).

Bug fixes and improvements

  • Added a callsInPlace(EXACTLY_ONCE) contract to runBlocking in code shared between JVM and Native (#4368).
  • Added a callsInPlace(EXACTLY_ONCE) contract to suspendCancellableCoroutine (#4574).
  • Fixed flowOn incorrectly handling ThreadContextElement updates (#4403).
  • Fixed exceptions in user-supplied Thread.UncaughtExceptionHandler instances causing the internal coroutines machinery to fail (#4516).
  • Fixed CoroutineDispatcher.asScheduler in the RxJava integration not cancelling outstanding work when a Worker gets cancelled, which led to memory leaks in some scenarios (#4615).
  • Fixed SharedFlow entering an invalid state when a subscriber and an emitter are cancelled simultaneously (#4583).
  • Fixed an R8 optimization leading to shareIn/stateIn coroutines getting garbage-collected (#4646). Thanks, @solevic!

Small additions

  • Added CompletableDeferred.asDeferred for obtaining a read-only Deferred view (#4408).
  • Added SharedFlow.asFlow for obtaining a Flow view with hidden hot flow semantics (#4530). Thanks, @g000sha256!
  • Added a StateFlow.collectLatest overload returning Nothing to assist with finding unreachable code (#4454).
  • Added ReceiveChannel.consumeTo for consuming a ReceiveChannel into a MutableCollection (#4520).
  • Added a StateFlow<T>.onSubscription overload returning a StateFlow<T>, similar to SharedFlow<T>.onSubscription returning SharedFlow<T> (#4275). Thanks, @xit0c!
  • Added terminal Flow operators for collecting a Flow to a Map (#1541).

1.10.2

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 08 Apr 08:29
  • Fixed the kotlinx-coroutines-debug JAR file including the module-info.class file twice, resulting in failures in various tooling (#4314). Thanks, @RyuNen344!
  • Fixed Flow.stateIn hanging when the scope is cancelled in advance or the flow is empty (#4322). Thanks, @francescotescari!
  • Improved handling of dispatcher failures in .limitedParallelism (#4330) and during flow collection (#4272).
  • Fixed runBlocking failing to run its coroutine to completion in some cases if its JVM thread got interrupted (#4399).
  • Small tweaks, fixes, and documentation improvements.

1.10.1

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 20 Dec 15:33
  • Fixed binary incompatibility introduced for non-JVM targets in #4261 (#4309).

1.10.0

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 19 Dec 19:55
  • Kotlin was updated to 2.1.0 (#4284).
  • Introduced Flow.any, Flow.all, and Flow.none (#4212). Thanks, @CLOVIS-AI!
  • Reorganized kotlinx-coroutines-debug and kotlinx-coroutines-core code to avoid a split package between the two artifacts (#4247). Note that directly referencing kotlinx.coroutines.debug.AgentPremain must now be replaced with kotlinx.coroutines.debug.internal.AgentPremain. Thanks, @sellmair!
  • No longer shade byte-buddy in kotlinx-coroutines-debug, reducing the artifact size and simplifying the build configuration of client code. Thanks, @sellmair!
  • Fixed NullPointerException when using Java-deserialized kotlinx-coroutines-core exceptions (#4291). Thanks, @AlexRiedler!
  • Properly report exceptions thrown by CoroutineDispatcher.dispatch instead of raising internal errors (#4091). Thanks, @zuevmaxim!
  • Fixed a bug that delayed scheduling of a Dispatchers.Default or Dispatchers.IO task after a yield() in rare scenarios (#4248).
  • Fixed a bug that prevented the main() coroutine on Wasm/WASI from executing after a delay() call in some scenarios (#4239).
  • Fixed scheduling of runBlocking tasks on Kotlin/Native that arrive after the runBlocking block was exited (#4245).
  • Fixed some terminal Flow operators sometimes resuming without taking cancellation into account (#4254). Thanks, @jxdabc!
  • Fixed a bug on the JVM that caused coroutine-bound ThreadLocal values not to get cleaned when using non-CoroutineDispatcher continuation interceptors (#4296).
  • Small tweaks, fixes, and documentation improvements.

1.9.0

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 13 Sep 14:26

Features

  • Wasm/WASI target support (#4064). Thanks, @igoriakovlev!
  • limitedParallelism now optionally accepts the name of the dispatcher view for easier debugging (#4023).
  • No longer initialize Dispatchers.IO on the JVM when other standard dispatchers are accessed (#4166). Thanks, @metalhead8816!
  • Introduced the Flow<T>.chunked(size: Int): Flow<List<T>> operator that groups emitted values into groups of the given size (#1290).
  • Closeable dispatchers are instances of AutoCloseable now (#4123).

Fixes

  • Calling hasNext on a Channel's iterator is idempotent (#4065). Thanks, @gitpaxultek!
  • CoroutineScope() created without an explicit dispatcher uses Dispatchers.Default on Native (#4074). Thanks, @whyoleg!
  • Fixed a bug that prevented non-Android Dispatchers.Main from initializing when the Firebase dependency is used (#3914).
  • Ensured a more intuitive ordering of tasks in runBlocking (#4134).
  • Forbid casting a Mutex to Semaphore (#4176).
  • Worked around a stack overflow that may occur when calling asDeferred on a Future many times (#4156).

Deprecations and promotions

  • Advanced the deprecation levels for BroadcastChannel-based API (#4197).
  • Advanced the deprecation levels for the old kotlinx-coroutines-test API (#4198).
  • Deprecated Job.cancelFutureOnCompletion (#4173).
  • Promoted CoroutineDispatcher.limitedParallelism to stable (#3864).
  • Promoted CoroutineStart.ATOMIC from ExperimentalCoroutinesApi to DelicateCoroutinesApi (#4169).
  • Promoted CancellableContinuation.resume with an onCancellation lambda to stable, providing extra arguments to the lambda (#4088).
  • Marked the classes and interfaces that are not supposed to be inherited from with the new InternalForInheritanceCoroutinesApi opt-in (#3770).
  • Marked the classes and interfaces inheriting from which is not stable with the new ExperimentalForInheritanceCoroutinesApi opt-in (#3770).

Other

  • Kotlin was updated to 2.0 (#4137).
  • Reworked the documentation for CoroutineStart and Channel-based API (#4147, #4148, #4167). Thanks, @globsterg!
  • Simplified the internal implementation of Job (#4053).
  • Small tweaks, fixes, and documentation improvements.

1.9.0-RC.2

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 13 Aug 11:25
  • Advanced the deprecation levels for BroadcastChannel-based API (#4197).
  • Advanced the deprecation levels for the old kotlinx-coroutines-test API (#4198).
  • Promoted CoroutineStart.ATOMIC from ExperimentalCoroutinesApi to DelicateCoroutinesApi (#4169).
  • Reworked the documentation for CoroutineStart and Channel-based API (#4147, #4148, #4167). Thanks, @globsterg!
  • Forbid casting a Mutex to Semaphore (#4176).
  • Deprecated Job.cancelFutureOnCompletion (#4156).
  • Worked around a stack overflow that may occur when calling asDeferred on a Future many times (#4156).
  • Fixed a bug that disallowed setting a custom probeCoroutineResumed when starting coroutines with UNDISPATCHED (#4162).
  • No longer initialize Dispatchers.IO on the JVM when other standard dispatchers are accessed (#4166). Thanks, @metalhead8816!
  • Small tweaks, fixes, and documentation improvements.

1.9.0-RC

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 28 May 17:30
  • Kotlin was updated to 2.0 (#4137).
  • Introduced the Flow<T>.chunked(size: Int): Flow<List<T>> operator that groups emitted values into groups of the given size (#1290).
  • Closeable dispatchers are instances of AutoCloseable now (#4123).
  • limitedParallelism now optionally accepts the name of the dispatcher view for easier debugging (#4023).
  • Marked the classes and interfaces that are not supposed to be inherited from with the new InternalForInheritanceCoroutinesApi opt-in (#3770).
  • Marked the classes and interfaces inheriting from which is not stable with the new ExperimentalForInheritanceCoroutinesApi opt-in (#3770).
  • Wasm/WASI target support (#4064). Thanks, @igoriakovlev!
  • Promoted CoroutineDispatcher.limitedParallelism to stable (#3864).
  • Promoted CancellableContinuation.resume with an onCancellation lambda to stable, providing extra arguments to the lambda (#4088).
  • Ensured a more intuitive ordering of tasks in runBlocking (#4134).
  • Simplified the internal implementation of Job (#4053).
  • Fixed a bug that prevented non-Android Dispatchers.Main from initializing when the Firebase dependency is used (#3914).
  • Calling hasNext on a Channel's iterator is idempotent (#4065). Thanks, @gitpaxultek!
  • CoroutineScope() created without an explicit dispatcher uses Dispatchers.Default on Native (#4074). Thanks, @whyoleg!
  • Small tweaks and documentation fixes.

1.8.1

Choose a tag to compare

@dkhalanskyjb dkhalanskyjb released this 10 May 10:43
  • Remove the @ExperimentalTime annotation from usages of TimeSource (#4046). Thanks, @hfhbd!
  • Introduce a workaround for an Android bug that caused an occasional NullPointerException when setting the StateFlow value on old Android devices (#3820).
  • No longer use kotlin.random.Random as part of Dispatchers.Default and Dispatchers.IO initialization (#4051).
  • Flow.timeout throws the exception with which the channel was closed (#4071).
  • Small tweaks and documentation fixes.