Upgrade with evidence from the whole toolchain
K2 is Kotlin's newer compiler frontend and has been the default since Kotlin 2.0. A migration involves the compiler, Gradle plugin, IDE, processors, and platform plugins, not just changing a language-version number.
1. Record the current JDK, Gradle, Kotlin, and processor versions.
2. Run the existing tests and save a clean baseline.
3. Choose a mutually compatible target toolchain.
4. Upgrade in a reviewable branch.
5. Compile every supported source set and run relevant tests.
6. Review diagnostics and generated-code changes.
7. Measure clean and incremental builds separately.
Stronger analysis can expose code that previously compiled through weaker inference or diagnostics. Fix the underlying type or contract issue instead of suppressing all new warnings. Check KSP/kapt and Android plugin compatibility against their actual release documentation.
Exercise
Create a migration checklist for a small JVM project, including a rollback commit and a deliberately failing test to confirm the runner still discovers tests after the upgrade.
Check: do not promise a particular speedup from another project's benchmark; measure your own workloads and preserve correctness first.