Project Valhalla tees up Java object model improvements

OpenJDK proposals would introduce value objects, primitive objects, and unify basic primitives with objects, so that all Java values will be objects.

Project Valhalla tees up Java object model improvements
Nathan Dumlao / Lagarto Film / Unsplash

OpenJDK’s Project Valhalla, which explores advanced Java language and JVM feature possibilities, is moving forward with a staged delivery of value objects, primitive objects, and unification of basic primitives.

Overall, the ambitious Valhalla project is intended to heal a rift between primitives and objects. The three key capabilities, cited in a December 2021 blog post, “The State of Valhalla” by Brian Goetz, Java language architect at Oracle, are described in JDK Enhancement Proposals (JEP) currently pending in the OpenJDK community. Those three capabilities are:

Begun in 2014, Valhalla has the goals of bringing more flexible, flattened data types to JVM-based languages in order to restore the alignment between the programming model and the performance characteristics of modern hardware. A recent three-part series of blog posts on the project — “The Road to Valhalla,” “The Language Model,” and “The State of Valhalla” — outline the following goals:

  • A generics plan that involves universal generics and specialized generics.
  • Unification of primitives and objects so primitive-like types can be declared with classes while maintaining special runtime characteristics of primitives.
  • Migration of many value-based classes in the JDK to value classes.
  • Enabling data layouts better suited to the performance of current hardware by providing Java developers with an easier path to cache-efficient and dense memory layouts without compromising abstraction or type safety.

Valhalla is sponsored by the HotSpot Group, which is comprised of developers involved in the design, implementation, and maintenance of Java’s HotSpot virtual machine. The project already has delivered on warnings for value-based classes, provided in Java 16 in March 2021.

Copyright © 2022 IDG Communications, Inc.