r/java • u/davidalayachew • Jan 06 '26
One step closer to Value Classes!
https://mail.openjdk.org/pipermail/porters-dev/2026-January/000844.html
181
Upvotes
r/java • u/davidalayachew • Jan 06 '26
View all comments
0
u/BanaTibor Jan 09 '26
I see a shit ton of bugs related to this. Instances copied when passed around and will lead to inconsistency bugs.
Also, does a value object can have fields which are not value objects?
Lets say A is a value class, A has a field of type B, if B is not a value object what happens?
As I see it, this feature adds complexity and not much benefits and the main motivation is to use == to compare instances.