Java 21 gets 15 major enhancements and long-term support
Hewing to an every-six-month release schedule it has maintained for more than five years, Oracle Corp. today announced the availability of Java 21 and designated it as a candidate for long-term support, the first version of Java to receive that credential in two years.
Introduced 28 years ago, Java is the world’s fourth most widely used programming language, according to Tiobe Software BV, and is especially popular with enterprise developers. Oracle said there are 60 billion active Java virtual machines in use, with 38 billion of them in the cloud.
“We hear time and time again that customers’ choice to invest in Java has paid dividends because it navigates to where they want it to be,” said Georges Saab, senior vice president of development for the Java platform and chairman of the OpenJDK Governing Board. “Not only do the updates come when intended but the work on new features is very transparent. They can see every change as it’s going in. They can see the code reviews that are done and the questions that people are asking.”
Oracle took ownership of Java in 2010 with the acquisition of Sun Microsystems Inc. It continues to be the largest contributor to the open-source project by a wide margin, but Oracle says some 20 other organizations have also made significant contributions, including Red Hat Inc., SAP SE and Google LLC.
15 major enhancements
Java 21 features thousands of performance, stability and security improvements. The new Java Development Kit includes 15 JDK Enhancement Proposals, which are key parts of the long-term Roadmap for JDK Release Projects and related efforts.
The JEPs are organized into six projects around different aspects of performance and features. The Amber project, which seeks to evolve the language continuously toward being more concise and less error-prone, is getting six major upgrades.
- The String Templates feature, which is in preview, makes it easier to express strings that include values computed at run time and improves security in programs that compose strings from user-provided values and pass them to other systems.
- Record Patterns, a feature in its third preview, extends pattern matching to “destructure” instances of record classes and enables the addition of nested patterns to handle more sophisticated and composable data queries.
- Pattern Matching for Switch expands the expressiveness and applicability of switch expressions — which assign a value from a branch directly to a variable — and statements by allowing patterns to appear in case labels.
- Unnamed Patterns and Variables, which is in preview, improves readability and maintainability by enabling unnamed patterns to match a record component without stating the component’s name or type, as well as unnamed variables that can be initialized but not used.
- Unnamed Classes and Instance Main Methods, which is also in preview, simplifies the introduction to Java for new programmers by allowing student-built programs to be compiled and run without a separate beginner’s dialect and toolchain.
Project Panama, which is about connective Java native code to interface with external libraries, is getting two new preview features.
- The Foreign Function & Memory application program interface can be used to enable Java programs to interoperate with code and data outside of the Java runtime environment by safely calling native libraries and processing native data without requiring the Java Native Interface.
- The Vector API expresses vector computations that reliably compile at runtime to vector instructions on supported CPU architectures.
Virtual threads improve scalability
Project Loom, which focuses on achieving massive parallelism without the need to write asynchronous code, is getting three major updates.
- Support for Virtual Threads streamlines the process of writing, maintaining, and observing high-throughput, concurrent applications by introducing lightweight virtual threads to the Java Platform. “In the past, there was a one-to-one mapping between a Java thread and a native platform thread,” Saab said. “That meant your Java application could scale up to the scalability of the underlying operating system and platform. This allows you to increase the scalability of your Java workload far beyond the very good scalability that you got before, but in a way that doesn’t make you resort to different kinds of techniques like asynchronous or reactive programming.”
- Scoped Values, which is in preview, permits the sharing of immutable data within and across threads for easier use, comprehensibility, robustness and performance.
- Structured Concurrency, which is also in preview, simplifies concurrent programming by introducing an API that helps avoid common risks arising from cancellation and shutdown and improves the observability of concurrent code.
Another significant performance update extends the scalable, low-latency Z Garbage Collector to maintain separate generations for young and old objects, thus lowering the overhead of required heap memory and garbage collection CPU for applications.
Java 21 will be supported by Java Management Service, an Oracle Cloud Infrastructure-native service that provides a single console that organizations can use to manage Java runtimes and applications on-premises or on any cloud.
Java 21 has also been designated as a “Commercial Support” version, meaning that Oracle will support it for at least eight years. At the same time, the company said, long-term support for Java 11 has been extended an additional eight years through at least January 2032.
The last version to receive a Commercial Support designation was Java 17 in the fall of 2021. The longer support period is intended to give organizations the flexibility to keep applications in production longer with minimal maintenance with the goal of eventually migrating to a new version on their own terms.
Image: Pixabay
A message from John Furrier, co-founder of SiliconANGLE:
Your vote of support is important to us and it helps us keep the content FREE.
One click below supports our mission to provide free, deep, and relevant content.
Join our community on YouTube
Join the community that includes more than 15,000 #CubeAlumni experts, including Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger, and many more luminaries and experts.
THANK YOU