Skip to content
CAI
Software that uses CAICheck a score

Kotlin/kotlinx.coroutines

60.5

Adequate · 25 September 2026

87.9k

lines of production code

Kotlin

primary language

3

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the kotlinx-coroutines library, a comprehensive toolkit for asynchronous programming in Kotlin that provides structured concurrency, coroutines, and reactive streams. It offers core primitives like Flow, Channel, and Dispatcher, along with extensive integration modules for Java, Android, JavaFX, Swing, RxJava, Reactor, and Google Play Services. The library supports multiplatform execution across JVM, Native, JavaScript, and WebAssembly, and includes dedicated testing utilities and debugging agents to ensure reliability and performance.

How it got here

2016–2019 — Flow API introduction and platform dispatchers

88 changes.

This period focused on introducing the Flow reactive stream API with comprehensive operators and sharing capabilities, while simultaneously expanding platform-specific support for Android, JavaFX, and Swing. The core library underwent significant internal refactoring to stabilize APIs, improve scheduling performance, and consolidate common code across JVM, JS, and Native targets.

2020–2021 — multiplatform expansion and reactive integrations

53 changes.

This period focused on expanding the library's multiplatform support by introducing native concurrency primitives, Darwin-specific dispatchers, and a comprehensive test framework with virtual time control. It also significantly broadened reactive ecosystem integration by adding stable APIs for RxJava 3, RxJava 2, Project Reactor, and Java 9/10/11 Flow, alongside new debugging and testing utilities.

2022–2026 — WebAssembly and Web platform support

30 changes.

This period focused on introducing initial runtime support for JavaScript, WebAssembly (Wasm/WASI), and web environments, including core dispatchers, flow implementations, and test utilities. Concurrently, the project expanded JVM-specific interoperability with Java 8 features like CompletableFuture and java.time, while strengthening integration testing and benchmarking infrastructure across these new and existing platforms.

Features

Add CoroutineDispatcher integration for RxJava2 Schedulers

Users can now seamlessly bridge RxJava2 and Kotlin coroutines in the kotlinx-coroutines-rx2 module. The new RxScheduler.kt file introduces extension functions to convert an RxJava2 Scheduler into a CoroutineDispatcher (asCoroutineDispatcher) and vice versa (asScheduler), enabling native support for coroutine features like delay and withTimeout when scheduling work on RxJava schedulers.

kotlinx-coroutines-rx2 · high confidence

Add CoroutinesTimeout for JUnit 4 and JUnit 5

Introduces a new \CoroutinesTimeout\ rule for JUnit 4 and a \CoroutinesTimeout\ annotation with a corresponding extension for JUnit 5. These tools allow tests to run with a specified timeout; if a test hangs, the extension dumps coroutine information to aid debugging and can optionally cancel the hanging coroutines. This provides a specialized timeout mechanism that integrates with the kotlinx-coroutines-debug probes, distinct from standard JUnit timeout features.

kotlinx-coroutines-debug/src/junit · high confidence

Add Gradle wrapper configuration for integration tests

The integration-testing/gradle area now includes a Gradle wrapper properties file that configures the build to use Gradle version 8.14.4. This ensures that integration tests run with a consistent and reproducible Gradle environment, downloading the specified distribution from the official services URL with SHA-256 validation enabled.

integration-testing/gradle · high confidence

Add JPMS module support for kotlinx-coroutines-slf4j

The kotlinx-coroutines-slf4j integration module now includes a module-info.java file, enabling Java Platform Module System (JPMS) compatibility. This allows the library to be properly used within modular Java applications that rely on the Java module path, ensuring correct dependency resolution for the SLF4J MDC context integration.

integration/kotlinx-coroutines-guava, integration/kotlinx-coroutines-slf4j · high confidence

Add JVM ExecutorRule and platform-specific TestBase implementations for test-utils

The test-utils module now includes a new ExecutorRule for the JVM target, which provides a JUnit rule that manages a fixed-thread-pool coroutine dispatcher to ensure tests run with predictable threading and clean up resources. Additionally, platform-specific TestBase implementations have been added for JVM, Native, and Wasm/Wasi targets, standardizing how tests handle output capture, exception tracking, and stress-test multipliers across different environments.

test-utils · high confidence

Add JavaFX and Swing main thread dispatchers

The library now provides built-in support for scheduling coroutines on the JavaFX and Swing event dispatch threads. This is achieved by adding META-INF service provider files that register JavaFxDispatcherFactory and SwingDispatcherFactory, allowing users to use the standard coroutine dispatchers on these UI platforms without manual configuration.

ui/kotlinx-coroutines-javafx/resources, ui/kotlinx-coroutines-swing/resources · high confidence

Add MDCContext for SLF4J MDC propagation in coroutines

The kotlinx-coroutines-slf4j module now includes an MDCContext class that implements ThreadContextElement to propagate SLF4J MDC context maps across coroutine suspensions. This allows MDC key-value pairs set in the coroutine's context to be automatically restored when the coroutine resumes, ensuring consistent logging context. Users must use withContext(MDCContext()) to capture and restore updated MDC context changes within coroutines, as direct MDC.put calls inside suspended coroutines will not persist across suspension points.

kotlinx-coroutines-slf4j · high confidence

Add Reactor Scheduler integration for coroutine dispatching

Users can now convert a Reactor Scheduler into a Kotlin CoroutineDispatcher via the new \asCoroutineDispatcher()\ extension function. This allows coroutine execution and delay operations to be scheduled on arbitrary Reactor schedulers, enabling seamless integration between Reactor's concurrency model and Kotlin coroutines.

kotlinx-coroutines-reactor · high confidence

Add RxJava 2 and Coroutines benchmarks for Scrabble and channel performance

New JMH benchmarks have been added to measure the performance of reactive streams and coroutine channels. This includes a 'Reactive scrabble' benchmark comparing RxJava 2 Flowable implementations (including an optimized variant with custom CharSequence handling) against the existing Kotlin coroutines implementation, as well as new benchmarks for channel sink performance, dispatcher parametrization, sequential semaphores, Akka actor ping-pong and stateful patterns, and debug sequence overhead.

benchmarks/src/jmh · high confidence

Add Swing dispatcher with native delay support

Introduces a new \Dispatchers.Swing\ property that allows coroutines to execute on the Swing Event Dispatch Thread. This dispatcher provides native support for \delay\ and timeouts using \javax.swing.Timer\, enabling asynchronous operations like delays to be handled directly on the UI thread without blocking it.

kotlinx-coroutines-swing · high confidence

Add UI coroutines documentation and Knit configuration

This change introduces the initial documentation structure for UI programming with coroutines. It adds a README outlining the available modules (Android, JavaFX, Swing) and their corresponding \Dispatchers.Main\ contexts. It also includes a comprehensive guide (\coroutines-guide-ui.md\) covering setup, basic coroutine usage, cancellation, actors, and blocking operations for JavaFX and Android, along with the necessary Knit tool configuration files (\knit.code.include\, \knit.properties\) to generate runnable code examples from the documentation.

ui · high confidence

Add WASM-JS test builder implementation

The kotlinx-coroutines-test module now supports the WASM-JS target. This change introduces the TestBuilders.kt file for this platform, which implements the necessary test result handling using JavaScript promises and provides stubs for coroutine dumping and system property retrieval.

kotlinx-coroutines-test/wasmJs/src · high confidence

Add Wasm/WASI target support for test utilities

The test utilities now support the Wasm/WASI platform. A new \TestBase.kt\ implementation has been added to \test-utils/wasmJs\, providing the necessary platform-specific test infrastructure, including promise-based asynchronous test execution and exception handling tailored for the Wasm environment.

test-utils/wasmJs · high confidence

Add internal implementation layer for JS and Wasm targets

This change introduces a new \jsAndWasmShared\ source set within \kotlinx-coroutines-core\, providing platform-specific internal implementations for core concurrency primitives. The new files implement stubs and simplified logic for synchronization (e.g., \NoOpLock\, \SynchronizedObject\), atomic operations (\LocalAtomicInt\, \WorkaroundAtomicReference\), data structures (\LockFreeLinkedListNode\), and context management (e.g., \CommonThreadLocal\, \StackTraceRecovery\). This enables the coroutines library to function on JavaScript and WebAssembly targets by supplying the necessary internal infrastructure that was previously missing or handled differently.

kotlinx-coroutines-core/jsAndWasmShared/src/internal · high confidence

Add kotlinx-coroutines-test support for Wasm/WASI targets

The kotlinx-coroutines-test library now includes a new Wasm/WASI target, enabling coroutine testing capabilities on WebAssembly platforms. This addition provides platform-specific implementations for test builders, the main dispatcher, and test result handling, allowing developers to write and run tests for their Wasm/WASI applications using the standard coroutines-test API.

kotlinx-coroutines-test/wasmWasi · high confidence

Add trySendBlocking and deprecate sendBlocking for SendChannel

A new \trySendBlocking\ extension function is added to \SendChannel\, allowing callers to safely add elements to a full channel by blocking the current thread (via \runBlocking\) and returning a \ChannelResult\ that indicates success or closure. The existing \sendBlocking\ function is deprecated in favor of \trySendBlocking\, encouraging explicit handling of the result and proper exception management when the channel is closed.

kotlinx-coroutines-core/concurrent/src/channels · high confidence

Added geometric distribution benchmark utility

A new utility function, doGeomDistrWork, has been added to the benchmarking suite to simulate workloads using a geometric distribution. This helper is used to ensure that benchmark iterations reflect realistic, variable execution times rather than uniform delays, providing more accurate performance measurements for flow operations.

benchmarks/src/main · high confidence

Added multiplatform benchmark suite for kotlinx-coroutines-core

A new multiplatform benchmark project has been added to the kotlinx-coroutines-core module, providing performance measurement capabilities for JVM and Native targets. This suite includes JMH-based benchmarks for core synchronization primitives (Semaphore), channel operations (Producer/Consumer, Select, SimpleChannel variants), and Flow operators (TakeWhile), alongside a README detailing usage via Gradle tasks for generating benchmark JARs and running them on supported platforms.

kotlinx-coroutines-core/benchmarks · high confidence

Added script to visualize Flow.flattenMerge benchmark results

A new Python script, generate\_plots\_flow\_flatten\_merge.py, has been added to the benchmarks/scripts directory. This tool reads JMH benchmark results for the Flow.flattenMerge operation from a CSV file and generates an SVG plot showing throughput (elements per millisecond) against concurrency levels, with separate series for different flow number strategies. This allows users to visually analyze the performance characteristics of the flattenMerge functionality under varying concurrency and flow counts.

benchmarks/scripts · high confidence

Adds JavaScript-specific test builder implementation

Introduces the JS platform implementation for kotlinx-coroutines-test, defining how test results are created as JS promises and providing empty stubs for coroutine dumping and system property retrieval specific to the JavaScript environment.

kotlinx-coroutines-test/js/src · high confidence

Initial Wasm/JS target support for kotlinx-coroutines-core

This change introduces the Wasm/JS platform target for kotlinx-coroutines-core, providing the necessary runtime infrastructure to run coroutines in WebAssembly environments. It includes platform-specific implementations for the default coroutine dispatcher (supporting Node.js \nextTick\ and browser \setTimeout\/\postMessage\ mechanisms), debug utilities, and internal data structures like \CopyOnWriteList\. Additionally, it adds a test to verify that uncaught exceptions are correctly propagated in this environment and introduces a deprecated \promise\ builder overload that accepts a \Job\.

kotlinx-coroutines-core/wasmJs · high confidence

Initial implementation of kotlinx-coroutines-core for JS and Wasm targets

This change introduces the core coroutine runtime implementation for the new JavaScript and Wasm/WASI targets. It provides the foundational \CoroutineDispatcher\ and \CoroutineContext\ logic required for scheduling and context management on these platforms, including specific handling for default dispatchers and coroutine context combination. The implementation also defines platform-specific exception types (such as \CancellationException\ and \JobCancellationException\) and internal task scheduling structures (\SchedulerTask\, \Runnable\), ensuring that core coroutine behaviors like cancellation and context propagation function correctly in JS and Wasm environments.

kotlinx-coroutines-core/jsAndWasmShared/src · high confidence

Initial public API for kotlinx-coroutines-rx3 integration

This release introduces the public API surface for integrating Kotlin Coroutines with RxJava 3. Users can now bridge the two reactive streams using conversion functions such as \asFlow\, \asFlowable\, \asObservable\, and \from\ to convert between Kotlin \Flow\/\Deferred\ and RxJava types like \Flowable\, \Observable\, \Single\, \Maybe\, and \Completable\. The library also provides \rxFlowable\, \rxObservable\, \rxSingle\, \rxMaybe\, and \rxCompletable\ to create RxJava observables from coroutine blocks, \await\*\ functions to suspend until RxJava results are available, and \asScheduler\/\asCoroutineDispatcher\ to allow using RxJava Schedulers as coroutine dispatchers and vice versa.

reactive/kotlinx-coroutines-rx3/api · high confidence

Initial support for the Wasm/WASI target in kotlinx-coroutines-core

This change introduces the Wasm/WASI platform implementation for kotlinx-coroutines-core, enabling coroutines to run on WebAssembly System Interface environments. The new source files provide platform-specific implementations for core runtime components: Debug utilities (Debug.kt), the event loop and default executor backed by WASI system calls like poll\_oneoff and clock\_time\_get (EventLoop.kt), exception handling that writes to stderr and exits the process (CoroutineExceptionHandlerImpl.kt), and a test coroutine runner (CoroutineRunner.kt). This allows users to build and run Kotlin coroutines in WASI-compatible runtimes.

kotlinx-coroutines-core/wasmWasi · high confidence

Introduce JVM coroutine debugging infrastructure

This change adds the core implementation for the JVM coroutine debugger within the \kotlinx-coroutines-core\ module. It introduces \DebugProbesImpl\ to manage the installation and uninstallation of the debug agent, including a dedicated background thread for cleaning up weak references to prevent memory leaks. The update also adds \ConcurrentWeakMap\ for efficient, lock-free storage of coroutine data and \ArtificialStackFrames\ to provide clear, tooling-friendly markers in stack traces that distinguish coroutine creation and boundary points from actual code execution.

kotlinx-coroutines-core/jvm/src/debug · high confidence

Introduce JavaFX dispatcher with native delay and pulse support

Adds a new \kotlinx-coroutines-javafx\ module providing \Dispatchers.JavaFx\ to run coroutines on the JavaFX application thread. This dispatcher includes native \delay\ support using JavaFX \Timeline\ and introduces \awaitPulse()\ to suspend until the next JavaFX pulse. It also handles platform initialization robustly, attempting public JavaFX APIs before falling back to reflection on private APIs to ensure compatibility across Java versions.

kotlinx-coroutines-javafx · high confidence

Introduce kotlinx-coroutines-reactive module for Reactive Streams integration

This change introduces the new \kotlinx-coroutines-reactive\ module, providing utilities to bridge Kotlin Coroutines with the Reactive Streams specification. It adds suspending extension functions on \Publisher\ (such as \awaitFirst\, \awaitSingle\, and \collect\) to consume reactive streams without blocking, and conversion functions (\asFlow\ and \asPublisher\) to transform between \Publisher\ and \Flow\. The module also includes a \publish\ builder to create cold reactive publishers from coroutine blocks and supports context propagation with Reactor via a ServiceLoader-based \ContextInjector\ mechanism.

reactive/kotlinx-coroutines-reactive · high confidence

Introduce kotlinx-coroutines-reactor module for Reactor integration

Adds the new kotlinx-coroutines-reactor module, providing utilities to bridge Kotlin coroutines with Project Reactor. This includes coroutine builders (mono, flux) that create cold reactive streams from suspend blocks, conversion functions (Flow.asFlux, Job.asMono, Deferred.asMono) to interoperate between Flow/Deferred and Reactor types, and suspending extension functions (Mono.awaitSingle, Mono.awaitSingleOrNull) to consume Reactor publishers without blocking. The module also features ReactorContext for seamless propagation of Reactor Context elements into and out of coroutines, and includes a ContextInjector service provider for automatic context injection.

reactive/kotlinx-coroutines-reactor · high confidence

Introduce kotlinx-coroutines-rx2 module for RxJava 2.x integration

This change introduces the new \kotlinx-coroutines-rx2\ module, providing utilities to bridge RxJava 2.x types with Kotlin Coroutines. Users can now create cold reactive streams from coroutines using builders like \rxCompletable\, \rxMaybe\, \rxSingle\, \rxObservable\, and \rxFlowable\ (which supports backpressure). The module also adds conversion functions to transform \Flow\ into \Observable\ or \Flowable\, and \ObservableSource\ into \Flow\. Additionally, it provides suspending extension functions such as \await\, \awaitSingle\, \awaitFirst\, and \collect\ to interact with RxJava types without blocking threads.

reactive/kotlinx-coroutines-rx2 · high confidence

Introduce multiplatform kotlinx-coroutines-test with virtual time control

The test module is now a Multiplatform (MPP) library, consolidating common test infrastructure into shared code. This introduces \runTest\ as the primary entry point for executing tests with automatic delay-skipping via a \TestCoroutineScheduler\, allowing tests to run instantly without real-time waits. Users can now control virtual time using \advanceTimeBy\, \advanceUntilIdle\, and \runCurrent\, and manage long-running background tasks using the new \backgroundScope\ property on \TestScope\. The module also provides \StandardTestDispatcher\ and \UnconfinedTestDispatcher\ for predictable task scheduling, and allows mocking \Dispatchers.Main\ via \setMain\ and \resetMain\.

kotlinx-coroutines-test/common/src · high confidence

Introduce shared JS/Wasm dispatcher implementation and tests

Adds a new \jsAndWasmShared\ module providing a shared implementation of \Dispatchers\ for JavaScript and WebAssembly targets. This includes a \JsMainDispatcher\ that handles immediate dispatching logic and allows for main dispatcher injection, along with corresponding tests for the immediate dispatcher behavior and internal linked-list utilities.

kotlinx-coroutines-core/jsAndWasmShared · high confidence

Introduces Flow, SharedFlow, and StateFlow APIs with hot/cold stream semantics

This change adds the core reactive stream abstractions to kotlinx-coroutines-core, including the cold Flow interface and builders (flow, flowOf, asFlow), the MutableStateFlow and MutableSharedFlow constructors for hot streams, and the shareIn/stateIn operators for converting cold flows to shared ones. It also provides SharingStarted strategies (Eagerly, Lazily, WhileSubscribed) to control upstream collection lifecycles, migration stubs for deprecated Rx-style APIs (observeOn, subscribeOn, flatMap), and channel-to-flow conversions (receiveAsFlow, consumeAsFlow, emitAll).

kotlinx-coroutines-core/common/src/flow · high confidence

Introduction of new Flow operators and sharing capabilities

This release introduces a comprehensive set of new Flow operators and sharing mechanisms. Key additions include \shareIn\ and \stateIn\ for converting cold flows into hot SharedFlow and StateFlow instances with configurable replay and start strategies, as well as \SharedFlow\ and \StateFlow\ implementations themselves. New transformation and limiting operators include \buffer\, \conflate\, \debounce\, \distinctUntilChanged\, \drop\, \take\, \takeWhile\, \dropWhile\, \transformWhile\, \flatMapConcat\, \flatMapMerge\, \flatMapLatest\, \transformLatest\, \flattenConcat\, \flattenMerge\, and \merge\. Error handling and lifecycle operators have been expanded with \onStart\, \onCompletion\, \onEmpty\, \catch\, \retry\, and \retryWhen\. Additionally, lint warnings and deprecations have been added to prevent misuse of operators like \cancellable\ or \flowOn\ on SharedFlow, and to warn against using \SharedFlow.last()\ or terminal operations that never complete.

kotlinx-coroutines-core/common/src/flow/operators · high confidence

JS-specific coroutine testing infrastructure added

The library now includes JS-specific internal components to support coroutine testing on JavaScript targets. A new \JsPromiseInterfaceForTesting\ class provides a non-parametric interface to JavaScript's native \Promise\<Unit\>\, resolving issues with typealias instantiation in the expect/actual mechanism. Additionally, a \TestMainDispatcher\ implementation is introduced for JS, which retrieves or injects the test main dispatcher, ensuring proper integration with the Kotlin 2 compiler's visibility rules.

kotlinx-coroutines-test/js/src/internal · high confidence

JVM-specific test infrastructure and JPMS module support

This change introduces JVM-specific implementations for the test module, including a new TestBuildersJvm.kt file that handles test result creation, system property access, and coroutine debugging dumps, alongside a module-info.java file to enable Java Platform Module System (JPMS) compatibility by declaring module dependencies and service provider interfaces.

kotlinx-coroutines-test/jvm · high confidence

Java 8 Time API adapters for Flow debounce and sample

The kotlinx-coroutines-jdk8 module now exposes adapters for java.time types, specifically enabling Flow.debounce and Flow.sample operations to work directly with Java 8 time durations. This allows users to utilize standard java.time.Duration objects for timing control in coroutine flows without manual conversion.

integration/kotlinx-coroutines-jdk8/api · high confidence

Native test module implementation for coroutine testing

The kotlinx-coroutines-test module now includes a concrete implementation for the Native platform, providing the necessary test builders and internal dispatchers to support coroutine testing on Native targets. This change introduces the TestBuilders and TestMainDispatcher components, enabling developers to write and run tests using the standard test utilities on Native platforms.

kotlinx-coroutines-test/native · high confidence

New API for converting between Kotlin Coroutines and Google Play Services Tasks

The kotlinx-coroutines-play-services module now exposes extension functions to bridge Kotlin Coroutines and Google Play Services Tasks. Users can convert a Task to a Deferred using asDeferred (with optional CancellationTokenSource support), convert a Deferred back to a Task using asTask, and await a Task's result using the await function (also supporting CancellationTokenSource). This enables seamless integration between coroutine-based code and legacy Play Services APIs.

integration/kotlinx-coroutines-play-services/api · high confidence

New HandlerDispatcher API and awaitFrame() for Android coroutines

The kotlinx-coroutines-android library introduces a new \HandlerDispatcher\ sealed class and a public \Handler.asCoroutineDispatcher()\ extension function, allowing developers to create coroutine dispatchers from arbitrary Android \Handler\ instances with optional naming for debugging. Additionally, a new \awaitFrame()\ suspend function is added to wait for the next animation frame, and the internal \HandlerContext\ implementation now includes logic to cancel the current Job and fallback to \Dispatchers.IO\ if the underlying \Handler\ rejects a task (e.g., when closed), preventing resource leaks.

kotlinx-coroutines-android · high confidence

New JDK 9 Flow integration module

Adds the kotlinx-coroutines-jdk9 module, providing utilities to bridge Java 9's java.util.concurrent.Flow API with Kotlin coroutines. Users can now convert Java Flow Publishers to Kotlin Flows via asFlow(), convert Kotlin Flows to Java Flow Publishers via asPublisher(), and suspend to await values from a Publisher using functions like awaitFirst() and awaitSingle(). The module also includes a flowPublish() builder to create cold Java Flow Publishers from coroutine blocks and supports JPMS via a module-info.java descriptor.

reactive/kotlinx-coroutines-jdk9 · high confidence

New JVM test utilities for exception handling, thread inspection, and object graph walking

The test-utils/jvm module now includes new helper classes to improve test reliability and debugging. Exceptions.kt provides utilities to capture and assert unhandled coroutine exceptions, including cycle detection in throwables. FieldWalker.kt introduces a reflective object-graph walker to inspect reachable objects and verify memory usage or leaks in tests. Threads.kt adds functions to enumerate current threads, dump thread stacks for debugging, and check for lost threads after test execution to detect resource leaks.

test-utils/jvm · high confidence

New JVM-specific Stream and Time adapter APIs

The library now includes new extension functions for JVM users: \Stream.consumeAsFlow()\ allows Java streams to be consumed as a single-use Flow with automatic resource cleanup, and the \kotlinx.coroutines.time\ package provides \java.time.Duration\-based adapters for core timing functions (\delay\, \debounce\, \sample\, \onTimeout\, \withTimeout\, \withTimeoutOrNull\), handling necessary coercion to milliseconds for compatibility.

kotlinx-coroutines-core/jvm/src/stream, kotlinx-coroutines-core/jvm/src/time · high confidence

New JVM-specific coroutine builders for Java CompletableFuture integration

Adds new extension functions to the JVM source set to bridge Kotlin coroutines with Java's \java.util.concurrent.CompletableFuture\. The \future\ builder allows launching a coroutine that returns a \CompletableFuture\, supporting structured concurrency (with a deprecated overload accepting a \Job\ to warn against breaking this model). Additionally, \asCompletableFuture\ extensions are added for \Deferred\ and \Job\ to convert them to futures, while \CompletionStage.asDeferred\ and its corresponding \await\ suspending function enable non-blocking waiting on Java completion stages.

kotlinx-coroutines-core/jvm/src/future · high confidence

New JavaFX and Swing coroutine modules with JavaFX ObservableValue support

This change introduces two new modules, kotlinx-coroutines-javafx and kotlinx-coroutines-swing, which provide Dispatchers.JavaFx and Dispatchers.Swing respectively for running coroutines on their corresponding UI threads. The JavaFX module specifically adds an asFlow() extension on ObservableValue, allowing UI state changes to be observed as conflated flows, and includes explicit module-info.java files for Java Platform Module System (JPMS) compatibility in both modules.

ui/kotlinx-coroutines-javafx · high confidence

New ListenableFuture integration APIs

Adds new extension functions to bridge Guava's ListenableFuture with Kotlin coroutines: CoroutineScope.future() creates a ListenableFuture from a coroutine block, ListenableFuture.asDeferred() converts a ListenableFuture into a Deferred, and Deferred.asListenableFuture() (implied by context of similar modules, though only the first two are fully visible in the diff excerpt, the file name and imports suggest a symmetric set) allows the reverse. These functions handle bidirectional cancellation propagation and exception mapping, enabling seamless interoperability between Guava futures and structured concurrency.

kotlinx-coroutines-guava · high confidence

New Reactor integration API for context propagation and conversion

This release introduces the public API surface for integrating Kotlin Coroutines with Project Reactor. Users can now convert Coroutines Flow and Deferred/Job objects into Reactor Flux and Mono types while explicitly passing a CoroutineContext to control execution context and cancellation behavior. New utility classes, ReactorContext and SchedulerCoroutineDispatcher, allow seamless bridging of Reactor's Context and Scheduler abstractions into the Coroutines world, enabling better interoperability and context propagation between the two reactive ecosystems.

reactive/kotlinx-coroutines-reactor/api · high confidence

New actor and ticker channel APIs

This change introduces two new coroutine builders in the channels package: \actor\, which creates a coroutine that processes messages from a mailbox channel (replacing the older, now-deprecated patterns), and \ticker\, which produces periodic events with configurable delay modes (fixed period or fixed delay). The \actor\ builder supports lazy start modes and structured concurrency via parent jobs, while \ticker\ operates in GlobalScope and is marked as obsolete pending future structured concurrency integration.

kotlinx-coroutines-core/jvm/src/channels · high confidence

New binary API for RxJava 2 integration

The public API surface for the kotlinx-coroutines-rx2 module has been updated to include new conversion and creation functions. Users can now convert RxJava 2 types (Observable, Flowable, Single, Maybe, Completable) to Kotlin Flows and Channels, and vice versa, with explicit CoroutineContext support for backpressure and scheduling. Additionally, new functions allow creating RxJava 2 types directly from coroutines, and a new SchedulerCoroutineDispatcher enables using a CoroutineDispatcher as an RxJava Scheduler.

reactive/kotlinx-coroutines-rx2/api · high confidence

New concurrent coroutine builders and dispatchers for Kotlin/Native

The library now provides \runBlocking\, \Dispatchers.IO\, \newSingleThreadContext\, and \newFixedThreadPoolContext\ implementations for Kotlin/Native, enabling concurrent coroutine execution on this platform. \runBlocking\ bridges blocking code to suspending style with structured concurrency and event loop support, while \Dispatchers.IO\ offers an elastic, shared thread pool for blocking I/O tasks. The new thread-pool builders are marked as delicate APIs requiring explicit resource management via \close()\. These additions are backed by a lock-free doubly-linked list implementation for internal concurrency primitives.

kotlinx-coroutines-core/concurrent/src · high confidence

New coroutine debugging and BlockHound integration module

The kotlinx-coroutines-debug module now provides a comprehensive debugging API and automatic compatibility with Reactor's BlockHound. Users can install dynamic probes to inspect coroutine states, dump hierarchical job trees, and capture creation stack traces via the new DebugProbes API and CoroutineInfo class. Additionally, the module includes a CoroutinesBlockHoundIntegration that automatically allows safe blocking calls within coroutine internals (such as JobSupport, Channels, and Flows), preventing false-positive violations when running coroutines alongside reactive libraries.

kotlinx-coroutines-debug/src · high confidence

New coroutine testing utilities and test base refactoring

The test utilities module now includes a new \LaunchFlow\ builder for structured flow collection with exception handling, a \MainDispatcherTestBase\ for validating main-thread dispatching behavior, and a refactored \TestBase\ with improved error catching and ordered execution tracking. These changes provide more robust and consistent testing facilities for coroutine-based code across platforms.

test-utils/common · high confidence

New integration module for Google Play Services Tasks API

Adds the \kotlinx-coroutines-play-services\ module, providing extension functions to bridge Google Play Services \Task\ objects with Kotlin Coroutines. Users can now convert a \Task\ to a \Deferred\ via \asDeferred()\ or wait for its completion without blocking using the \await()\ suspending function. The module supports bi-directional cancellation when a \CancellationTokenSource\ is provided, allowing cancellation of the coroutine to propagate to the Play Service task and vice versa. It also includes \Deferred.asTask()\ to convert a deferred value back into a \Task\.

integration/kotlinx-coroutines-play-services · high confidence

New integration-testing project for validating published artifacts

A new \integration-testing\ subproject has been added to provide a dedicated environment for verifying the correctness of published \kotlinx-coroutines\ artifacts. This project includes a suite of integration tests—such as \mavenTest\, \jvmCoreTest\, and various agent tests—that validate binary compatibility, ensure the absence of unwanted dependencies like atomicfu, and confirm that the coroutine debugger and core libraries function correctly as Java agents or when self-attaching dynamically. It also includes a smoke test for multiplatform builds and checks for Java 8 compatibility with Java 9+ APIs, ensuring the published artifacts behave as expected in consumer projects.

integration-testing · high confidence

New kotlinx-coroutines-rx3 module for RxJava 3 integration

This change introduces the \kotlinx-coroutines-rx3\ module, providing utilities to integrate Kotlin coroutines with RxJava 3.x. It adds coroutine builders (\rxCompletable\, \rxMaybe\, \rxSingle\, \rxObservable\, \rxFlowable\) that create cold reactive streams from coroutine blocks, and conversion functions to bridge \Flow\ and \ObservableSource\ types (\asFlowable\, \asObservable\, \asFlow\). It also includes suspending extension functions to await results from RxJava types (\await\, \awaitSingle\, \awaitFirst\, etc.) and supports JPMS via a \module-info.java\ file.

reactive/kotlinx-coroutines-rx3 · high confidence

New public API for coroutine debugging and BlockHound integration

The kotlinx-coroutines-debug module now exposes a stable public API for inspecting coroutine state and integrating with Reactor's BlockHound. Users can access detailed coroutine information via the new CoroutineInfo class and control debugging behavior through DebugProbes, including new options to ignore coroutines with empty contexts and enable creation stack traces. The module also provides a new CoroutinesBlockHoundIntegration class, automatically registered via the service loader, to detect blocking calls within coroutines. Additionally, JUnit integration is expanded with a new CoroutinesTimeout annotation for JUnit 5, complementing the existing JUnit 4 rule.

kotlinx-coroutines-debug/api · high confidence

New select clauses and whileSelect loop for coroutine selection

The select expression now supports an onTimeout clause, allowing users to select a block after a specified duration or millisecond count, and introduces an experimental whileSelect function to loop while a select expression evaluates to true. These additions expand the ways developers can compose and control coroutine suspension points within select blocks.

kotlinx-coroutines-core/common/src/selects · high confidence

New terminal Flow operators for collection, reduction, and logic checks

The \kotlinx-coroutines-core\ library adds a comprehensive set of terminal operators to \Flow\ and \SharedFlow\. Users can now collect flows into standard collections (\toList\, \toSet\, \toCollection\, \associate\, \associateBy\, \associateTo\), perform reductions (\reduce\, \fold\), and retrieve specific elements (\first\, \firstOrNull\, \last\, \lastOrNull\, \single\, \singleOrNull\). Additionally, logical checks (\any\, \all\, \none\) and counting (\count\) are now available, along with enhanced collection capabilities like \collectIndexed\ and \collectLatest\ (including a \SharedFlow\-specific version that returns \Nothing\).

kotlinx-coroutines-core/common/src/flow/terminal · high confidence

New web-specific coroutine implementation and Promise interoperability

The web module now includes a dedicated implementation of the coroutine event loop and dispatchers (EventLoop, JSDispatcher) that leverage JavaScript scheduling mechanisms like setTimeout and microtasks, replacing previous platform-specific logic. It introduces new public APIs to bridge Kotlin coroutines and JavaScript Promises, allowing developers to convert between Deferred and Promise types and await Promise completion without blocking. Additionally, unhandled exceptions are now reported using the browser's reportError API where available, improving error visibility in web environments.

kotlinx-coroutines-core/web · high confidence

Reactive integration API exposes coroutine context support and new await extensions

The public API for the reactive integration module now includes overloads for \Flow.asPublisher\ and \ConvertKt.asPublisher\ that accept a \CoroutineContext\ parameter, allowing users to explicitly inject context when converting flows or channels to Reactive Streams publishers. Additionally, the \AwaitKt\ class exposes new extension functions (\awaitSingleOrDefault\, \awaitSingleOrElse\, \awaitSingleOrNull\) for waiting on single values from Reactive Streams publishers, and the \PublishKt\ class provides \publish\ overloads that accept a \CoroutineContext\ for creating publishers with specific coroutine scopes or contexts.

reactive/kotlinx-coroutines-reactive/api · high confidence

Support for Kotlin/Native's new memory model via nativeOther target

The kotlinx-coroutines library now includes a new \nativeOther\ source set to support Kotlin/Native platforms using the new memory model. This change introduces a \DefaultDispatcher\ that utilizes a fixed thread pool sized to the number of available processors (minimum 2) and provides a \MainDispatcher\ that throws an exception if used on unsupported platforms. Additionally, a test launcher is included to facilitate background testing on these platforms.

kotlinx-coroutines-core/nativeOther · high confidence

Support using CoroutineDispatcher as an RxJava 3 Scheduler

The kotlinx-coroutines-rx3 module now allows a CoroutineDispatcher to be used directly as an RxJava 3 Scheduler via the new asScheduler() extension function. This enables users to schedule RxJava tasks on specific coroutine dispatchers, providing tighter integration between RxJava 3 scheduling and Kotlin coroutines.

kotlinx-coroutines-rx3 · high confidence

WASM target implementation for flow internals

The library now supports the WebAssembly (WASM) target for its flow implementation. This change introduces new internal classes, specifically \FlowExceptions\ and \SafeCollector\, within the \jsAndWasmShared\ source set. These additions provide the necessary platform-specific implementations for flow exception handling and safe collection mechanics required to run Kotlin coroutines flows on WASM platforms.

kotlinx-coroutines-core/jsAndWasmShared/src/flow · high confidence

WasmJs target implementation for kotlinx-coroutines-test

Added support for the WasmJs platform to the kotlinx-coroutines-test library. This includes a new internal \JsPromiseInterfaceForTesting\ class to handle JavaScript Promise interoperability and a \TestMainDispatcher\ implementation to manage the main thread dispatcher within the WasmJs environment, enabling coroutine testing on this target.

kotlinx-coroutines-test/wasmJs/src/internal · high confidence

Removals

Removal of kotlinx-coroutines-generate module

The \kotlinx-coroutines-generate\ module, which previously provided the \generate\ function and \GeneratorController\ to create sequences from coroutine lambdas, has been removed. Users relying on this specific API for generating sequences via suspend functions will no longer have access to this component.

kotlinx-coroutines-generate/src/main · high confidence

Removal of legacy async coroutine implementation

The legacy \async\ coroutine implementation, including the \asyncUi\ function, \FutureController\, and associated IO helpers, has been removed from the library. This deletion eliminates the previous mechanism for running asynchronous computations based on \CompletableFuture\ and \ContinuationWrapper\, indicating a shift to a newer coroutine model for this module.

kotlinx-coroutines-async/src/main · high confidence

API

Initial public API declarations for Android and Swing dispatchers

The library now exposes stable public API signatures for its UI-specific coroutine dispatchers. The Android module defines the \HandlerDispatcher\ class and \HandlerDispatcherKt\ utility functions (including \from\ and \awaitFrame\), while the Swing module defines the \SwingDispatcher\ class and the \SwingDispatcherKt\ accessor (\getSwing\). These files establish the binary-compatible surface for interacting with Android's \Handler\ and Swing's Event Dispatch Thread within coroutines.

ui/kotlinx-coroutines-android/api, ui/kotlinx-coroutines-swing/api · high confidence

Initial public API dump for kotlinx-coroutines-test

The kotlinx-coroutines-test module now publishes a stable binary compatibility API dump (klib.api) covering all supported targets including native, JS, and Wasm/WASI. This establishes the public surface for the test framework, exposing core testing capabilities such as runTest with Duration and Long timeout overloads, TestScope with backgroundScope and testScheduler access, and time-manipulation methods like advanceTimeBy and runCurrent on TestCoroutineScheduler. The API also includes TestDispatcher implementations (StandardTestDispatcher, UnconfinedTestDispatcher) and global helpers for managing the main dispatcher (setMain/resetMain).

kotlinx-coroutines-core/api, kotlinx-coroutines-test/api · high confidence

New JavaFX Coroutines API surface published

The public API for kotlinx-coroutines-javafx is now explicitly defined, exposing the \asFlow\ extension for \ObservableValue\ to convert JavaFX properties into coroutine flows, the \JavaFxDispatcher\ for handling dispatching and delays on the JavaFX thread, and the \awaitPulse\ utility for synchronizing with the JavaFX pulse event.

ui/kotlinx-coroutines-javafx/api · high confidence

Behavioural changes

14 commits (0 fixes) modifying kotlinx-coroutines-core/jvm/resources

A change to existing behaviour in kotlinx-coroutines-core/jvm/resources — 14 commits, 1 file.

kotlinx-coroutines-core/jvm/resources · medium confidence · unverified

Added ProGuard rules and ServiceLoader configurations for JVM

The library now includes ProGuard configuration to preserve specific test-related classes (such as TestMainDispatcherFactory and Android exception handlers) and volatile fields, ensuring correct behavior when code is obfuscated. Additionally, ServiceLoader files are registered to automatically discover the test's CoroutineExceptionHandler and MainDispatcherFactory implementations at runtime on the JVM.

kotlinx-coroutines-test/jvm/resources · high confidence

Added binary compatibility API dump for kotlinx-coroutines-slf4j

A new API signature file has been added for the kotlinx-coroutines-slf4j integration module, documenting the public surface of the MDCContext class and its Key companion object. This change enables the binary-compatibility-validator plugin to track and enforce API stability for this specific integration component.

integration/kotlinx-coroutines-slf4j/api · high confidence

Android module adds Main dispatcher and fixes exception logging on Android Oreo

The kotlinx-coroutines-android module now provides the Dispatchers.Main context for Android applications, enabling coroutine execution on the UI thread. It includes JPMS support via module-info.java and bundles R8/ProGuard optimization rules to reduce binary size. Additionally, it fixes a bug on Android Oreo (SDK 26-27) where uncaught coroutine exceptions were not being logged by manually invoking the system's uncaught exception pre-handler via reflection, ensuring consistent error reporting across Android versions.

ui/kotlinx-coroutines-android · high confidence

BroadcastChannel API deprecated in favor of SharedFlow

The BroadcastChannel API is now deprecated with an ERROR deprecation level, signaling that it is obsolete and will be removed in a future version. Users are advised to migrate to SharedFlow, which provides equivalent broadcasting capabilities. The deprecated BroadcastChannel interface, its factory functions, and related extension functions (such as consume and consumeEach) remain present in the codebase for binary compatibility but are marked as obsolete and will no longer be supported.

kotlinx-coroutines-core/common/src/channels · high confidence

Build infrastructure migrated to Kotlin DSL with consolidated conventions

The build system has been refactored from Groovy to Kotlin DSL, consolidating configuration into reusable convention plugins and helper objects within buildSrc. This change introduces standardized compilation settings (including global opt-ins and strict API checks), unified publishing logic for Maven Central with multiplatform POM compatibility, and a new cache-redirector mechanism to improve CI download reliability. It also adds support for Java 9+ JPMS module descriptors, AAR unpacking for Android dependencies, and snapshot compiler integration for community builds.

buildSrc · high confidence

Improved flow cancellation handling and Android compatibility

The JVM implementation of flow internals has been updated to ensure that cancellation exceptions are properly propagated and that flow operators correctly distinguish between different types of flow aborts. Additionally, the \AbortFlowException\ and \ChildCancelledException\ implementations now explicitly set an empty stack trace to prevent crashes on Android devices running version 6.0 and below, which had a bug with empty stack traces. The \SafeCollector\ logic has also been refined to better manage context preservation and exception transparency, ensuring that emissions after an exception are correctly rejected.

kotlinx-coroutines-core/jvm/src/flow · high confidence

Improved uncaught exception reporting and test dispatcher internals

The test module now provides more robust handling of uncaught coroutine exceptions through a new \ExceptionCollector\ that aggregates and reports failures to registered callbacks, ensuring developers are notified of errors that would otherwise be silently dropped. Additionally, a \ReportingSupervisorJob\ was introduced to propagate child job cancellations via callbacks, and the \TestMainDispatcher\ implementation was refined with a \NonConcurrentlyModifiable\ wrapper to detect and report concurrent modification issues when setting or accessing the main dispatcher, improving diagnostic clarity for concurrency bugs in tests.

kotlinx-coroutines-test/common/src/internal · high confidence

Internal refactoring of Flow operators and shared flow infrastructure

The internal implementation of the Flow library has been restructured to improve performance and correctness. A new \AbstractSharedFlow\ base class introduces a non-conflating \subscriptionCount\ StateFlow, ensuring accurate subscriber tracking without value conflation. The \ChannelFlow\ operator hierarchy now supports fusion with \buffer\ and \flowOn\, allowing the library to optimize execution by avoiding unnecessary channel allocations when context switching is not required. Additionally, the \combine\ operator has been optimized with batch-receive logic to reduce allocation pressure, and new internal classes for \merge\ and \zip\ operations have been introduced to handle concurrent flow collection more efficiently.

kotlinx-coroutines-core/common/src/flow/internal · high confidence

Introduction of the CoroutineScheduler with work-stealing and blocking task support

The JVM coroutine dispatcher implementation has been replaced by a new \CoroutineScheduler\ that manages a pool of shared threads. This scheduler supports both CPU-bound and potentially blocking tasks, using a work-stealing algorithm to distribute load efficiently. It dynamically scales the thread pool up to a maximum size to handle blocking operations without requiring a separate blocking thread pool, while maintaining a core pool size for CPU-intensive work. The \Dispatchers.Default\ and \Dispatchers.IO\ now utilize this new scheduler, which includes features like configurable scheduler names, work-stealing time resolution, and improved handling of blocking tasks to prevent oversubscription.

kotlinx-coroutines-core/jvm/src/scheduling · high confidence

JS dispatcher selection and dispatch mechanism overhaul

The kotlinx-coroutines-core JS implementation now automatically selects the most appropriate coroutine dispatcher based on the runtime environment: it detects jsdom to use NodeDispatcher, identifies standard browser contexts to use a window-based dispatcher (avoiding setTimeout throttling), and falls back to a setTimeout-based dispatcher when Node.js process APIs are unavailable. Additionally, dispatch overhead is reduced by amortizing costs through a message queue that utilizes Promise.resolve and process.nextTick for cold starts, while new JS-specific utilities like Window.asCoroutineDispatcher and Window.awaitAnimationFrame are introduced.

kotlinx-coroutines-core/js · high confidence

JVM coroutine infrastructure restructured with new time source and dispatcher shutdown

The JVM implementation of kotlinx-coroutines-core has been reorganized to support a pluggable time source via a new AbstractTimeSource class, allowing for mock time sources in tests and optimized virtual time handling. The Dispatcher infrastructure now includes a delicate API for shutting down built-in dispatchers (Default and IO) via Dispatchers.shutdown(), which stops associated threads to aid in classloader unloading for containerized environments. Additionally, the ExecutorCoroutineDispatcher now implements AutoCloseable, and thread context elements are handled with improved copying and merging logic via CopyableThreadContextElement to ensure correct state restoration across coroutine boundaries.

kotlinx-coroutines-core/jvm/src · high confidence

JVM internal infrastructure restructured for Android compatibility and performance

The JVM-specific internal implementation of kotlinx-coroutines-core has been reorganized into dedicated platform files, introducing a FastServiceLoader that skips JAR checksum verification to prevent ANRs on Android and using Class.forName lookups for MainDispatcher instantiation to survive minification. Exception stack-trace recovery now employs a ClassValue-based constructor cache and verifies message identity to ensure correct exception copying, while thread context restoration logic has been optimized with fast paths for single elements and proper handling of ThreadLocal elements.

kotlinx-coroutines-core/jvm/src/internal · high confidence

Lazy initialization of fallback Main dispatcher in JVM test environment

The JVM test module now implements a \TestMainDispatcherFactory\ that defers the creation of the alternative (second-best) Main dispatcher until it is actually needed. Previously, the alternative dispatcher might have been initialized immediately, which could cause exceptions if the platform dispatcher was missing and \SUPPORT\_MISSING\ was disabled. This change ensures that the fallback dispatcher is created lazily, preventing premature failures and providing a clearer error message if \Dispatchers.setMain()\ is not called before accessing \Dispatchers.Main\.

kotlinx-coroutines-test/jvm/src · high confidence

Major internal refactoring and API stabilization in kotlinx-coroutines-core

This release introduces a significant internal rework of the kotlinx-coroutines-core library, including the introduction of new internal base classes like AbstractCoroutine and CancellableContinuationImpl, and the addition of delicate and internal API markers (DelicateCoroutinesApi, InternalCoroutinesApi) to better control API stability. It stabilizes several previously experimental APIs, such as CoroutineStart.UNDISPATCHED, CoroutineStart.ATOMIC, Dispatchers.Unconfined, and CancellableContinuation.resume with onCancellation, while promoting MainScope and CoroutineScope.cancel to stable status. The update also includes behavioral fixes for race conditions in Job.join and select expressions, improved exception handling and stacktrace recovery, and the introduction of new features like awaitCancellation and CompletableDeferred.asDeferred.

kotlinx-coroutines-core/common/src · high confidence

Major internal refactoring of coroutine machinery to common code

The internal implementation of kotlinx-coroutines-core has been consolidated into the common module, replacing platform-specific files with \expect\ declarations and new shared infrastructure. This change introduces reusable cancellable continuations to prevent leaks in hot loops, implements a new lock-free \LockFreeTaskQueue\ for task scheduling, and reworks the \LimitedDispatcher\ to better manage parallelism. Additionally, exception handling logic is now unified via \CoroutineExceptionHandlerImpl.common.kt\, and internal utilities like \InlineList\ and \ConcurrentLinkedList\ are standardized across platforms.

kotlinx-coroutines-core/common/src/internal · high confidence

Native concurrency internals migrated to Kotlin/Native new memory model

The internal concurrency primitives for the Native platform have been rewritten to support the new Kotlin/Native memory model. Synchronization is now implemented using \kotlinx.atomicfu\ (e.g., \SynchronizedObject\ for locks, \AtomicReference\ for atomics) instead of the previous model, and thread-local storage is handled via a custom \CommonThreadLocal\ backed by a \MutableMap\. This change also introduces a new \CopyOnWriteList\ implementation and updates exception handling and stack trace recovery to align with the new platform constraints.

kotlinx-coroutines-core/native/src/internal · high confidence

Native flow cancellation and exception handling implementation

This change introduces native-specific implementations for flow cancellation and exception propagation. It adds \AbortFlowException\ and \ChildCancelledException\ to handle flow abortion and child cancellation scenarios, and implements \SafeCollector\ to ensure that flow operators correctly propagate cancellation exceptions and validate coroutine context during emission.

kotlinx-coroutines-core/native/src/flow · high confidence

Native runtime restructured for new memory model and multi-threaded dispatchers

The Kotlin/Native coroutines implementation has been rewritten to support the new native memory model and introduce a multi-threaded dispatcher architecture. Users gain a new \Dispatchers.IO\ backed by a thread pool, improved \runBlocking\ stability via worker keep-alive mechanisms, and \CloseableCoroutineDispatcher\ support for proper resource cleanup. Internal machinery has been simplified, deprecated APIs removed, and exception handling aligned with the standard library.

kotlinx-coroutines-core/native/src · high confidence

New Darwin-specific main dispatcher implementation

The native Darwin (iOS/macOS) module now includes a dedicated \Dispatchers.kt\ file that implements the main and default coroutine dispatchers using native CoreFoundation and Grand Central Dispatch APIs. This introduces \DarwinMainDispatcher\ to handle main-thread execution and \DarwinGlobalQueueDispatcher\ for background tasks, replacing previous platform-agnostic or stub implementations with native-specific logic for dispatching and delay scheduling.

kotlinx-coroutines-core/nativeDarwin/src · high confidence

New Mutex and Semaphore implementations with improved cancellation and performance

The \Mutex\ and \Semaphore\ synchronization primitives in \kotlinx-coroutines-core\ have been replaced with new implementations that offer better performance and stricter correctness guarantees. Users benefit from a prompt cancellation guarantee where locks and permits are automatically released if a coroutine is cancelled while waiting, preventing resource leaks. The new \Mutex\ is non-reentrant and fair (FIFO), and \Mutex.withLock\ now uses Kotlin contracts to ensure the action is invoked exactly once. Similarly, \Semaphore.withPermit\ guarantees exactly-once execution. These changes also include optimizations for \select\ expressions and the use of reusable cancellable continuations to reduce overhead in hot loops.

kotlinx-coroutines-core/common/src/sync · high confidence

New coroutine builder overload accepting a Job parameter

The kotlinx-coroutines-guava module now exposes an additional overload for the \future\ builder function that accepts a \Job\ instead of a \CoroutineContext\. This allows users to explicitly control the lifecycle of the created \ListenableFuture\ by passing an existing \Job\, providing finer-grained control over cancellation and scope management compared to the context-based overload.

integration/kotlinx-coroutines-guava/api · high confidence

New internal thread-safe resource pool for Native multi-threaded dispatchers

The concurrent source set now includes a new internal \OnDemandAllocatingPool\ class, a thread-safe resource pool used by the Native implementation of multi-threaded dispatchers. This component manages the creation and lifecycle of dispatcher elements up to a specified capacity, allowing for controlled allocation and cleanup to prevent memory leaks, and is included in the concurrent source set to enable JVM-based testing of this Native-specific logic.

kotlinx-coroutines-core/concurrent/src/internal · high confidence

Optimized R8/ProGuard rules for smaller Android builds

The library now includes version-specific R8 and ProGuard configuration files to reduce the size of Android applications. For R8 versions 1.6.0 and above, rules are added to disable the FastServiceLoader and debugging facilities, allowing the compiler to optimize away unused code and directly instantiate the Android main dispatcher. For older tooling (R8 up to 3.0.0) and standard ProGuard, explicit keep rules are maintained for AndroidDispatcherFactory and AndroidExceptionPreHandler to ensure compatibility with different Android Gradle Plugin versions.

ui/kotlinx-coroutines-android/resources/META-INF/com.android.tools · high confidence

Reactive modules consolidated into dedicated directory with RxJava 3 support

The reactive stream integration modules have been moved into a dedicated \reactive\ directory, centralizing utilities for Reactive Streams, Reactor, RxJava 2.x, and the newly added RxJava 3.x. This restructuring is accompanied by updated documentation links and the introduction of a separate Knit test configuration to manage guide tests for these reactive libraries.

reactive · high confidence

Refactor coroutine start intrinsics for improved cancellation and error handling

The internal coroutine start machinery in the \intrinsics\ package has been restructured to improve how coroutines are launched and how exceptions are handled during startup. New \Cancellable.kt\ and \Undispatched.kt\ files introduce dedicated entry points (\startCoroutineCancellable\ and \startCoroutineUndispatched\) that ensure exceptions thrown by the dispatcher during coroutine creation are properly reported to the completion handler rather than being lost or treated as internal errors. This change enhances the reliability of cancellation while waiting for dispatch and ensures that undispatched coroutines correctly propagate dispatcher failures and timeout exceptions.

kotlinx-coroutines-core/common/src/intrinsics · high confidence

Refactored JVM debug agent internals to improve Android compatibility and stability

The internal structure of the JVM debug agent has been reorganized to separate static agent installation logic from dynamic probing, introducing \AgentInstallationType\ to prevent Android-incompatible class loading when the agent is not statically installed. The \DebugCoroutineInfoImpl\ now uses weak references for coroutine contexts and frames to prevent memory leaks and allow garbage collection of abandoned coroutines, while also implementing logic to handle suspend-resume race conditions for more accurate state tracking. Additionally, new internal classes \DebuggerInfo\ and \DebugCoroutineInfo\ have been added to provide structured, serializable data for the IDEA debugger, and stub probe functions in \DebugProbes\ are now explicitly defined to support ByteBuddy-based instrumentation.

kotlinx-coroutines-core/jvm/src/debug/internal · high confidence

Register Android-specific coroutine services via ServiceLoader

The library now automatically registers the Android dispatcher and exception handler for coroutines. By adding service provider configuration files for kotlinx.coroutines.internal.MainDispatcherFactory and kotlinx.coroutines.CoroutineExceptionHandler, the Android platform implementation (AndroidDispatcherFactory and AndroidExceptionPreHandler) is discovered and used by the runtime without requiring manual setup.

ui/kotlinx-coroutines-android/resources/META-INF/services · high confidence

Updated ProGuard and R8 rules to preserve volatile fields and GC anchors

The kotlinx-coroutines-core library now includes updated ProGuard and R8 configuration files (META-INF/proguard/coroutines.pro and META-INF/com.android.tools/r8/coroutines.pro) to prevent code shrinking tools from incorrectly removing or mangling critical internal components. These rules ensure that volatile fields in coroutines and the standard library's SafeContinuation are preserved, as they rely on AtomicReferenceFieldUpdater for updates. Additionally, the configuration explicitly keeps the Job GC anchor fields in ReadonlySharedFlow and ReadonlyStateFlow to prevent sharing coroutines from being garbage collected prematurely, and maintains ServiceLoader support for MainDispatcherFactory and CoroutineExceptionHandler.

kotlinx-coroutines-core/jvm/resources/META-INF · high confidence

kotlinx-coroutines-jdk8 module deprecated and merged into core

The kotlinx-coroutines-jdk8 module is now a stub for backwards compatibility, as its functionality was merged into the core module starting with version 1.7.0. The module-info.java file has been updated to declare the module as empty, reflecting that the JDK 8 integration features are no longer maintained as a separate artifact.

integration/kotlinx-coroutines-jdk8 · high confidence

Fixes

Fix split package issue for kotlinx.coroutines.debug in JPMS integration tests

Added a dedicated JPMS module definition for the dynamic attach debug integration test, explicitly requiring kotlinx.coroutines.debug to resolve the split package problem. This allows the test suite to correctly validate the debug agent's behavior (such as coroutine dumping and installation state) within a modular Java environment, even though the dynamic attach functionality itself remains ignored due to Byte Buddy compatibility issues.

integration-testing/jpmsTest · high confidence

Test coverage

Added JS-specific test helpers and Promise completion tests; Added JVM exception handling and stack trace recovery tests; Added JVM tests for Java 8 time-based coroutine operations; Added JVM-specific tests for Flow operators and sharing behaviors; Added JVM-specific tests for the coroutines test module; Added Java integration test for runBlocking exception handling; Added JavaFX coroutine example applications; Added JavaFX coroutines guide examples; Added Knit-generated test examples for the Coroutines Guide; Added Lincheck model-checking tests for core concurrency primitives; Added Maven publication validation tests; Added R8/ProGuard configuration for Android coroutines testing; Added automated tests for user-guide examples; Added common test suite for kotlinx-coroutines-core; Added compilation test for JUnit5 CoroutinesTimeout; Added comprehensive stress and unit tests for the coroutine scheduling subsystem; Added comprehensive test coverage for channel operations and behaviors; Added comprehensive test coverage for flow sharing operators; Added comprehensive test coverage for reactive integration; Added comprehensive test suite for Reactor integration; Added comprehensive test suite for kotlinx-coroutines-test; Added comprehensive tests for Flow operators; Added concurrency and stress tests for coroutines core; Added integration test for core agent coroutine dumping; Added integration tests for JDK 8 core integration and coroutine exception serialization; Added integration tests for dynamic debug agent functionality; Added native Darwin test infrastructure and main dispatcher tests; Added native tests for Worker lifecycle and dispatcher behavior; Added safe debug agent integration test; Added service loader configuration for empty coroutine scope implementations; Added smoke test infrastructure for coroutine behavior; Added stress and unit tests for channel concurrency and trySendBlocking; Added stress and unit tests for internal concurrency primitives; Added stress tests for Mutex and Semaphore concurrency; Added stress tests for select expressions; Added stress tests for select-based channel and mutex operations; Added test coverage for Android dispatcher behavior and R8 optimization; Added test coverage for Flow builders, invariants, and testing utilities; Added test coverage for JDK 8 Future and Stream interoperability; Added test coverage for JDK 9 Flow integration; Added test coverage for RxJava 2 reactive integrations; Added test coverage for WASM-JS coroutines testing; Added test coverage for kotlinx-coroutines-debug; Added test coverage for the select expression API; Added test implementation classes for ServiceLoader testing; Added test infrastructure for guide validation; Added test suite for kotlinx-coroutines-rx3 integration; Added tests for Android Main dispatcher initialization and mocking; Added tests for Flow delay, sample, and timeout examples; Added tests for Flow terminal operators; Added tests for Guava ListenableFuture integration; Added tests for JS Promise interoperability and exception propagation; Added tests for JUnit 4 CoroutinesTimeout rule behavior; Added tests for JavaFX dispatcher and ObservableValue.asFlow(); Added tests for Mutex and Semaphore synchronization primitives; Added tests for Play Services Tasks API integration; Added tests for SLF4J MDC context propagation; Added tests for Swing dispatcher integration; Added tests for channel-based Flow builders and extension functions; Added tests for flowScope cancellation behavior; Added tests for the JUnit 5 CoroutinesTimeout extension; Expanded JVM test coverage for coroutines core; Expanded test coverage for JVM channel and actor behavior; Integration tests for the Kotlin coroutines debug agent; Prevent R8 from stripping GC anchors in flow sharing; Removal of legacy async IO and core async tests; Removed legacy GenerateTest.kt from kotlinx-coroutines-generate; Updated Swing example test to use new coroutine APIs.

Dependencies

Upgrade Gradle wrapper to version 8.14.4

The project's Gradle wrapper has been updated to use Gradle 8.14.4. This change ensures that builds are executed with the specified distribution, including SHA-256 checksum verification for security, and configures the wrapper to download and store the distribution in the user's home directory.

gradle · high confidence

Upgrade to Kotlin 2.2.20 and AtomicFU 0.32.1

The project has upgraded its primary dependencies to Kotlin 2.2.20 and AtomicFU 0.32.1. This update is reflected in the root \gradle.properties\ and propagated through the \buildSrc\ and \integration-testing\ modules, ensuring the entire build system and integration tests compile against these latest versions.

(dependencies) · high confidence

Housekeeping

New per-module README and Knit configuration for kotlinx-coroutines-core; Repository maintenance and documentation restructuring.

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 47 → 61 (+13.6)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 95 → 92 (-2.4)
  • Architecture 96 → 99 (+3.9)
  • Maturity 52 → 69 (+16.9)
  • Readiness 17 → 36 (+19.2)
  • Security 97 → 100 (+3.3)

Resolved (16)

  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • Duplicated block (18 lines × 2) (test-utils/common/src/TestBase.common.kt)
  • Duplicated block (20 lines × 2) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • Duplicated block (21 lines × 2) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • Duplicated block (36 lines × 2) (kotlinx-coroutines-core/common/src/selects/SelectOld.kt)
  • Duplicated block (6 lines × 2) (kotlinx-coroutines-core/js/src/internal/CopyOnWriteList.kt)
  • Duplicated block (6 lines × 2) (kotlinx-coroutines-core/js/src/internal/CopyOnWriteList.kt)
  • Duplicated block (8 lines × 2) (kotlinx-coroutines-core/common/src/Exceptions.common.kt)
  • LLM evaluation failed
  • No exposed public API
  • No tests found
  • Rotate the exposed credentials — git history can't be un-committed
  • Scanner failed to run — not a clean result
  • Secret: jwt (buildSrc/gradle.properties)
  • Test reliability not included

New (117)

  • AwaitKt.awaitOne (cognitive 24) (reactive/kotlinx-coroutines-reactive/src/Await.kt)
  • AwaitKt.awaitOne (cyclomatic 25) (reactive/kotlinx-coroutines-reactive/src/Await.kt)
  • BufferedChannel.cancelSuspendedReceiveRequests (cognitive 30) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.markAllEmptyCellsAsClosed (cognitive 20) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.removeUnprocessedElements (cognitive 56) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.removeUnprocessedElements (cyclomatic 21) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.toString (cognitive 26) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.toString (cyclomatic 27) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.updateCellExpandBufferSlow (cognitive 24) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.updateCellReceiveSlow (cognitive 39) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.updateCellReceiveSlow (cyclomatic 18) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.updateCellSend (cognitive 19) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.updateCellSendSlow (cognitive 41) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • BufferedChannel.updateCellSendSlow (cyclomatic 19) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • CancellableContinuationImpl.invokeOnCancellationImpl (cognitive 24) (kotlinx-coroutines-core/common/src/CancellableContinuationImpl.kt)
  • CancellableContinuationImpl.invokeOnCancellationImpl (cyclomatic 17) (kotlinx-coroutines-core/common/src/CancellableContinuationImpl.kt)
  • Change coupling: Await.kt ↔ Future.kt (kotlinx-coroutines-core/common/src/Await.kt)
  • Change coupling: CoroutineContext.common.kt ↔ CoroutineContext.kt (kotlinx-coroutines-core/common/src/CoroutineContext.common.kt)
  • ChannelSegment.onCancellation (cognitive 22) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • ChannelSegment.onCancellation (cyclomatic 16) (kotlinx-coroutines-core/common/src/channels/BufferedChannel.kt)
  • …and 97 more

Changes since last survey

  • 5 commits — 5 feature/other, 0 fixes

By area

  • kotlinx-coroutines-core/common — 2 commits
  • (root) — 1 commit
  • docs/images — 1 commit
  • docs/kc.tree — 1 commit

Notable commits

  • change: Poison AGENTS.md (#4758)
  • change: Reiterate kdoc SharingStarted.WhileSubscibed replayExpirationMillis on what 'immediately' refers to
  • change: chore: change order of documents in the guide (#4719)
  • change: docs(core): fix duplicated words in internal comments (#4735)
  • change: feat: Create a new debugging page (#4730)

Architecture

  • Containers 0 added · 0 removed · contexts 12 added · 0 removed · edges 11 added · 0 removed

Added bounded contexts (12)

  • benchmarks
  • kotlinx-coroutines-android
  • kotlinx-coroutines-core
  • kotlinx-coroutines-guava
  • kotlinx-coroutines-javafx
  • kotlinx-coroutines-reactor
  • kotlinx-coroutines-rx2
  • kotlinx-coroutines-rx3
  • kotlinx-coroutines-slf4j
  • kotlinx-coroutines-swing
  • kotlinx-coroutines-test
  • test-utils

Added dependency edges (11)

  • benchmarks → kotlinx-coroutines-core (coupling)
  • kotlinx-coroutines-android → kotlinx-coroutines-core
  • kotlinx-coroutines-guava → kotlinx-coroutines-core
  • kotlinx-coroutines-javafx → kotlinx-coroutines-core
  • kotlinx-coroutines-reactor → kotlinx-coroutines-core
  • kotlinx-coroutines-rx2 → kotlinx-coroutines-core
  • kotlinx-coroutines-rx3 → kotlinx-coroutines-core
  • kotlinx-coroutines-slf4j → kotlinx-coroutines-core
  • kotlinx-coroutines-swing → kotlinx-coroutines-core
  • kotlinx-coroutines-test → kotlinx-coroutines-core
  • test-utils → kotlinx-coroutines-core

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

Kotlin/kotlinx.coroutines was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 25 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit bd2e9a1b90400fb7b2fa4f8731e7d8148799ab73 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-dd72cc24c749.