Upgrade Kotlin to 2.3 for Java 25 compatibility

MSAL

Only Kotlin 2.3 and later can target Java 25 bytecode, so modules on an older Kotlin are otherwise capped at Java 24. This recipe upgrades modules that compile Kotlin (i.e. contain .kt source files) and are already on Kotlin 2.0, 2.1, or 2.2 up to the latest Kotlin 2.3, so they can subsequently be migrated to Java 25. Modules on Kotlin 1.x are left untouched, as crossing the K2 compiler default introduced in Kotlin 2.0 is a source-breaking change that should not be applied automatically. As a safety net the module is also floored at Java 24: if the Kotlin upgrade cannot be applied (for instance because the version is managed externally by a parent or BOM), the module still lands on Java 24 rather than being left behind, and is raised the rest of the way to Java 25 only once it actually reaches Kotlin 2.3.

org.openrewrite.java.migrate.UpgradeKotlinForJava25
mod run . --recipe=org.openrewrite.java.migrate.UpgradeKotlinForJava25

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Upgrade Gradle or Maven dependency versions org.jetbrains.kotlin:*:2.3.x
  2. Upgrade Maven plugin version org.jetbrains.kotlin:kotlin-maven-plugin:2.3.x
  3. Update a Gradle plugin by id org.jetbrains.kotlin.*
  4. Upgrade Java version 24