Releases: Kotlin/kotlinx.coroutines
Releases · Kotlin/kotlinx.coroutines
1.4.2
- Fixed
StackOverflowErrorinJob.toStringwhenJobis observed in its intermediate state (#2371). - Improved liveness and latency of
Dispatchers.DefaultandDispatchers.IOin low-loaded mode (#2381). - Improved performance of consecutive
Channel.cancelinvocations (#2384). SharingStartedis nowfuninterface (#2397).- Additional lint settings for
SharedFlowto catch programmatic errors early (#2376). - Fixed bug when mutex and semaphore were not released during cancellation (#2390, thanks to @Tilps for reproducing).
- Some corner cases in cancellation propagation between coroutines and listenable futures are repaired (#1442, thanks to @vadimsemenov).
- Fixed unconditional cast to
CoroutineStackFramein exception recovery that triggered failures of instrumented code (#2386). - Platform-specific dependencies are removed from
kotlinx-coroutines-javafx(#2360).
1.4.1
1.4.0
Improvements
StateFlow,SharedFlowand corresponding operators are promoted to stable API (#2316).Flow.debounceoperator with timeout selector based on each individual element is added (#1216, thanks to @mkano9!).CoroutineContext.jobextension property is introduced (#2159).Flow.combine operatoris reworked:- Complete fairness is maintained for single-threaded dispatchers.
- Its performance is improved, depending on the use-case, by at least 50% (#2296).
- Quadratic complexity depending on the number of upstream flows is eliminated (#2296).
crossinlineandinline-heavy internals are removed, fixing sporadic SIGSEGV on Mediatek Android devices (#1683, #1743).
Flow.zipoperator performance is improved by 40%.- Various API has been promoted to stable or its deprecation level has been raised (#2316).
Bug fixes
- Suspendable
stateInoperator propagates exception to the caller when upstream fails to produce initial value (#2329). - Fix
SharedFlowwith replay for subscribers working at different speed (#2325). - Do not fail debug agent installation when security manager does not provide access to system properties (#2311).
- Cancelled lazy coroutines are properly cleaned up from debug agent output (#2294).
BlockHoundfalse-positives are correctly filtered out (#2302, #2190, #2303).- Potential crash during a race between cancellation and upstream in
Observable.asFlowis fixed (#2104, #2299, thanks to @LouisCAD and @drinkthestars).
1.4.0-M1
Breaking changes
- The concept of atomic cancellation in channels is removed. All operations in channels
and correspondingFlowoperators are cancellable in non-atomic way (#1813). - If
CoroutineDispatcherthrowsRejectedExecutionException, cancel currentJoband schedule its execution toDispatchers.IO(#2003). CancellableContinuation.invokeOnCancellationis invoked if the continuation was cancelled while its resume has been dispatched (#1915).Flow.singleOrNulloperator is aligned with standard library and does not longer throwIllegalStateExceptionon multiple values (#2289).
New experimental features
SharedFlowprimitive for managing hot sources of events with support of various subscription mechanisms, replay logs and buffering (#2034).Flow.shareInandFlow.stateInoperators to transform cold instances of flow to hotSharedFlowandStateFlowrespectively (#2047).
Other
- Support leak-free closeable resources transfer via
onUndeliveredElementin channels (#1936). - Changed ABI in reactive integrations for Java interoperability (#2182).
- Fixed ProGuard rules for
kotlinx-coroutines-core(#2046, #2266). - Lint settings were added to
Flowto avoid accidental capturing of outerCoroutineScopefor cancellation check (#2038).
External contributions
- Allow nullable types in
Flow.firstOrNullandFlow.singleOrNullby @ansman (#2229). - Add
Publisher.awaitSingleOrDefault|Null|Elseextensions by @sdeleuze (#1993). awaitCancellationtop-level function by @LouisCAD (#2213).- Significant part of our Gradle build scripts were migrated to
.ktsby @turansky.
Thank you for your contributions and participation in the Kotlin community!
1.3.9
- Support of
CoroutineContextinFlow.asPublisherand similar reactive builders (#2155). - Kotlin updated to 1.4.0.
- Transition to new HMPP publication scheme for multiplatform usages:
- Artifacts
kotlinx-coroutines-core-commonandkotlinx-coroutines-core-nativeare removed. - For multiplatform usages, it's enough to depend directly on
kotlinx-coroutines-coreincommonMainsource-set. - The same artifact coordinates can be used to depend on a platform-specific artifact in platform-specific source-set.
- Artifacts
1.3.8
New experimental features
- Added
Flow.transformWhile operator(#2065). - Replaced
scanReducewithrunningReduceto be consistent with the Kotlin standard library (#2139).
Bug fixes and improvements
- Improve user experience for the upcoming coroutines debugger (#2093, #2118, #2131).
- Debugger no longer retains strong references to the running coroutines (#2129).
- Fixed race in
Flow.asPublisher(#2109). - Fixed
ensureActiveto work in the empty context case to fixIllegalStateExceptionwhen using flow fromsuspend fun main(#2044). - Fixed a problem with
AbortFlowExceptionin theFlow.firstoperator to avoid erroneousNoSuchElementException(#2051). - Fixed JVM dependency on Android annotations (#2075).
- Removed keep rules mentioning
kotlinx.coroutines.androidfrom core module (#2061 by @mkj-gram). - Corrected some docs and examples (#2062, #2071, #2076, #2107, #2098, #2127, #2078, #2135).
- Improved the docs and guide on flow cancellation (#2043).
- Updated Gradle version to
6.3(it only affects multiplatform artifacts in this release).
1.3.7
- Fixed problem that triggered Android Lint failure (#2004).
- New
Flow.cancellable()operator for cooperative cancellation (#2026). - Emissions from
flowbuilder now check cancellation status and are properly cancellable (#2026). - New
currentCoroutineContextfunction to use unambiguously in the contexts withCoroutineScopein receiver position (#2026). EXACTLY_ONCEcontract support in coroutine builders.- Various documentation improvements.
1.3.6
Flow
StateFlow, new primitive for state handling (#1973, #1816, #395). TheStateFlowis designed to eventually replaceConflatedBroadcastChannelfor state publication scenarios. Please, try it and share your feedback. Note, that Flow-based primitives to publish events will be added later. For events you should continue to either useBroadcastChannel(1), if you put events into theStateFlow, protect them from double-processing with flags.Flow.onEmptyoperator is introduced (#1890).- Behavioural change in
Flow.onCompletion, it is aligned withinvokeOnCompletionnow and passesCancellationExceptionto its cause parameter (#1693). - A lot of Flow operators have left its experimental status and are promoted to stable API.
Other
runInterruptibleprimitive to tie cancellation with thread interruption for blocking calls. Contributed by @jxdabc (#1947).- Integration module with RxJava3 is introduced. Contributed by @ZacSweers (#1883)
- Integration with BlockHound in
kotlinx-coroutines-debugmodule (#1821, #1060). - Memory leak in ArrayBroadcastChannel is fixed (#1885).
- Behavioural change in
suspendCancellableCoroutine, cancellation is established before invoking passed block argument (#1671). - Debug agent internals are moved into
kotlinx-coroutines-corefor better integration with IDEA. It should not affect library users and all the redundant code should be properly eliminated with R8. - ClassCastException with reusable continuations bug is fixed (#1966).
- More precise scheduler detection for
Executor.asCoroutineDispatcher(#1992). - Kotlin updated to 1.3.71.
1.3.5
Version 1.3.5
firstOrNulloperators. Contributed by @bradynpoulsenjava.timeadapters for Flow operators. Contributed by @fvascokotlin.time.Durationsupport (#1402). Contributed by @fvasco- Memory leak with a mix of reusable and non-reusable continuations is fixed (#1855)
DebugProbesare ready for production installation: its performance is increased, the flag to disable creation stacktraces to reduce the footprint is introduced (#1379, #1372)- Stacktrace recovery workaround for Android 6.0 and earlier bug (#1866).
- New integration module:
kotlinx-coroutines-jdk9with adapters forjava.util.concurrent.Flow BroadcastChannel.closeproperly starts lazy coroutine (#1713).kotlinx-coroutines-bomis published without Gradle metadata.- Make calls to service loader in reactor integrations optimizable by R8 (#1817)
1.3.4
Flow
- Detect missing
awaitClosecalls incallbackFlowto make it less error-prone when used with callbacks (#1762, #1770). This change makescallbackFlowdifferent fromchannelFlow ReceiveChannel.asFlowextension is introduced (#1490)- Enforce exception transparency invariant in
flowbuilder (#1657) - Proper
Dispatchersupport inFlowreactive integrations (#1765) - Batch
Subscription.requestcalls inFlowreactive integration (#766) ObservableValue.asFlowadded to JavaFx integration module (#1695)ObservableSource.asFlowadded to RxJava2 integration module (#1768)
Other changes
kotlinx-coroutines-coreis optimized for R8, making it much smaller for Android usages (75 KB for1.3.4release)- Performance of
Dispatchers.Defaultis improved (#1704, #1706) - Kotlin is updated to 1.3.70
CoroutineDispatcherandExecutorCoroutineDispatcherexperimental coroutine context keys are introduced (#1805)- Performance of various
Channeloperations is improved (#1565)