Oracle has recently shared a preview of five exciting new features slated for upcoming Java releases, building on the momentum from the recent launch of JDK 24. These enhancements promise to improve both the language’s performance and developer experience by introducing refined ways to handle data types and records. Among the most anticipated features is “stable values,” which is targeted for inclusion in JDK 25 this September, offering a new approach to immutable data handling.
One of the standout features is enhanced primitive boxing. This proposal aims to allow primitive types to behave more like reference types by enabling boxing of primitives when they act as receivers of method calls or field accesses. It also supports primitive types as type arguments, simplifying the way primitives interact with Java’s object-oriented nature. This feature promises more flexibility and consistency when working with primitives in Java code.
Another major addition is null-restricted value class types. These allow variables that hold value objects to explicitly exclude null, which can lead to more compact memory usage and optimizations at runtime. This feature is currently in preview and exists both as a language-level and virtual machine-level enhancement, aiming to boost efficiency and safety in Java applications by reducing null-related errors and overhead.
Value classes and objects also bring significant improvements by introducing class instances that lack object identity and contain only final fields. This model allows developers to create simple, immutable value types, enabling better memory locality and garbage collection. Additionally, derived record creation makes it easier to create new records based on existing ones without boilerplate code, streamlining Java’s record system. Together with stable values, which treat immutable objects as constants for optimization purposes, these features show Oracle’s commitment to evolving Java into a faster, more memory-efficient platform without sacrificing developer productivity.