Kotlin 2.5.0 released with full value classes and stable Kotlin/Wasm
JetBrains released Kotlin 2.5.0 on December 2, 2026. The headline language feature is full value classes: immutable classes with any number of properties, declared like data classes but with the value modifier, and able to compile to JVM value classes from Project Valhalla on JDK 28. They are in Alpha, so they are for experiments, not production. The same release makes Kotlin/Wasm Stable and moves Swift export to Beta.
What’s new
Full value classes (Alpha)
Until now, a Kotlin value class could wrap only one property and had to be marked @JvmInline on the JVM. In 2.5.0, a value class can have as many primary properties as you need. The example from JetBrains’ announcement looks like this:
value class Point(val x: Double, val y: Double)
value class Rectangle(val from: Point, val to: Point) {
init {
require(from.x != to.x && from.y != to.y) { "This is a line!" }
}
}
The rules that make them different from data classes:
- An instance is defined only by its primary properties. A value class can’t have other properties with backing fields; extra properties must be computed with a getter.
- Less generated code. The compiler generates
equals(),hashCode()andtoString(), but nocopy()and nocomponentN()functions. - Name-based destructuring by default. Destructuring a value class matches properties by name, not position. JetBrains says a replacement for
copy(), called copy properties, should arrive as Alpha in Kotlin 2.6.0. - No identity. Referential equality (
===) and synchronizing on a value class are mistakes, and the compiler reports them. On the JVM, synchronization fails at runtime.
Value classes work on every platform Kotlin targets and on older JDKs. Two compiler options control them: -Xfull-value-classes turns the language feature on, and -Xvalhalla-value-classes compiles them into JVM value classes, which needs JDK 28 or later to build and to run. Value objects arrive as a preview feature in JDK 28, after more than a decade of work on Project Valhalla; JDK 28 is available as early-access builds and is scheduled for general availability on March 9, 2027. JetBrains says it is still looking at optimizations for Native, JavaScript and WebAssembly, and that on Android they depend on R8.
Kotlin/Wasm is Stable
According to What’s new in Kotlin 2.5.0, Kotlin/Wasm is now “ready for production use”. Compared with the Beta it produces smaller binaries, so apps load faster, and its behavior matches the other Kotlin targets. The stability promise does not cover JavaScript interop, WebAssembly Component Model support or the @WasmImport and @WasmExport annotations, which can still change. Browser apps can now also be built without webpack.
Other changes
- Stable language features: improved compile-time constants, the
@IntroducedAtannotation, the unused return value checker (now on by default in check mode) and name-based destructuring in only-syntax mode, whereval (x, y)stays positional and(val x, val y)matches by name. - Companion extensions and blocks (Experimental): declare members reachable through a type’s name without a
companion object; on the JVM they become static members without@JvmStatic. - Platforms: support for Java 28 on the JVM, Swift export and SwiftPM import in Beta, an
es2020target for Kotlin/JS, and a new publication format for multiplatform libraries. - Stricter equality checks: the
-Xstrict-equality-for-structural-classesoption warns when you compare unrelated value classes, data classes or enums with==.
What it means for developers
To update, change the Kotlin version to 2.5.0 in your build scripts; the latest IntelliJ IDEA and Android Studio include it. The stable parts of this release, Kotlin/Wasm above all, are the ones to adopt now.
Treat full value classes as a preview. JetBrains says they are “not production-ready and breaking changes are expected”, and asks for feedback from toy projects. To try them in Gradle:
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xfull-value-classes")
}
}
There is one change to watch even if you don’t touch the new feature. From Kotlin 2.5.20, single-property value classes get a multiplatform inline modifier (inline value class Age(val age: Int)), and unless full value classes are enabled, every value class needs inline or @JvmInline on every platform, not only the JVM. @JvmInline classes are not deprecated. Library authors will be able to mark a class with @WillBecomeValue from 2.5.20 so the compiler warns users about code that would break when it becomes a value class.
If you build Android apps with Kotlin, our post on Google AI Studio building full-stack Android apps covers another tool that writes Kotlin for you.
How it compares
Kotlin’s existing data classes stay as they are: they keep copy() and positional componentN() functions and have identity. Value classes give up those functions and identity in exchange for stronger immutability guarantees and, on JDK 28 with Valhalla, what JetBrains calls “potentially, better performance”. Java’s own value classes are still a preview feature in JDK 28, so neither language treats them as final yet.
Sources
- Value classes in Kotlin 2.5.0 and beyond (JetBrains Kotlin blog)
- What’s new in Kotlin 2.5.0 (Kotlin documentation)
- Project Valhalla and JDK 28 (OpenJDK)