Skip to content

Upgrade Kotlin to 2.4.20-RC3 - #237

Draft
vRallev wants to merge 6 commits into
mainfrom
ralf/kotlin-2.4.20-beta2
Draft

Upgrade Kotlin to 2.4.20-RC3#237
vRallev wants to merge 6 commits into
mainfrom
ralf/kotlin-2.4.20-beta2

Conversation

@vRallev

@vRallev vRallev commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Upgrade the main build from Kotlin 2.4.10 to 2.4.20-RC3; leave blueprints/ unchanged.
  • Adapt App Platform's compiler extension and compiler-test APIs to Kotlin 2.4.20.
  • Keep Metro's normal FIR contribution hints and IR class generation enabled together on every platform; no Native, Wasm, or other platform workaround disables IR generation.
  • Refresh generated compiler-test and public API expectations for Metro's IR output.

Commit history

Upgrade Kotlin to 2.4.20-Beta2

Introduced the Kotlin 2.4.20 compiler API migration and the initial FIR-to-IR investigation. It established the updated compiler tests and kept the standalone blueprints out of scope.

Resolve App Platform Metro contributions in IR

Explored generating App Platform's contribution containers entirely through Metro's IR extension path, including cross-module discovery and compiler-plugin ordering.

Remove obsolete Metro compatibility workarounds

Removed that custom path after Metro 1.4.1 began generating the required FIR contribution hints alongside IR classes on Kotlin 2.4.20, including Native and Wasm. App Platform now follows Metro's production FIR/IR configuration without rewriting plugin options.

Use supported IR annotation class API

Replace Kotlin's deprecated IrAnnotation.symbol access with classSymbol, avoiding a compiler warning that CI treats as an error.

Upgrade Metro to 1.4.2

Validated the compiler extensions with Metro 1.4.2. The dependency itself is already present on current main after the rebase, so this PR introduces no additional Metro version change.

Upgrade Kotlin to 2.4.20-RC3

Move from the original Beta2 target to the final 2.4.20 release candidate and regenerate the affected compiler-test and API expectations.

Release and issue review

Kotlin 2.4.20-RC3 was released on 2026-09-02. Its RC3-specific fix is KT-88953, a compiler ClassCastException involving suspend conversion of nullable arguments. I found no other publicly reported issue specific to 2.4.20-RC3. Metro's compatibility table directly tests the Kotlin 2.4.20-RC line and documents best-effort forward compatibility for newer compiler builds.

Validation

  • Android host/unit, iOS simulator, Desktop, Linux, and Wasm tests passed.
  • Metro compiler-plugin tests and generated test runners passed.
  • apiCheck, Detekt, Android lint, module-structure checks, and ktfmt passed.
  • Exact org.jetbrains.kotlin:kotlin-compiler-embeddable:2.4.20-RC3 resolution was verified.
  • Focused compiler-plugin tests and apiCheck passed again after the final rebase onto current origin/main.

@vRallev
vRallev force-pushed the ralf/kotlin-2.4.20-beta2 branch 4 times, most recently from 65d913b to 611c850 Compare August 7, 2026 04:38
Move the main build from Kotlin 2.4.10 to 2.4.20-Beta2 and adapt the compiler extension APIs and test goldens for the new compiler.

Metro's IR mode no longer invokes App Platform's FIR declaration generators, while downstream Native and Wasm compilations still need FIR package hints to discover contributions. Generate renderer, robot, and scoped binding containers in IR through Metro's contribution API, retain FIR only for cross-module hints, and order App Platform's compiler plugin before Metro's graph transformation. This keeps Metro class generation in IR enabled on every target.

Update the affected generated API snapshots and leave the standalone blueprints unchanged.
Move renderer, robot, and scoped target resolution off FIR metadata when Metro's IR class generation is enabled. This keeps JVM consumers on a pure IR path while retaining FIR contribution hints only for cross-module discovery in KLIB targets.

Mirror Metro's generation option into the App Platform compiler plugin so the FIR fallback remains mode-correct, and run the box corpus without FIR hints to cover the IR-only behavior.
Metro 1.4.1 generates FIR contribution hints alongside IR class generation on Kotlin 2.4.20+, including Native and Wasm. Restore App Platform's FIR declaration shells and existing IR body fillers, remove the custom option rewriting and all-IR generation path, and make compiler tests exercise Metro's production FIR/IR configuration.
Kotlin 2.4.20 deprecates `IrAnnotation.symbol`, and fresh CI builds reject the warning under `-Werror`. Read `classSymbol` directly so the compiler plugin remains compatible with the supported IR API.
Metro 1.4.2 was released on 2026-08-14 and fixes typealias resolution in `KClass` annotation arguments, `@Origin`-chain exclusions and replacements, Kotlin/JS provider-field collisions for inherited member injection, Dagger-interop crashes for deeply nested class names, and incremental regeneration when `GraphExtension` members change. These fixes reduce compiler-plugin risk for App Platform’s generated contributions and graph extensions; current call sites require no compatibility changes. Metro also tests Kotlin 2.4.20-RC, which covers the project’s 2.4.20-Beta2 compiler line.

Upgrade `dev.zacsweers.metro:compiler`, `dev.zacsweers.metro:gradle-plugin`, and `dev.zacsweers.metro:runtime` from 1.4.1 to 1.4.2 through `gradle/libs.versions.toml`, and update `CHANGELOG.md`. The compiler remains on Java 21, the runtime still declares Kotlin stdlib 2.3.0, and the Gradle plugin keeps kotlinx-serialization JSON 1.11.0, so platform and transitive dependency floors are unchanged. The standalone `blueprints/` projects remain untouched.

No publicly discoverable 1.4.2-specific issue was found in Metro’s GitHub tracker, security advisories, or Google Issue Tracker as of 2026-08-14 UTC. Confidence is limited because this is a same-day release. The repository’s Metro version history is monotonic and contains no prior Metro rollback.

Release: https://github.com/ZacSweers/metro/releases/tag/1.4.2
Comparison: ZacSweers/metro@1.4.1...1.4.2
GitHub issues: https://github.com/ZacSweers/metro/issues?q=is%3Aissue+%221.4.2%22
Google Issue Tracker: https://issuetracker.google.com/issues?q=%22dev.zacsweers.metro%22%20%221.4.2%22
Validate Kotlin's final 2.4.20 release candidate with Metro's IR class generation and refresh the affected compiler-test and API expectations. This keeps App Platform compatible without platform-specific class-generation workarounds.

Kotlin 2.4.20-RC3 was released on 2026-09-02 and fixes KT-88953, a compiler ClassCastException involving suspend conversion of nullable arguments. No additional exact-RC3 regressions were found in the upstream issue search.

Release: https://github.com/JetBrains/kotlin/releases/tag/v2.4.20-RC3

Metro compatibility: https://github.com/ZacSweers/metro/blob/main/docs/compatibility.md
@vRallev
vRallev force-pushed the ralf/kotlin-2.4.20-beta2 branch from 5263bfe to 994924f Compare September 3, 2026 03:21
@vRallev vRallev changed the title Upgrade Kotlin to 2.4.20-Beta2 Upgrade Kotlin to 2.4.20-RC3 Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant