Thursday, June 20, 2024

Kotlin 2.0 now available with stable version of K2 compiler

Software DevelopmentKotlin 2.0 now available with stable version of K2 compiler


JetBrains has just released Kotlin 2.0, which it says is a major update to the programming language. It was announced at KotlinConf 2024, happening May 22-24, which is an event full of talks about using Kotlin.

“Today we are excited to release Kotlin 2.0 with a stable K2 compiler, which is multiplatform from the ground up, understands your code better, and compiles it twice as fast,” Egor Tolstoy, project lead for Kotlin at JetBrains, wrote in a blog post

One of the main highlights of this release is that it includes a stable version of the K2 compiler, which is a complete rewrite of Kotlin’s original compiler that unifies all platforms supported by Kotlin, and offers a faster and more extensible architecture, addresses technical debt from the old compiler, fixes bugs, and lays the foundation for future language extensions. 

According to JetBrains, around 15,000 developers have already used K2, and Meta has already migrated large portions of its codebase to it. 

“The everyday passion of the Kotlin community constantly motivates us to improve the language, and today, we are proud to take a huge step forward for the whole Kotlin ecosystem and release Kotlin 2.0. The new compiler architecture was built to enable us to evolve the language much easier, we can introduce new features faster and in a consistent and platform-agnostic way,” said Tolstoy.

According to JetBrains, the K2 compiler is key for multiplatform Kotlin, and to that end, Kotlin 2.0 also introduces several new features and enhancements for Kotlin Multiplatform (KMP).

Kotlin now provides first-party support for Compose Multiplatform, and the Jetpack Compose compiler (which powers Compose Multiplatform) now ships with Kotlin as of this release. 

This release also introduces an improved tooling experience for Kotlin Multiplatform. It now fully understands Xcode projects and offers full support for Swift. 

Google has also started recommending developers switch to KMP and it offers KMP support in several popular Android libraries, and has migrated some of its own apps to it as well, such as Google Docs. 

Looking ahead to the future, upcoming plans for Kotlin that the team is now working on include data recognition and deconstruction, increasing abstraction, high-performance clear code, and improving the library author experience. 

“Kotlin 2.0 significantly boosts your daily productivity. It brings a faster, smarter, and more robust compiler, as well as even better support for Kotlin Multiplatform projects. As a Kotlin developer, you get more than just a modern, concise, and safe language. You also have access to a versatile ecosystem with powerful frameworks such as Ktor and Compose Multiplatform, and combined with JetBrains IDEs, Kotlin 2.0 offers an exceptional developer experience, empowering you to build innovative, performant, and reliable applications for all platforms,” Tolstoy wrote. 

Kotlin 2.0 is now available in the latest version of IntelliJ IDEA and Android Studio. A full list of new features can be found in the language’s release notes.

Check out our other content

Check out other tags:

Most Popular Articles