With the arrival of Java 19 on September 20, attention has quickly shifted to what’s coming in JDK 20, expected to release in March 2023. Developers and enterprises alike are eager to see what the next iteration of the Java Development Kit will offer, particularly in the areas of enhanced generics, data immutability, and more efficient string handling. The update may also mark the transition of some preview features into finalized language capabilities, such as record patterns, further enhancing Java’s robustness.
As of late September, the OpenJDK webpage had not listed any officially proposed features for JDK 20. However, this is expected to change as development progresses and the community reaches a consensus on the new capabilities. Among the most highly anticipated features is the concept of universal generics. This enhancement aims to simplify and unify the use of generics for both reference and primitive types, a feature that developers have long awaited. Despite being considered for JDK 19, universal generics didn’t make the cut, leaving developers hopeful for its inclusion in JDK 20.
Another feature that could make waves in JDK 20 is extent-local variables. These variables are designed to support the sharing of immutable data efficiently, both within and across thread boundaries, providing developers with more reliable ways to handle data concurrency. Similarly, string templates are being explored to make Java code cleaner and more intuitive, allowing strings that embed runtime-computed values to be expressed seamlessly. This would be a significant quality-of-life improvement for developers who work extensively with dynamic string content.
Other potential features on the horizon include value objects and primitive classes. Value objects promise to enrich Java’s object model by enabling class instances to contain only final fields, eliminating object identity and thus making objects more lightweight. Primitive classes extend this concept by defining new primitive types, giving Java developers more flexibility in writing high-performance code. Additionally, sequenced collections are set to introduce a new interface that explicitly maintains the order of elements in a collection, and an API for asynchronous stack traces is being considered to improve debugging capabilities by providing detailed information on both Java and native frames. If these features make it into JDK 20, they will further position Java as a modern, efficient, and developer-friendly language.