Kotlin 2.0.0 Released: The Stable K2 Compiler Arrives
Kotlin 2.0.0 made the rewritten K2 compiler stable and the default across all platforms, delivering major performance gains, better smart casts, and a new Compose compiler Gradle plugin.
Historical Archive. This article documents an event from 2024 and is preserved with its original date for reference. It is not current news, and details may have changed since publication.
What happened
Kotlin 2.0.0 was released on May 21, 2024, according to the official Kotlin documentation, and was the centrepiece of KotlinConf 2024. JetBrains described it as a huge milestone: the new Kotlin K2 compiler was now stable, marking the culmination of a long road to rebuild the compiler on a new architecture.
The stable K2 compiler
In Kotlin 2.0.0, the K2 compiler is used by default and is stable for all target platforms, JVM, Native, Wasm and JS. The rewrite brings major performance improvements, described as compiling code roughly twice as fast, speeds up development of new language features, unifies all supported platforms, and provides a better architecture for multiplatform projects. JetBrains reported ensuring quality by compiling 10 million lines of code, with 18,000 developers testing the compiler across 80,000 projects.
Smart cast improvements
The K2 compiler performs smart casts in more scenarios than before. Kotlin 2.0.0 improved smart casts for local variables used in later scopes, type checks combined with the logical or operator now smart-cast to the closest common supertype, inline functions are treated as having an implicit call-in-place contract enabling more smart casts, class properties with function types can be smart-cast, and smart-cast information is now passed on to catch and finally blocks.
Other highlights
The release introduced a new Compose compiler Gradle plugin, generation of lambda functions using invokedynamic on the JVM, a stable kotlinx-metadata-jvm library, a stable AutoCloseable interface, a new Gradle DSL for compiler options in multiplatform projects, and improvements to Kotlin/Native garbage-collection monitoring and Kotlin/Wasm production builds via Binaryen.
Why it mattered
Kotlin 2.0.0 was one of the most significant releases in the language's history. Stabilising the K2 compiler delivered tangible speed gains and smarter analysis while laying an architecture that would accelerate future language development, which is exactly what the subsequent 2.1.0 release began to deliver.
Related on Skillo
See also: Kotlin 1.9.0 and K2 for the JVM in Beta, Kotlin 2.1.0's guard conditions.
Sources
Published date reflects the original event date (2024-05-21). This article is original Skillo editorial written from the sources above; facts were verified in September 2026.
Written by
Skillo Staff
0 Comments
Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.