Java’s long-awaited Project Valhalla takes a major step forward with the integration of JEP 401 into OpenJDK, set to debut as a preview feature in JDK 28. This introduces value classes, transforming how Java manages object identity and promising significant runtime optimizations.

  • JEP 401 adds value classes, removing traditional object identity
  • Integration involves 197,000 lines of code across nearly 2,000 files
  • Feature arrives as a preview in JDK 28, targeted for March 2027

What happened

Oracle has confirmed the integration of Java Enhancement Proposal 401, which introduces value classes to Java, into the OpenJDK mainline. This update will appear as a preview feature in the upcoming JDK 28 release scheduled for March 2027. The change is part of Project Valhalla, a major initiative designed to improve Java's performance by rethinking object identity, a core aspect of the language that has remained mostly unchanged for years.

This update is monumental in scale, involving more than 197,000 lines of code and modifications to 1,816 files. The value classes concept allows Java developers to create data objects that lack unique identities in memory, focusing solely on the values they contain. Existing classes such as Integer will gradually migrate to this new model, and developers can create their own value classes for specialized use cases.

Why it matters

The introduction of value classes addresses longstanding inefficiencies caused by Java’s reliance on reference equality for most object types. Traditionally, even objects with identical data hold distinct memory addresses, complicating comparisons and increasing overhead. The new model eliminates identity from these objects, making equality checks simpler and more reliable by using only their data values.

This shift not only simplifies the programming model but also brings significant performance benefits. The Java Virtual Machine (JVM) can now optimize storage and access patterns, reducing memory usage and enhancing cache locality. Such improvements are critical for enterprise applications and performance-sensitive environments, reaffirming Java's relevance in modern software development.

What to watch next

Development teams should prepare for the implications of value classes, particularly as some behaviors will change in ways that may break existing code, such as synchronization issues with classes like Integer. As JEP 401 remains in preview through at least JDK 29, early adoption will require careful testing and gradual migration strategies to harness the benefits without introducing instability.

Looking forward, Oracle and the Java community will continue expanding value class support and identifying other JDK types suitable for migration. Developers can also experiment by defining their own value classes tailored to domain-specific needs involving immutable data. Keeping an eye on updates to Project Valhalla will be essential for leveraging Java’s evolving capabilities to their fullest.

Source assisted: This briefing began from a discovered source item from The Next Web. Open the original source.
How SignalDesk reports: feeds and outside sources are used for discovery. Public briefings are edited to add context, buyer relevance and attribution before they are published. Read the standards

Related briefings