Releases: Kotlin/kotlinx.coroutines
Releases · Kotlin/kotlinx.coroutines
Version 1.3.0-M2
- Kotlin updated to 1.3.40.
Flow
exception transparency concept.- New declarative
Flow
operators:onCompletion
,catch
,retryWhen
,launchIn
.onError*
operators are deprecated in favour ofcatch
. (#1263) Publisher.asFlow
is integrated withbuffer
operator.Publisher.openSubscription
default request size is1
instead of0
(#1267).
Version 1.2.2
- Kotlin updated to 1.3.40.
1.3.0-M1
Flow:
- Core
Flow
interfaces and operators are graduated from preview status to experimental. - Context preservation invariant rework (#1210).
channelFlow
andcallbackFlow
replacements forflowViaChannel
for concurrent flows or callback-based APIs.flow
prohibits emissions from non-scoped coroutines by default and recommends to usechannelFlow
instead to avoid most of the concurrency-related bugs.
- Flow cannot be implemented directly
AbstractFlow
is 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)
buffer
operator can be used to adjust buffer size of any buffer-dependent operator (e.g.channelFlow
,flowOn
andflatMapMerge
).conflate
operator is introduced.
- Flow performance is significantly improved.
- New operators:
scan
,scanReduce
,first
,emitAll
. flowWith
andflowViaChannel
are deprecated.retry
ignores cancellation exceptions from upstream when the flow was externally cancelled (#1122).combineLatest
overloads for multiple flows (#1193).- Fixed numerical overflow in
drop
operator.
Channels:
consumeEach
is promoted to experimental API (#1080).- Conflated channels always deliver the latest value after closing (#332, #1235).
- Non-suspending
ChannelIterator.next
to improve iteration performance (#1162). - Channel exception types are consistent with
produce
and 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
Semaphore
implementation (#1088)- Loading of
Dispatchers.Main
is 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).
withContext
checks 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
nanosleep
asdelay
inrunBlocking
in K/N (#1225).
1.2.1
Major:
- Infrastructure for testing coroutine-specific code in
kotlinx-coroutines-test
:runBlockingTest
,TestCoroutineScope
andTestCoroutineDispatcher
, contributed by Sean McQuillan (@objcode). Job.asCompletableFuture
extension in jdk8 module (#1113).
Flow improvements:
flowViaChannel
rework: block parameter is no longer suspending, but providesCoroutineScope
receiver and allows conflated channel (#1081, #1112).- New operators:
switchMap
,sample
,debounce
(#1107). consumerEach
is deprecated for removal onPublisher
,ObservableSource
andMaybeSource
,collect
extension is introduced instead (#1080).
Other:
1.2.0
- Kotlin updated to 1.3.30.
- New API:
CancellableContinuation.resume
withonCancelling
lambda (#1044) to consistently handle closeable resources. - Play services task version updated to 16.0.1.
ReceiveChannel.isEmpty
is no longer deprecated
A lot of Flow
improvements:
- Purity property is renamed to context preservation and became more restrictive.
zip
andcombineLatest
operators.- Integration with RxJava2
flatMap
,merge
andconcatenate
are replaced withflattenConcat
,flattenMerge
,flatMapConcat
andflatMapMerge
.- Various documentation improvements and minor bug fixes.
Note that Flow
is not leaving its preview status.
1.2.0-alpha-2
This release contains major feature preview: cold streams aka Flow
(#254).
Performance:
- Performance of
Dispatcher.Main
initialization is significantly improved (#878).
1.2.0-alpha
- Major debug agent improvements. Real stacktraces are merged with coroutine stacktraces for running coroutines, merging heuristic is improved, API is cleaned up and is on its road to stabilization (#997).
CoroutineTimeout
rule for JUnit4 is introduced to simplify coroutines debugging (#938).- Stacktrace recovery improvements. Exceptions with custom properties are no longer copied,
CopyableThrowable
interface is introduced, machinery is documented (#921, #950). Dispatchers.Unconfined
,MainCoroutineDispatcher.immediate
,MainScope
andCoroutineScope.cancel
are promoted to stable API (#972).CompletableJob
is introduced (#971).- Structured concurrency is integrated into futures and listenable futures (#1007).
ensurePresent
andisPresent
extensions forThreadLocal
(#1028).ensureActive
extensions forCoroutineContext
,CoroutineScope
andJob
(#963).SendChannel.isFull
andReceiveChannel.isEmpty
are deprecated (#1053).withContext
checks cancellation on entering (#962).- Operator
invoke
onCoroutineDispatcher
(#428). - Java 8 extensions for
delay
andwithTimeout
now properly handle too large values (#428). - Performance of
Dispatcher.Main
initialization is significantly improved (#878). - A global exception handler for fatal exceptions in coroutines is introduced (#808, #773).
- Major improvements in cancellation machinery and exceptions delivery consistency. Cancel with custom exception is completely removed.
- Kotlin version is updated to 1.3.21.
- Do not use private API on newer Androids to handle exceptions (#822).
Bug fixes:
- Proper
select
support in debug agent (#931). - Proper
supervisorScope
support in debug agent (#915). - Throwing
initCause
does no longer trigger an internal error (#933). - Lazy actors are started when calling
close
in order to clean up their resources (#939). - Minor bugs in reactive integrations are fixed (#1008).
- Experimental scheduler shutdown sequence is fixed (#990).
1.1.1
1.1.0
Version 1.1.0
- Kotlin version updated to 1.3.11.
- Resumes of
CancellableContinuation
in the final state produceIllegalStateException
(#901). This change does not affect #830, races between resume and cancellation do not lead to an exceptional situation. runBlocking
is integrated withDispatchers.Unconfined
by sharing an internal event loop. This change does not affect the semantics of the previously correct code but allows to mix multiplerunBlocking
and unconfined tasks (#860).
1.1.0-alpha
Version 1.1.0-alpha
Major improvements in coroutines testing and debugging
- New module:
kotlinx-coroutines-debug
. Debug agent that improves coroutines stacktraces, allows to print all active coroutines and its hierarchies and can be installed as Java agent. - New module:
kotlinx-coroutines-test
. Allows setting arbitraryDispatchers.Main
implementation for tests (#810). - Stacktrace recovery mechanism. Exceptions from coroutines are recovered from current coroutine stacktraces to simplify exception diagnostic. Enabled in debug mode, controlled by
kotlinx.coroutines.debug
system property (#493).
Other improvements
MainScope
factory andCoroutineScope.cancel
extension (#829). One lineCoroutineScope
integration!CancellableContinuation
race betweenresumeWithException
andcancel
is addressed, exceptions during cancellation are no longer reported to exception handler (#830, #892).Dispatchers.Default
now consumes much less CPU on JVM (#840).- Better diagnostic and fast failure if an uninitialized dispatcher is used (#880).
- Conflated channel becomes linearizable.
- Fixed inconsistent coroutin es state when the result of the coroutine had type
DisposableHandle
(#835). - Fixed
JavaFx
initialization bug (#816). TimeoutCancellationException
is thrown bywithTimeout
instead ofCancellationException
if negative timeout is supplied (#870).- Kotlin/Native single-threaded workers support: coroutines can be safely used in multiple independent K/N workers.
- jsdom support in
Dispatchers.Default
on JS. - rxFlowable generic parameter is now restricted with Any.
- Guava 27 support in
kotlinx-coroutines-guava
. - Coroutines are now built with progressive mode.
- Various fixes in the documentation.