Value Classes Still Need Compiler Sympathy
Summary
Johan Sjölén analyzes preview features in JDK 28 (JEP 401, Valhalla) and explains how value classes remove identity to enable JVM optimizations, while also highlighting where the compiler may struggle with translations like type erasure bridges. The post provides concrete examples of flattening, memory layout, and the performance implications when interacting with mutable vs immutable structures, and argues for profiling to understand compiler decisions. It emphasizes that compiler sympathy is important for achieving the best results.