The 17 new features in the latest Java release improve memory management and developer productivity and reduce boilerplate code.
The Oracle JDK 16 is another step in modernization efforts to make it easier for Java developers to use the programming language with APIs, microservices and other cloud technologies. This release brings Records and Pattern Matching out of preview. Those two JDK enhancement proposals and the other 15 JEPs in this release improve developer productivity and application performance, according to Oracle.
Chad Arimura, vice president of Java developer relations at Oracle, said these new features build on the fundamental strengths of Java–ease of use, reliability, security and platform independence–while making the language easier to use in cloud deployments. “It’s a thoughtful evolution of the language, but we’re thinking about what’s coming down the path as well,” he said.
Arimura said Records is the most anticipated language feature yet and is a way to reduce boilerplate code. “Records reduces a class to a single line of code and allows the compiler to do more of the interpretation,” he said.
Georges Saab, vice president of development, Java Platform Group, Oracle, said in a press release that Pattern Matching and Records have gone through multiple rounds of community feedback based on real-world applications.
“This process has not only given Java developers the opportunity to experiment with these features before they were finalized, but also incorporated that critical feedback which has resulted in two rock-solid JEPs that truly meet the needs of the community,” he said.
Arimura said that the relatively new twice-a-year release schedule has been a good thing for Java as an ecosystem and a platform. “The old way used to work when software took years to ship, but these days it’s much more agile, and Java has to match that agile delivery,” he said.
New versions are smaller than earlier iterations of the language, but it’s easier for vendors and individuals who contribute to the success of the code to support new releases, Arimura said.
“It’s easier to work new versions into deployment pipelines,” he said. “We’re moving to a world where it’s becoming easier to say, ‘I can depend on the next version of Java.'”
Two of the new features are designed to improve performance by addressing memory management.
JEP 387: Elastic Metaspace returns unused HotSpot class-metadata memory to the operating system more quickly, reduces metaspace footprint and simplifies the metaspace code to reduce maintenance costs.
JEP 376: ZGC: Concurrent Thread-Stack Processing moves ZGC thread-stack processing from safepoints to a concurrent phase to eliminate a significant bottleneck for allowing concurrent stack processing.
JEP 392 is a Packaging Tool for packaging self-contained Java applications and improving developer productivity.
Arimura said that features in preview are 95% usually complete, but the Java development team wants more time to gather feedback from the community before finalizing the features.
Four of the JEPs are in the incubator or preview stage.
JEP 338: Vector API (Incubator) provides an initial iteration of an incubator module, jdk.incubator.vector, to express vector computations that reliably compile at runtime to optimal vector hardware instructions on supported CPU architectures.
JEP 389: Foreign Linker API (Incubator) introduces an API that offers statically-typed, pure-Java access to native code.
JEP 393: Foreign-Memory Access API (Third Incubator) introduces an API to allow Java programs to safely and efficiently access foreign memory outside of the Java heap.
JEP 397: Sealed Classes (Second Preview) enhances the Java programming language with sealed classes and interfaces.
Oracle is hosting several day-long events to highlight the new features in Java 16. There are three sessions of the Oracle Developer Live: Java Innovations event:
- Americas on March 23
- Europe, Middle East and Africa on March 25
- Asia Pacific on March 30
These three JEPs represent improvements for OpenJDK contributors.
Two of the JEPs create new ports to provide support for Java on more platforms.
JEP 386: Alpine Linux Port ports the JDK to Alpine Linux and to other Linux distributions that use musl as their primary C library on both the x64 and AArch64 architectures.
JEP 388: Windows/AArch64 Port ports the JDK to Windows/AArch64.
The other new features include:
JEP 380: UNIX-Domain Socket Channels adds support for all of the features of UNIX-domain sockets that are common across the major UNIX platforms and Windows to the socket channel and server-socket channel APIs in the java.nio.channels package.
JEP 396: Strongly Encapsulate JDK Internals by Default tightens the constraints on new internal API elements by encapsulating most internal elements of the JDK by default, except for critical internal APIs such as sun.misc.Unsafe.
JEP 390: Warnings for Value-Based Classes designates the primitive wrapper classes as value-based and deprecates their constructors for removal, prompting new deprecation warnings. It also provides warnings about improper attempts to synchronize on instances of any value-based classes in the Java Platform.
This post was written by and was first posted to TechRepublic
Do you find this article helpful? Your Friend might too. So, please Share it with them using the Share button above.
Will you like to get notified when I post new updates? Then Follow me on any of my social media handles: Google News, Telegram, WhatsApp, Twitter, Facebook, Pinterest.
You can also drop your email address below if you wish to be notified by mail.