Migrate to Kotlin 2

Proprietary

Migrate deprecated Kotlin 1.x APIs to their Kotlin 2.x replacements and update Gradle build files for Kotlin 2.x compatibility. Deprecated APIs were deprecated in Kotlin 1.4-1.5 and become errors in Kotlin 2.1.

org.openrewrite.kotlin.migrate.UpgradeToKotlin2
mod run . --recipe=org.openrewrite.kotlin.migrate.UpgradeToKotlin2

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. Replace deprecated String case conversions
  2. Replace deprecated Char case conversions
  3. Replace deprecated appendln with appendLine
  4. Replace deprecated capitalize and decapitalize
  5. Replace Enum.values() with Enum.entries
  6. Replace enumValues<T>() with enumEntries<T>()
  7. Upgrade Kotlin Gradle plugins to 2.x
  8. Remove redundant kotlin-stdlib dependencies
  9. Remove deprecated Kotlin Gradle properties
  10. Replace kotlinOptions with compilerOptions in Gradle build files