JDK 16, released by Oracle on March 16, brings a variety of new features that enhance the Java development experience. Among the most notable updates is the second preview of sealed classes, which enables more controlled class hierarchies, as well as the introduction of records, which simplify the creation of immutable data carriers. Additionally, JDK 16 introduces improvements to garbage collection, including concurrent thread-stack processing, further optimizing Java’s performance for modern applications.
As the reference implementation of Java 16, JDK 16 follows JDK 15, which was released in September 2020. However, JDK 16 is a feature release, offering only six months of support, while JDK 17, which is slated for release in September 2021, will be a long-term support (LTS) release. Oracle positions JDK 16 as a stepping stone for developers to migrate to JDK 17, providing an opportunity for testing and adaptation before committing to the more stable, long-term release.
A total of seventeen proposals have been officially targeted for inclusion in JDK 16. One such proposal is the “Warnings for Value-Based Classes,” which marks the primitive wrapper classes as value-based. This includes deprecating their constructors for future removal and issuing warnings when attempting to synchronize on instances of these classes. This change is part of Oracle’s ongoing work on the Valhalla Project, which aims to significantly enhance the Java programming model by introducing primitive classes. These classes are designed to be identity-free and support inline or flattened representations, offering more flexibility and performance improvements in certain use cases.
The shift toward primitive classes also opens the door for future migration of existing Java platform classes to these optimized structures. Some of the current candidates for migration are already informally marked as value-based classes in Java’s API specifications. As the Valhalla Project progresses, it is expected that these classes will eventually be migrated, leading to further improvements in the efficiency and performance of the Java platform.