Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Languages

Kotlin 2.5.0 makes Kotlin/Wasm stable and warns the compiler will require JDK 17

Kotlin 2.5.0 brings stable Wasm, multi-field value classes and faster builds, and breaks on JDK < 17, AGP < 8.8.2 and language-version 2.0.

Kotlin/Wasm is out of Beta: with Kotlin 2.5.0, released on December 2, 2026, JetBrains declares it stable and production-ready. The same release carries a change that reaches everyone, whether you target the browser or not: the compiler takes the next step towards requiring JDK 17, and running it on JDK 8 or 11 now ends in a compilation error.

What matters in this release

Stable Kotlin/Wasm. Compared with the Beta, it produces smaller binaries and aligns its semantics with the other targets, so the same code behaves the same on the JVM, native or Wasm. Its APIs now follow Kotlin's compatibility rules. The fine print: stability does not cover JavaScript interop, the WebAssembly Component Model, or the @WasmImport and @WasmExport annotations. If your app leans on calling into JS, that part can still change. On top of that, suspend lambdas now share generated classes, shrinking the binary by 3–4% on average, and there is a webpack-free mode for browser apps built on ES modules and import maps.

Multi-field value classes (Alpha). Until now a value class could wrap a single value. With -Xfull-value-classes you can write value class Complex(val real: Double, val imaginary: Double): the compiler generates equals(), hashCode() and toString(), but no copy() or componentN(), because instance identity no longer matters. The JVM angle is Project Valhalla: JDK 28 ships JVM value classes as a preview, and -Xvalhalla-value-classes compiles Kotlin value classes to that format (JDK 28 required to compile and run). JetBrains asks people to try them in toy projects and hold off on production.

Language. Now stable: improved compile-time constants, the @IntroducedAt annotation, the unused return value checker (on by default in check mode) and name-based destructuring in only-syntax mode, where val (x, y) stays positional and (val x, val y) matches by name. Experimental companion {} blocks arrive too, generating static members on the JVM without @JvmStatic.

Faster builds. The Gradle plugin now keeps compiler caches for the whole build session. In JetBrains' benchmark on Ktor, compilation went from 22 to 20 seconds on average (5–10% faster), at the cost of a little more daemon memory.

Lighter multiplatform libraries. An experimental publication format packs each platform's artifacts into a single .kar file. For cryptography-kotlin, the published set went from 7,539 files and 91 MB to 1,036 files and 23 MB. Only library authors need to care; consuming the new format already works everywhere.

The release also adds Java 28 bytecode support, an ES2020 target for Kotlin/JS and Swift export in Beta.

What can break

  • Compiler JDK. Running the compiler on anything older than JDK 17 is an error. -Xallow-pre-17-runtime-jdk gets you past it, but that flag goes away in Kotlin 2.5.20, when JDK 17 becomes mandatory. This is about the JDK that runs Gradle and the compiler, not the bytecode you target.
  • Android. The minimum Android Gradle Plugin version rises to 8.8.2, and direct AGP integration is deprecated whatever AGP version you use: if you apply kotlin-android, the way forward is AGP 9.0 and its built-in Kotlin support. Multiplatform libraries should move to Google's plugin for Android targets and rename androidTarget to android.
  • Language versions. -language-version=2.0 and 2.1 are no longer accepted.
  • Kotlin/Native. macosX64, tvosX64, watchosX64 and watchosArm32 are now errors, and the Android NDK targets are deprecated. Prebuilt archives are renamed to kotlin-native-prebuilt-<version>-<platform>, so check any script that downloads them from GitHub.
  • Old klibs. Artifacts built by compilers older than 1.6.0 are no longer consumed.

How to upgrade to Kotlin 2.5.0

Update IntelliJ IDEA or Android Studio to the latest version and bump the Kotlin version in your build. With the Gradle plugin:

kotlin
plugins {
    kotlin("jvm") version "2.5.0"
}

With a version catalog, kotlin = "2.5.0" in libs.versions.toml is enough. Gradle 8.14 to 9.8.1 is fully supported. The command-line compiler is on the GitHub releases page.

To try value classes on Valhalla, this is the setup JetBrains recommends:

kotlin
kotlin {
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of(28))
    }
    compilerOptions {
        freeCompilerArgs.addAll("-Xfull-value-classes", "-Xvalhalla-value-classes", "-Xjvm-preview")
    }
}
tasks.withType<JavaExec> {
    jvmArgumentProviders.add(CommandLineArgumentProvider { listOf("--enable-preview") })
}

Checklist before production

  1. Check which JDK runs Gradle (./gradlew --version) and move it to 17 or later before 2.5.20 makes it mandatory.
  2. Make sure Gradle sits between 8.14 and 9.8.1 and, on Android, AGP is 8.8.2 or later; plan the move to AGP 9.
  3. Grep your builds for -language-version and drop 2.0 or 2.1.
  4. If warnings fail your build, run a full build first: the unused return value checker is on and may flag code.
  5. Watch the Kotlin daemon's memory in CI and raise its heap if it struggles.
  6. Kotlin 2.5.0 fixes four security issues and updates seven dependencies with known vulnerabilities, which is reason enough not to stay on 2.4.

My take: stable Wasm makes the headline, but the JDK 17 change is the one most teams will feel. If your CI still starts Gradle on Java 11, fix it with this release, because the next one won't give you the choice.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗