
Kotlin Blog · 7 min read
Value classes in Kotlin 2.5.0 and beyond
Kotlin 2.5.0 introduces full value classes, offering immutable, data‑oriented types with potential performance gains, especially on JVMs supporting Project Valhalla. The article shows how to declare them, their restrictions, and how to enable the feature in Gradle for various platforms.
- Declare full value classes with the `value` modifier, similar to data classes but without copy/component functions
- Enable the feature via `-Xfull-value-classes` and optionally `-Xvalhalla-value-classes` in Gradle compiler options
- Use strict equality flags and compiler warnings to avoid identity and synchronization misuse