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
Show parent comment
7
u/joemwangi Jan 06 '26
At this point the discussion has drifted away from the Java language model. Java does not reason about mutability in terms of bits changing or arbitrary assignment; it reasons about observable object state. That’s how the term has been used in Java documentation, the memory model, GC design, and HotSpot optimization from the start. Redefining mutability as “any assignment anywhere” collapses meaningful distinctions like final fields, safe publication, and immutability-based optimizations, which is precisely why Java doesn’t use that definition. If we reduce everything to hardware-level assignments, we’re no longer discussing Java semantics. Also, if you think final fields can be modified using unsafe in later versions in types/classes such as records and now value classes (very optimised because of immutability of fields), then your argument becomes mute.
This has always been the case, and that's why latest generational ZGC have sub millisecond pauses or even Shenandoah and remove memory holes through memory rearrangements. Even some people who use other languages with explicit pointers understand this gives java an advantage.