Kotlin 2.4.20-Beta2 Decouples Coroutine Stack Trace Recovery From kotlinx.coroutines
JetBrains ships experimental StackTraceRecoverable interface, four new collection functions, and a native-image compiler in latest beta.
JetBrains released Kotlin 2.4.20-Beta2 on July 22, 2026, with a change that matters for anyone debugging asynchronous code: stack trace recovery no longer requires a dependency on kotlinx.coroutines.
The beta introduces the experimental StackTraceRecoverable interface directly into the Kotlin standard library. The interface lets developers create exception instances that support stack trace recovery without pulling in kotlinx.coroutines.
Why Stack Trace Recovery Matters
Coroutines complicate debugging because exceptions originate in one context and get rethrown in another. Without recovery, the stack trace shows the rethrow point but not the actual origin. Stack trace recovery reconstructs the full path across coroutine boundaries.
Previously, this capability lived in kotlinx.coroutines. Moving it into the standard library reduces dependency bloat and makes the feature available to code that doesn't already use the coroutines library.
Four New Collection Functions
The beta adds four experimental collection functions for equality and uniqueness checks: allDistinct(), allDistinctBy(), allEqual(), and allEqualBy(). These eliminate verbose patterns that previously required manual iteration or multiple passes.
The allDistinct() and allDistinctBy() variants check whether all elements are unique, with the By form allowing comparison via a selector function. The allEqual() and allEqualBy() functions verify that all elements are equal, again with a selector-based variant.
Native Image Compiler Arrives
Kotlin 2.4.20-Beta2 includes the first Experimental release of the Kotlin compiler native image. A drop-in replacement for kotlinc, the native image delivers faster startup and higher performance.
The native image compiles the compiler ahead-of-time, avoiding JVM warmup costs. For build pipelines that invoke the compiler frequently, the performance gains compound quickly.
What's Experimental
All three features ship with experimental status. The StackTraceRecoverable interface, the four collection functions, and the native image compiler are marked experimental in this beta, signaling that JetBrains may refine the APIs based on feedback before final release.
Developers can opt in via the standard Kotlin experimental opt-in mechanism. Production use should account for potential API changes before the features graduate to stable status.
The beta is available now through the usual Kotlin update channels. JetBrains has not announced a timeline for stable release.