Project Valhalla
Project Valhalla is augmenting the Java object model with value objects, combining the abstractions of object-oriented programming with the performance characteristics of simple primitives. Supplementary changes to Java’s generics will carry these performance gains into generic APIs.
This Project is sponsored by the HotSpot Group.
JEPs
Valhalla project features will be added to Java over multiple releases. This process is managed with JEPs, each of which facilitates the development and integration into the JDK of a cohesive set of changes.
There are five distinct feature sets under development:
-
Value Classes and Objects, introducing objects that lack identity and thus can have optimized encodings
-
Null-Restricted and Nullable Types, providing language support for null-aware types and runtime enforcement of null restrictions
-
Null-Restricted Value Class Types, improving the performance of fields and arrays with null-restricted value class types
-
Enhanced Primitive Boxing, allowing primitives to be treated more like objects
-
Parametric JVM, preserving and optimizing generic class and method parameterizations at runtime
We’ve also worked on some supplementary tasks and features, including:
-
JEP 181: Nest-Based Access Control (delivered in 11)
-
JEP 309: Dynamic Class-File Constants (delivered in 11)
-
JEP 334: JVM Constants API (delivered in 12)
-
JEP 371: Hidden Classes (delivered in 15)
-
JEP 390: Warnings for Value-Based Classes (delivered in 16)
Background Documents & Presentations
These documents and presentations present a more holistic view of the Valhalla project’s goals and design considerations.
- The State of Valhalla (December 2021)
- Parametric JVM
- Background: How We Got the Generics We Have (June 2020)
- The Saga of the Parametric VM (April 2021)
- Dan Smith: Value Objects in Valhalla (JVM Language Summit, August 2023)
Implementation
Development takes place in a public OpenJDK repository, with occasional early-access builds being published.
Interested developers are encouraged to experiment with these early releases.
Branches in the repository include lworld
(the main line of Valhalla development), master
(tracking mainline OpenJDK), and various others prototyping proposed features.
Community
-
Mailing lists
-
valhalla-dev, for technical discussion related to Project Valhalla (archives)
-
valhalla-spec-experts, for moderated design discussion among expert group members only (archives)
-
valhalla-spec-observers, for those who wish to monitor discussions in the valhalla-spec-experts list; public replies are allowed, but not forwarded to the experts list (archives)
-
valhalla-spec-comments, for sending specification-related comments, suggestions, and other feedback to the expert group (archives)
-
-
Documentation repository (allows updating this page!)
We welcome input from interested Java developers. Keep in mind that most theoretical ideas have been well explored over the last few years! The greatest help can be provided by those who try out concrete prototypes and can share their experiences with real-world code bases.
Legacy Links
See the legacy page for links to earlier proposed JEPs, design documents, presentations, and prototypes.