Releases: Kotlin/kotlinx.coroutines
1.3.3
Flow
Flow.takeperformance is significantly improved (#1538).Flow.mergeoperator (#1491).- Reactive Flow adapters are promoted to stable API (#1549).
- Reusable cancellable continuations were introduced that improved the performance of various flow operators and iteration over channels (#1534).
- Fixed interaction of multiple flows with
takeoperator (#1610). - Throw
NoSuchElementExceptioninstead ofUnsupportedOperationExceptionfor emptyFlowinreduceoperator (#1659). onCompletionnow rethrows downstream exceptions on emit attempt (#1654).- Allow non-emitting
withContextfromflowbuilder (#1616).
Debugging
DebugProbes.dumpCoroutinesis optimized to be able to print the 6-digit number of coroutines (#1535).- Properly capture unstarted lazy coroutines in debugger (#1544).
- Capture coroutines launched from within a test constructor with
CoroutinesTimeouttest rule (#1542). - Stacktraces of
Job-related coroutine machinery are shortened and prettified (#1574). - Stacktrace recovery unification that should provide a consistent experience recover of stacktrace (#1597).
- Stacktrace recovery for
withTimeoutis supported (#1625). - Do not recover exception with a single
Stringparameter constructor that is not amessage(#1631).
Other features
Dispatchers.DefaultandDispatchers.IOrework: CPU consumption is significantly lower, predictable idle threads termination (#840, #1046, #1286).- Avoid
ServiceLoaderfor loadingDispatchers.Main(#1572, #1557, #878, #1606). - Consistently handle undeliverable exceptions in RxJava and Reactor integrations (#252, #1614).
yieldsupport in immediate dispatchers (#1474).CompletableDeferred.completeWith(result: Result<T>)is introduced.- Added support for tvOS and watchOS-based Native targets (#1596).
Bug fixes and improvements
- Kotlin version is updated to 1.3.61.
CoroutineDispatcher.isDispatchNeededis promoted to stable API (#1014).- Livelock and stackoverflows in mutual
selectexpressions are fixed (#1411, #504). - Properly handle
nullvalues inListenableFutureintegration (#1510). - Making
ReceiveChannel.cancellinearizability-friendly. - Linearizability of
Channel.closein a complex contended cases (#1419). ArrayChannel.isBufferEmptyatomicity is fixed (#1526).- Various documentation improvements.
- Reduced bytecode size of
kotlinx-coroutines-core, reduced size of minifieddexwhen using basic functionality ofkotlinx-coroutines.
1.3.2
This is a maintenance release that does not include any new features or bug fixes.
- Reactive integrations for
Floware promoted to stable API. - Obsolete reactive API is deprecated.
- Deprecation level for API deprecated in 1.3.0 is increased.
- Various documentation improvements.
1.3.1
This is a minor update with various fixes:
- Flow: Fix recursion in combineTransform<T1, T2, R> (#1466).
- Fixed race in the Semaphore (#1477).
- Repaired some of ListenableFuture.kt's cancellation corner cases (#1441).
- Consistently unwrap exception in slow path of CompletionStage.asDeferred (#1479).
- Various fixes in documentation (#1496, #1476, #1470, #1468).
- Various cleanups and additions in tests.
Note: Kotlin/Native artifacts are now published with Gradle metadata format version 1.0, so you will need Gradle version 5.3 or later to use this version of kotlinx.coroutines in your Kotlin/Native project.
1.3.0
Flow
This version is the first stable release of Flow API.
All Flow API not marked with @FlowPreview or @ExperimentalCoroutinesApi annotations are stable and here to stay.
Flow declarations marked with @ExperimentalCoroutinesApi have the same guarantees as regular experimental API.
Please note that API marked with @FlowPreview have weak guarantees on source, binary and semantic compatibility.
Changelog
- A new guide section about Flow.
CoroutineDispatcher.asExecutorextension (#1450).- Fixed bug when
selectstatement could report the same exception twice (#1433). - Fixed context preservation in
flatMapMergein a case when collected values were immediately emitted to another flow (#1440). - Reactive Flow integrations enclosing files are renamed for better interoperability with Java.
- Default buffer size in all Flow operators is increased to 64.
- Kotlin updated to 1.3.50.
1.3.0-RC2
Flow improvements
-
Operators for UI programming are reworked for the sake of consistency, naming scheme for operator overloads is introduced:
combineLatestis deprecated in the favor ofcombine.combineTransformoperator for non-trivial transformations (#1224).- Top-level
combineandcombineTransformoverloads for multiple flows (#1262). switchMapis deprecated.flatMapLatest,mapLatestandtransformLatestare introduced instead (#1335).collectLatestterminal operator (#1269).
-
Improved cancellation support in
flattenMerge(#1392). -
channelFlowcancellation does not leak to the parent (#1334). -
Fixed flow invariant enforcement for
suspend fun main(#1421). -
delayEachanddelayFloware deprecated (#1429).
General changes
-
Integration with Reactor context
- Propagation of the coroutine context of
awaitcalls into Mono/Flux builder. - Publisher.asFlow propagates coroutine context from
collectcall to the Publisher. - New
Flow.asFluxbuilder.
- Propagation of the coroutine context of
-
ServiceLoader-code is adjusted to avoid I/O on the Main thread on newer (3.6.0+) Android toolchain.
-
Stacktrace recovery support for minified builds on Android (#1416).
-
Guava version in
kotlinx-coroutines-guavaupdated to28.0. -
setTimeout-based JS dispatcher for platforms whereprocessis unavailable (#1404). -
Native, JS and common modules are added to
kotlinx-coroutines-bom. -
Fixed bug with ignored
acquiredPermitsinSemaphore(#1423).
1.3.0-RC
Flow
- Core
FlowAPI is promoted to stable - New basic
Flowoperators:withIndex,collectIndexed,distinctUntilChangedoverload - New core
Flowoperators:onStartandonCompletion ReceiveChannel.consumeAsFlowandemitAll(#1340)
General changes
- Kotlin updated to 1.3.41
- Added
kotlinx-coroutines-bomwith Maven Bill of Materials (#1110) - Reactive integrations are seriously improved
- Stacktrace recovery for
suspend fun main(#1328) CoroutineScope.cancelextension with message (#1338)- Protection against non-monotonic clocks in
delay(#1312) Duration.ZEROis handled properly in JDK 8 extensions (#1349)- Library code is adjusted to be more minification-friendly
Version 1.3.0-M2
- Kotlin updated to 1.3.40.
Flowexception transparency concept.- New declarative
Flowoperators:onCompletion,catch,retryWhen,launchIn.onError*operators are deprecated in favour ofcatch. (#1263) Publisher.asFlowis integrated withbufferoperator.Publisher.openSubscriptiondefault request size is1instead of0(#1267).
Version 1.2.2
- Kotlin updated to 1.3.40.
1.3.0-M1
Flow:
- Core
Flowinterfaces and operators are graduated from preview status to experimental. - Context preservation invariant rework (#1210).
channelFlowandcallbackFlowreplacements forflowViaChannelfor concurrent flows or callback-based APIs.flowprohibits emissions from non-scoped coroutines by default and recommends to usechannelFlowinstead to avoid most of the concurrency-related bugs.
- Flow cannot be implemented directly
AbstractFlowis introduced for extension (e.g. for managing state) and ensures all context preservation invariants.
- Buffer size is decoupled from all operators that imply channel usage (#1233)
bufferoperator can be used to adjust buffer size of any buffer-dependent operator (e.g.channelFlow,flowOnandflatMapMerge).conflateoperator is introduced.
- Flow performance is significantly improved.
- New operators:
scan,scanReduce,first,emitAll. flowWithandflowViaChannelare deprecated.retryignores cancellation exceptions from upstream when the flow was externally cancelled (#1122).combineLatestoverloads for multiple flows (#1193).- Fixed numerical overflow in
dropoperator.
Channels:
consumeEachis promoted to experimental API (#1080).- Conflated channels always deliver the latest value after closing (#332, #1235).
- Non-suspending
ChannelIterator.nextto improve iteration performance (#1162). - Channel exception types are consistent with
produceand are no longer swallowed as cancellation exceptions in case of programmatic errors (#957, #1128). - All operators on channels (that were prone to coroutine leaks) are deprecated in the favor of
Flow.
General changes:
- Kotlin updated to 1.3.31
Semaphoreimplementation (#1088)- Loading of
Dispatchers.Mainis tweaked so the latest version of R8 can completely remove I/O when loading it (#1231). - Performace of all JS dispatchers is significantly improved (#820).
withContextchecks cancellation status on exit to make reasoning about sequential concurrent code easier (#1177).- Consistent exception handling mechanism for complex hierarchies (#689).
- Convenient overload for
CoroutinesTimeout.seconds(#1184). - Fix cancellation bug in onJoin (#1130).
- Prevent internal names clash that caused errors for ProGuard (#1159).
- POSIX's
nanosleepasdelayinrunBlockingin K/N (#1225).
1.2.1
Major:
- Infrastructure for testing coroutine-specific code in
kotlinx-coroutines-test:runBlockingTest,TestCoroutineScopeandTestCoroutineDispatcher, contributed by Sean McQuillan (@objcode). Job.asCompletableFutureextension in jdk8 module (#1113).
Flow improvements:
flowViaChannelrework: block parameter is no longer suspending, but providesCoroutineScopereceiver and allows conflated channel (#1081, #1112).- New operators:
switchMap,sample,debounce(#1107). consumerEachis deprecated for removal onPublisher,ObservableSourceandMaybeSource,collectextension is introduced instead (#1080).
Other: