r/java • u/davidalayachew • Jan 06 '26
One step closer to Value Classes!
https://mail.openjdk.org/pipermail/porters-dev/2026-January/000844.html
178
Upvotes
r/java • u/davidalayachew • Jan 06 '26
View all comments
Show parent comment
7
u/Ok-Scheme-913 Jan 06 '26
You can't really solve it on the JVM without real value classes, so no. Scala and kotlin just have syntactic sugar for simple primitive wrappers, like UnsignedInt(int). Two primitives inside would already require an object.