Migrate to Kotlin 2.x
ProprietaryModernizes a Kotlin 1.x codebase for Kotlin 2.x: replaces stdlib APIs deprecated between 1.4 and 2.0 with their modern equivalents, swaps JVM-only java.lang/java.util helpers for multiplatform Kotlin extensions, migrates inline class to @JvmInline value class, and removes @OptIn annotations for experimental markers that have since graduated to stable.
org. openrewrite. kotlin. migrate. Kotlin1To2$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. migrate. Kotlin1To2$KtRecipe'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.
- Use modern Kotlin stdlib idioms
- Use
kotlin.mathinstead ofjava.lang.Math - Use Kotlin number extensions instead of
java.lang.Integer/Long/Double/Float/Boolean - Use
Charextensions instead ofjava.lang.Character - Use Kotlin collection extensions instead of
java.util.Collections - Use Kotlin array extensions instead of
java.util.Arrays - Use
kotlin.text.Regexinstead ofjava.util.regex.Pattern - Use
@JvmInline value classinstead ofinline class - Remove redundant
@OptInannotations