Oracle has recently offered a glimpse into the future of Java development with the announcement of five upcoming features slated for release in the near future. These features aim to introduce significant enhancements in how Java handles primitives, value types, and immutable data. The advancements are set to arrive in future versions of the Java Development Kit (JDK), with JDK 25, expected in September, being the main focus for some of these updates. These features are currently in the preview stage, with JDK Enhancement Proposals (JEPs) published for each one.
Among the most notable features is enhanced primitive boxing, which seeks to improve how primitive types are treated in Java. Traditionally, primitive types are handled separately from reference types, but this enhancement would allow primitives to behave more like objects. Specifically, this change will allow primitive values to be treated as reference types during method invocations and field accesses. It will also introduce unboxed return types when overriding methods with reference-typed returns, making it easier to work with primitive types in more flexible and dynamic ways.
Another exciting feature is the introduction of null-restricted value class types, which would allow developers to define value objects that explicitly exclude null values. This innovation not only helps with more compact storage but also opens the door for additional runtime optimizations. This feature aims to improve memory management and performance by preventing null values in value objects, leading to more efficient use of resources. As both a language and virtual machine feature, null-restricted value class types promise to enhance Java’s ability to manage and optimize memory at a deeper level.
Value classes and objects represent a major step forward in simplifying how developers work with data. These are special class instances that lack identity and only contain final fields. This change enables developers to define classes in a way that optimizes memory footprint and improves garbage collection efficiency. Furthermore, derived record creation provides an easy way to create new records from existing ones. This feature will streamline the creation of immutable data structures, removing the need for additional “wither” methods and simplifying record class declarations.
Lastly, stable values—objects that hold immutable data—are poised to become an important tool for performance optimization in Java. Treated as constants by the JVM, stable values can help speed up application startup times by enabling more efficient initialization. The goal is to improve overall performance while offering more flexibility in the timing of initialization, which could significantly enhance the efficiency of Java applications in large-scale systems. Together, these upcoming features reflect Oracle’s ongoing efforts to make Java more powerful, flexible, and efficient for developers around the world.