Project Valhalla Hits JDK 28: Preview of Value Types Arrives
Project Valhalla's JEP 401, introducing value classes and objects, merges into the OpenJDK mainline as a preview feature in JDK 28, involving 1,816 files and over 197,000 new lines, with a cautious rollout timeline and notable design trade‑offs for Java performance.
Oracle engineer Lois Foltan confirmed that the core proposal of Project Valhalla—JEP 401 "Value Classes and Value Objects"—will be merged into the OpenJDK mainline in early July and shipped as a preview feature in JDK 28.
At the time of writing, the official JDK release is JDK 26; JDK 27 is expected in September 2026, JDK 28 is slated for March 2027, and the next LTS release, JDK 29, is planned for September 2027.
Because the change set is massive—1,816 modified files and more than 197,000 lines of new code—the project lead Brian Goetz asked contributors to avoid large‑scale refactorings during the merge window to keep the integration smooth.
JEP 401 originated in August 2022 to address Java’s long‑standing performance bottleneck: apart from primitive types like int and double, every custom object carries an object header and identity, inflating memory usage in array‑heavy and high‑frequency data scenarios, which is a key reason for Java’s high memory footprint in big‑data, AI, and high‑performance computing workloads.
Core Design Idea: Strip Object Identity to Unlock Low‑Level Optimizations
Java chief architect Brian Goetz explained that the existing model forces all objects to follow reference semantics. The first step of JEP 401 is to remove the "object identity" from value classes, freeing up substantial optimization space, especially for small data objects.
Full pure‑value semantics still require solving issues such as null handling and atomic safety under concurrency (ASUR). Languages like C# with struct support are actively refining these capabilities.
Goetz noted that the biggest difficulty is redesigning the underlying model without breaking developers' expectations of object encapsulation and integrity, as the class abstraction is a mature barrier that can easily disrupt existing coding habits.
The project will introduce a few deliberately incompatible changes; for example, synchronizing on an Integer wrapper will now throw a runtime exception.
Version Progress: No Immediate Promotion to Standard
Goetz cautioned developers not to expect rapid promotion of this feature: even in JDK 29 (the next LTS), JEP 401 will most likely remain a preview. He compared it to the Vector API, which also required multiple preview iterations before becoming permanent.
Preview Usage Rules
In JDK 28, JEP 401 is disabled by default. Developers must enable it with the appropriate preview flag to use value‑class syntax. The API, syntax, and underlying behavior may still change, so it is not recommended for large‑scale production use—only for technical research or internal tooling experiments.
Industry Value
For workloads that frequently create small data entities—such as big‑data processing, quantitative trading, AI numeric computation, and game services—value types can dramatically lower GC pressure and memory consumption, narrowing the performance gap between Java and native languages like C++ or Rust in compute‑intensive scenarios.
Related Terminology
Project Valhalla : Java value‑type upgrade initiative.
JEP 401 : Specification for value classes and value objects, the core proposal implemented here.
Preview Feature : Syntax/API not stable, no cross‑version compatibility guarantee.
Scalarization : JIT optimization that breaks value objects into register variables, avoiding heap allocation.
Heap Flattening : Stores value‑class fields directly within arrays or objects, eliminating separate heap objects.
Object Identity : Traditional Java objects have a unique identity supporting the == operator.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
