Value classes in Kotlin 2.5.0 and beyond
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
JetBrains' Kotlin 2.5.0 introduces full value classes, now in Alpha: immutable classes with any number of primary properties, lean codegen (equals, hashCode, toString only), and name-based destructuring. On JDK 28 and later, they can compile to JVM value classes from Project Valhalla for performance gains.