Migrating from K1

Last modified: 11 September 2024

For many years, the only practical way to analyze Kotlin code in IntelliJ IDEA and other tools was to use the Kotlin compiler's internals, an unsafe API not designed for external usage.

The Analysis API, on the other hand, offers a much cleaner and robust set of utilities. It exposes almost the same set of concepts. Thus, if you already have code that depends on the Kotlin compiler, migrating it to the new API should not be time-consuming. This migration guide outlines the differences between the APIs and explains how to port the descriptor-based resolution logic to the Analysis API.

Once an IntelliJ plugin has been migrated to the Analysis API, it will need to declare its compatibility with the K2 Kotlin mode in the plugin.xml. Otherwise, the plugin will not be loaded when the K2 mode is active.