r/java • u/davidalayachew • Jan 06 '26
One step closer to Value Classes!
https://mail.openjdk.org/pipermail/porters-dev/2026-January/000844.html
184
Upvotes
r/java • u/davidalayachew • Jan 06 '26
View all comments
Show parent comment
1
u/koflerdavid Jan 07 '26 edited Jan 07 '26
What do you mean with "small decimal"? It is unlimited precision or it isn't. I can imagine a refactoring into a type hierarchy where small integers are represented as a value type and larger ones as instances of reference types. Edit: Though if you store them in a variable of an interface type, the JVM would be forced to use boxed represenations even for the value type. JIT heroics nonwithstanding.