Hacker News
Value Classes Still Need Compiler Sympathy
JDK 28’s preview of Valhalla value classes lets the JVM drop object identity, enabling flattening, scalarization, and trivial escape analysis, but only when fields are strictly initialized and immutable; otherwise mutable fields force a reference layout. The article demonstrates this with a 32-byte record that can be stored non-atomically flat in an immutable envelope, while a mutable envelope requires a regular object reference to preserve tear-free updates.