JetBrains’ IntelliJ IDEA 2024.1, a release of the integrated development environment (IDE) due on April 4, will feature an optional K2 compiler mode, enabling developers to use K2 for faster and more robust Kotlin code analysis, the company said.
With this planned release, the IDE for Kotlin and Java will have two modes. The class mode, enabled by default, will use the standard K1 Kotlin compiler to analyze Kotlin code. The K2 mode will use the new K2 compiler as its code analysis engine. The K2 mode now is in an alpha state. The company made the announcement in a March 25 blog post.
The two modes affect only code analysis. If developers want to compile a project to the K2 compiler, they will need to specify this in build settings. JetBrains describes K2 as a high-performance compiler for the Kotlin language. With the K2 mode, JetBrains developers rewrote the compiler from scratch to improve performance and enhance the internal architecture for further development of the Kotlin language. The K2 mode will support future language features that will only be provided in the K2 compiler, JetBrains said.
The K2 mode in IntelliJ IDEA 2024.1 supports code highlighting and completion, navigation, debugging, refactoring, and editing features such as code formatting and type hierarchy. Also supported are popular inspections, quick fixes, new project wizards, wizard importing, and running tests and applications from IntelliJ IDEA.
However, K2 mode in version 2024.1 does not support Kotlin Multiplatform projects, Android projects, extract function refactoring, inlay hints, or Java-to-Kotlin conversion. Also, third-party IntelliJ IDEA plugins that depend on the Kotlin plugin will be disabled. JetBrains said that support for missing features and an easy-to-use API for third-party plugins will be added in upcoming releases.
The company promised to provide migration guidance for plugin authors soon.