Language support Kotlin

Move every Kotlin repo from 1.x to 2.x without per-team coordination.

Standard library renames, kotlinx bumps, Gradle plugin upgrades, and Android deprecation cleanup across hundreds of repos. Deterministic, agent-ready.

Why Kotlin at Moderne

Kotlin is fully represented in the LST.

A compiler-accurate model of every Kotlin file lands in the Lossless Semantic Tree. Recipes resolve across modules instead of pattern-matching strings.

Compiler-accurate by default.

Symbol resolution, type attribution, comments, and formatting are preserved on every run. Recipes operate on the structural model, not regex.

Kotlin DSL for recipe authoring.

A K2 compiler plugin reads paired before-and-after Kotlin lambdas and synthesizes Recipe subclasses at compile time. No annotations, no separate template class, no runtime reflection.

Multi-repo orchestration.

Coordinate version upgrades, performance fusions, and Android deprecation cleanup across hundreds of repos in one run. IntelliJ inspections require a developer present; Moderne does not.

What you can migrate

Concrete Kotlin migration paths.

Kotlin 2.0 shipped May 2024. Deprecated 1.x APIs became errors in Kotlin 2.1.

Version upgrade

Kotlin 1.x → 2.x

A single UpgradeToKotlin2 recipe handles standard-library renames, enum-entries migration, deprecations, kotlinx bumps, Gradle plugin updates, and removal of deprecated build properties.

Standard library

Renamed APIs

toLowerCase → lowercase, appendln → appendLine, capitalize and decapitalize replacements. Applied consistently across the estate.

Standard library

Enum.values() → Enum.entries

The 2.x replacement for the values() API. Recipe handles call-site rewrites across every enum.

Dependencies

kotlinx library bumps

Coroutines, datetime, and serialization libraries bumped to the latest supported versions, with transitive resolution.

Build

Gradle Kotlin plugin 2.x

UpgradeKotlinGradlePlugins handles plugin version upgrades across build.gradle (Groovy DSL) and build.gradle.kts (Kotlin DSL) consistently.

Android

Android deprecation cleanup

AsyncTask, LocalBroadcastManager, bare Handler constructors, and other deprecation-cadence patterns accumulated since Android 8.

Performance

Performance fusion rewrites

filter().first() → first(), filter().count() → count(), map().filterNotNull() → mapNotNull(). Eager-collection traps collapsed into single calls.

Dependencies

Gradle and Maven coordinates

Version catalogs, Maven coordinates, and Gradle dependency declarations updated across the estate alongside the version jump.

Moderne helps keep our codebases cleaner, safer, and easier to evolve. It is a major unlock for teams that want to spend more time shipping and less time maintaining.
Jason Simpson VP of Engineering, Choice Hotels Read the case study

How it works

Three steps, every language.

  1. Ingest the LST.

    Moderne parses every Kotlin file across every repo into a Lossless Semantic Tree. Types, symbols, comments, and formatting are preserved.

  2. Run the recipe.

    Recipes execute against the LST. Standard-library renames, enum-entries migrations, and Android deprecation cleanups apply deterministically across every affected file.

  3. Review and merge.

    Tier-1 transformations open as reviewable pull requests across every repo touched. Tier-2 changes with behavioral implications are flagged inline so engineers decide before merge.

Questions

Kotlin modernization, answered.

Moderne supports Kotlin from 1.x through 2.x, with migration recipes covering the full transition. The UpgradeToKotlin2 recipe automates standard library renames (toLowerCase to lowercase, appendln to appendLine, Enum.values to Enum.entries, capitalize and decapitalize), kotlinx library bumps (coroutines, datetime, serialization) targeting the latest supported versions, Gradle plugin upgrades to 2.x, and removal of deprecated build properties.

OpenRewrite ships a Kotlin DSL for declarative recipe authoring. A K2 compiler plugin reads paired before-and-after Kotlin lambdas and synthesizes a Recipe subclass at compile time, the same way Refaster’s annotation processor works for Java. Recipe authors stay in idiomatic Kotlin with no annotations, no separate template class, and no runtime reflection. Pattern-shaped refactorings use the declarative shape. Structural recipes that need annotations or lexical context drop into an imperative KotlinVisitor scope.

IntelliJ inspections are IDE-bound and operate per-file in the developer’s editor. Detekt is static analysis that flags issues but doesn’t coordinate fixes across repositories. Moderne provides deterministic transformations that apply across hundreds of repositories in a single coordinated run, delivering reviewable pull requests at scale. IDE inspections require a developer to be present. Moderne provides the portfolio-wide automation layer that engineers and coding agents call when they need transformations applied at scale.

Yes. Build.gradle (Groovy DSL) and build.gradle.kts (Kotlin DSL) files parse into the LST alongside Maven coordinates and Gradle version catalogs. The UpgradeKotlinGradlePlugins recipe handles Kotlin plugin version upgrades across both build file formats, and dependency management recipes apply consistently regardless of which DSL a repository uses.

Moderne’s migration model runs in two tiers. Tier 1 covers transformations with a clear, known target state and applies them automatically. Examples include case conversions, appendLine swaps, and enum entries replacements. Tier 2 surfaces changes with behavioral implications and flags them with inline markers so engineers decide before any transformation runs. Engineers get the automated wins immediately and a prioritized list of what needs a decision.

Yes. Kotlin is fully represented in the OpenRewrite Lossless Semantic Tree, giving coding agents a compiler-accurate model of Kotlin source code to reason over. Recipes provide the deterministic execution layer agents call when they need transformations applied safely and consistently across repositories. This is the same Agent Tools infrastructure (Prethink, Trigrep, Skills, MCP) Moderne provides across Java, JavaScript, Python, and C# codebases.

Get started

Modernize Kotlin once. Then keep moving with the ecosystem.

Recipes lock in the upgrade. Future Kotlin and Android deprecations run on the same engine, on the same review workflow.