Project Valhalla, Explained: How a Decade of Work Arrives in JDK 28(jvm-weekly.com)
602 points by philonoist 1 day ago | 379 comments
tl;dr: After 12 years of development, JEP 401 (Value Classes and Objects) is landing as a preview in JDK 28, letting developers declare classes without identity so the JVM can scalarize them or flatten them into dense memory layouts—closing the gap between "codes like a class, works like an int." The initial release covers value classes, migration of primitive wrappers like Integer, and cheaper boxing, but notably excludes null-restricted types and specialized generics (so `ArrayList<Point>` still won't be flat). Value objects can still be null, `==` now means substitutability, and `synchronized` on them throws—expect the full payoff only across future releases.
HN Discussion:
  • Disagrees with article's framing that null-restricted types add mental overhead; sees omission as a major flaw
  • Article contains technical inaccuracies and possibly AI-generated/hallucinated content
  • Java is a modern, capable platform and Valhalla represents impressive engineering work worth defending
  • This work just replicates what C#/.NET and C++/Rust have had for years
  • ~Using == as memcmp-like substitutability breaks encapsulation and exposes implementation details