1.5.0
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.
Channels API
- Major channels API rework (#330, #974). Existing
offer,poll, andsendBlockingmethods are deprecated, internalreceiveCatchingandonReceiveCatchingremoved,receiveOrNullandonReceiveOrNullare completely deprecated. Previously deprecatedSendChannel.isFulldeclaration is removed. Channel operators deprecated withERRORare nowHIDDEN. - New methods
receiveCatching,onReceiveCatchingtrySend,tryReceive, andtrySendBlockingalong with the new result typeChannelResultare 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. BroadcastChannelandConflatedBroadcastChannelare marked asObsoleteCoroutinesApiin the favor orSharedFlowandStateFlow. The migration scheme can be found in their documentation. These classes will be deprecated in the next major release.callbackFlowandchannelFloware promoted to stable API.
Reactive integrations
- All existing API in modules
kotlinx-coroutines-rx2,kotlinx-coroutines-rx3,kotlinx-coroutines-reactive,kotlinx-coroutines-reactor, andkotlinx-coroutines-jdk9were revisited and promoted to stable (#2545). publishis no longer allowed to emitnullvalues (#2646).- Misleading
awaitSingleOr*functions onPublishertype are deprecated (#2591). MaybeSource.awaitis deprecated in the favor ofawaitSingle, additional lint functions forMonoare added in order to prevent ambiguousPublisherusages (#2628, #1587).ContextViewsupport inkotlinx-coroutines-reactor(#2575).- All reactive builders no longer ignore inner cancellation exceptions preventing their completion (#2262, #2646).
MaybeSource.collectandMaybe.collectproperly finish when they are completed without a value (#2617).- All exceptions are now consistently handled according to reactive specification, whether they are considered 'fatal' or not by reactive frameworks (#2646).
Other improvements
- Kotlin version is upgraded to 1.5.0 and JVM target is updated to 1.8.
Flow.lastandFlow.lastOrNulloperators (#2246).Flow.runningFoldoperator (#2641).CoroutinesTimeoutrule for JUnit5 (#2197).- Internals of
JobandAbstractCoroutinewas reworked, resulting in smaller code size, less memory footprint, and better performance (#2513, #2512). CancellationExceptionfrom Kotlin standard library is used for cancellation on Koltin/JS and Kotlin/Native (#2638).- Introduced new
DelicateCoroutinesApiannotation that warns users about potential target API pitfalls and suggests studying API's documentation first. The only delicate API right now isGlobalScope(#2637). - Fixed bug introduced in
1.4.3whenkotlinx-coroutines-core.jartriggered IDEA debugger failure (#2619). - Fixed memory leak of
ChildHandlerNodewith reusable continuations (#2564). - Various documentation improvements (#2555, #2589, #2592, #2583, #2437, #2616, #2633, #2560).
Changelog relative to version 1.5.0-RC
- Fail-fast during
emitAllcalled from cancelledonCompletionoperator (#2700). - Flows returned by
stateIn/shareInkeep strong reference to sharing job (#2557). - Rename internal
TimeSourcetoAbstractTimeSourcedue to import issues (#2691). - Reverted the change that triggered IDEA coroutines debugger crash (#2695, reverted #2291).
watchosX64target support for Kotlin/Native (#2524).- Various documentation fixes and improvements.