Library support for Kotlin coroutines
update
, getAndUpdate
, and updateAndGet
operations of MutableStateFlow
(#2720).Executor.asCoroutineDispatcher
implementation improvements (#2601):
ScheduledExecutorService
, then its schedule
API is used for time-related coroutine operations.RemoveOnCancelPolicy
is now part of the public contract.Task.asDeferred
and Task.await
that accept CancellationTokenSource
for bidirectional cancellation (#2527).1.0.3
(#2740).CopyableThrowable
is allowed to modify the exception message during stacktrace recovery (#1931).CoroutineDispatcher.releaseInterceptedContinuation
is now a final
method (#2785).Handler.asCoroutineDispatcher
now causes the dispatched coroutines to be canceled on Dispatchers.IO (#2778)
.ClassCastException
in releaseInterceptedContinuation
and IllegalStateException
from tryReleaseClaimedContinuation
(#2736, #2768).CompletableFuture.asDeferred
when the target future has a long chain of listeners (#2730).CoroutineDispatcher.isDispatchNeeded
are now considered as fatal and are propagated to the caller (#2733).DebugProbesKt
(used in the debugger implementation) are moved from debug
to core
module.Note that this is a full changelog relative to 1.4.3 version. Changelog relative to 1.5.0-RC can be found in the end.
offer
, poll
, and sendBlocking
methods are deprecated, internal receiveCatching
and onReceiveCatching
removed, receiveOrNull
and onReceiveOrNull
are completely deprecated. Previously deprecated SendChannel.isFull
declaration is removed. Channel operators deprecated with ERROR
are now HIDDEN
.receiveCatching
, onReceiveCatching
trySend
, tryReceive
, and trySendBlocking
along with the new result type ChannelResult
are introduced. They provide better type safety, are less error-prone, and have a consistent future-proof naming scheme. The full rationale behind this change can be found here.BroadcastChannel
and ConflatedBroadcastChannel
are marked as ObsoleteCoroutinesApi
in the favor or SharedFlow
and StateFlow
. The migration scheme can be found in their documentation. These classes will be deprecated in the next major release.callbackFlow
and channelFlow
are promoted to stable API.kotlinx-coroutines-rx2
, kotlinx-coroutines-rx3
, kotlinx-coroutines-reactive
, kotlinx-coroutines-reactor
, and kotlinx-coroutines-jdk9
were revisited and promoted to stable (#2545).publish
is no longer allowed to emit null
values (#2646).awaitSingleOr*
functions on Publisher
type are deprecated (#2591).MaybeSource.await
is deprecated in the favor of awaitSingle
, additional lint functions for Mono
are added in order to prevent ambiguous Publisher
usages (#2628, #1587).ContextView
support in kotlinx-coroutines-reactor
(#2575).MaybeSource.collect
and Maybe.collect
properly finish when they are completed without a value (#2617).Flow.last
and Flow.lastOrNull
operators (#2246).Flow.runningFold
operator (#2641).CoroutinesTimeout
rule for JUnit5 (#2197).Job
and AbstractCoroutine
was reworked, resulting in smaller code size, less memory footprint, and better performance (#2513, #2512).CancellationException
from Kotlin standard library is used for cancellation on Koltin/JS and Kotlin/Native (#2638).DelicateCoroutinesApi
annotation that warns users about potential target API pitfalls and suggests studying API's documentation first. The only delicate API right now is GlobalScope
(#2637).1.4.3
when kotlinx-coroutines-core.jar
triggered IDEA debugger failure (#2619).ChildHandlerNode
with reusable continuations (#2564).emitAll
called from cancelled onCompletion
operator (#2700).stateIn
/shareIn
keep strong reference to sharing job (#2557).TimeSource
to AbstractTimeSource
due to import issues (#2691).watchosX64
target support for Kotlin/Native (#2524).offer
, poll
, and sendBlocking
methods are deprecated, internal receiveCatching
and onReceiveCatching
removed, receiveOrNull
and onReceiveOrNull
are completely deprecated. Previously deprecated SendChannel.isFull
declaration is removed. Channel operators deprecated with ERROR
are now HIDDEN
.receiveCatching
, onReceiveCatching
trySend
, tryReceive
, and trySendBlocking
along with the new result type ChannelResult
are introduced. They provide better type safety, are less error-prone, and have a consistent future-proof naming scheme. The full rationale behind this change can be found here.BroadcastChannel
and ConflatedBroadcastChannel
are marked as ObsoleteCoroutinesApi
in the favor or SharedFlow
and StateFlow
. The migration scheme can be found in their documentation. These classes will be deprecated in the next major release.callbackFlow
and channelFlow
are promoted to stable API.kotlinx-coroutines-rx2
, kotlinx-coroutines-rx3
, kotlinx-coroutines-reactive
, kotlinx-coroutines-reactor
, and kotlinx-coroutines-jdk9
were revisited and promoted to stable (#2545).publish
is no longer allowed to emit null
values (#2646).awaitSingleOr*
functions on Publisher
type are deprecated (#2591).MaybeSource.await
is deprecated in the favor of awaitSingle
, additional lint functions for Mono
are added in order to prevent ambiguous Publisher
usages (#2628, #1587).ContextView
support in kotlinx-coroutines-reactor
(#2575).MaybeSource.collect
and Maybe.collect
properly finish when they are completed without a value (#2617).Flow.last
and Flow.lastOrNull
operators (#2246).Flow.runningFold
operator (#2641).CoroutinesTimeout
rule for JUnit5 (#2197).Job
and AbstractCoroutine
was reworked, resulting in smaller code size, less memory footprint, and better performance (#2513, #2512).CancellationException
from Kotlin standard library is used for cancellation on Koltin/JS and Kotlin/Native (#2638).DelicateCoroutineApi
annotation that warns users about potential target API pitfalls and suggests studying API's documentation first. The only delicate API right now is GlobalScope
(#2637).1.4.3
when kotlinx-coroutines-core.jar
triggered IDEA debugger failure (#2619).ChildHandlerNode
with reusable continuations (#2564).ThreadContextElement
(#985)ThreadContextElement
s are now restored in the opposite order from update (#2195)kotlinx-coroutines-reactor
to 3.4.1
, thanks to @sokomishalov (#2432)callsInPlace
contract added to ReceiveChannel.consume
(#941)CoroutineStart.UNDISPATCHED
promoted to stable API (#1393)kotlinx.coroutines
are now released directly to MavenCentralDispatchedCoroutine
by a fieldTimeSource
renamed to SchedulerTimeSource
to prevent wildcard import issues (#2537)Job
interface (#2423)await
/asDeferred
for MinimalStage
implementations in jdk8 module (#2456)onUndeliveredElement
wasn't called for unlimited channels (#2435)ListenableFuture.isCancelled
returned from asListenableFuture
could have thrown an exception, thanks to @vadimsemenov (#2421)callbackFlow
and produce
is properly cancelled when the channel was closed separately (#2506)StackOverflowError
in Job.toString
when Job
is observed in its intermediate state (#2371).Dispatchers.Default
and Dispatchers.IO
in low-loaded mode (#2381).Channel.cancel
invocations (#2384).SharingStarted
is now fun
interface (#2397).SharedFlow
to catch programmatic errors early (#2376).CoroutineStackFrame
in exception recovery that triggered failures of instrumented code (#2386).kotlinx-coroutines-javafx
(#2360).This is a patch release with an important fix to the SharedFlow
implementation.
StateFlow
, SharedFlow
and corresponding operators are promoted to stable API (#2316).Flow.debounce
operator with timeout selector based on each individual element is added (#1216, thanks to @mkano9!).CoroutineContext.job
extension property is introduced (#2159).Flow.combine operator
is reworked:
crossinline
and inline
-heavy internals are removed, fixing sporadic SIGSEGV on Mediatek Android devices (#1683, #1743).Flow.zip
operator performance is improved by 40%.stateIn
operator propagates exception to the caller when upstream fails to produce initial value (#2329).SharedFlow
with replay for subscribers working at different speed (#2325).BlockHound
false-positives are correctly filtered out (#2302, #2190, #2303).Observable.asFlow
is fixed (#2104, #2299, thanks to @LouisCAD and @drinkthestars).Flow
operators are cancellable in non-atomic way (#1813).CoroutineDispatcher
throws RejectedExecutionException
, cancel current Job
and schedule its execution to Dispatchers.IO
(#2003).CancellableContinuation.invokeOnCancellation
is invoked if the continuation was cancelled while its resume has been dispatched (#1915).Flow.singleOrNull
operator is aligned with standard library and does not longer throw IllegalStateException
on multiple values (#2289).SharedFlow
primitive for managing hot sources of events with support of various subscription mechanisms, replay logs and buffering (#2034).Flow.shareIn
and Flow.stateIn
operators to transform cold instances of flow to hot SharedFlow
and StateFlow
respectively (#2047).onUndeliveredElement
in channels (#1936).kotlinx-coroutines-core
(#2046, #2266).Flow
to avoid accidental capturing of outer CoroutineScope
for cancellation check (#2038).Flow.firstOrNull
and Flow.singleOrNull
by @ansman (#2229).Publisher.awaitSingleOrDefault|Null|Else
extensions by @sdeleuze (#1993).awaitCancellation
top-level function by @LouisCAD (#2213)..kts
by @turansky.Thank you for your contributions and participation in the Kotlin community!
CoroutineContext
in Flow.asPublisher
and similar reactive builders (#2155).kotlinx-coroutines-core-common
and kotlinx-coroutines-core-native
are removed.kotlinx-coroutines-core
in commonMain
source-set.Flow.transformWhile operator
(#2065).scanReduce
with runningReduce
to be consistent with the Kotlin standard library (#2139).Flow.asPublisher
(#2109).ensureActive
to work in the empty context case to fix IllegalStateException
when using flow from suspend fun main
(#2044).AbortFlowException
in the Flow.first
operator to avoid erroneous NoSuchElementException
(#2051).kotlinx.coroutines.android
from core module (#2061 by @mkj-gram).6.3
(it only affects multiplatform artifacts in this release).