Oracle Sets Foundation for the Language’s Future in Java 19

Java is the workhorse of programming languages and Oracle continues to build upon both the language and development platform, providing enhancements not only to improve productivity, stability, performance and security, but also to lay a foundation for the future of the language.
With the latest release of the platform, Java 19, also known as Java Development Kit (JDK) 19, Oracle has done just that — applying updates and improvements with seven JDK Enhancement Proposals (JEPs). Most of these updates are to be delivered as follow-up preview features improving on functionality introduced in earlier releases, said Georges Saab, senior vice president of development, Java Platform and Chair, OpenJDK Governing Board, Oracle.
Importance of Cadence
To maintain the rate of improvement to Java, five years ago Oracle instituted a six-month cadence for releases of the platform. Java 19 marks the tenth such release, which provides a steady stream of innovations.
“With this six-month cadence, you know, basically, our pipeline for innovation has become ongoing,” Saab said. “So the old model basically amounted to every three years, kind of emptying the pipeline, and then you have to start over from scratch. Instead, now, what we’re finding is that we’re having constant innovation, and these projects are able to sort of look across and see what others are doing, and dovetail those and find places where the combination is richer than the sum of its parts.”
Enterprises have become accustomed to the Java release cadence, observers say.
“As this is the tenth iteration since Oracle moved to its rolling six-month updates, I think this cadence highlights the fact that Oracle and its global user community have settled into a very workable rhythm with new incubator, preview, and production code flowing smoothly from one release to the next,” Brad Shimmin, an analyst at Omdia, told The New Stack. “Still, seeing the RISC-V port of the JDK (JEP 422) finding a home in the mainline codebase is great because it will open Java up to a new world of edge and IoT devices.”
Java 19 comes smack dab in the middle of Long-Term-Support (LTS) releases of the platform. The last LTS release was Java 17 released in September 2021 and the next one will be Java 21, which is due in September of 2023. Oracle intends to make future LTS releases every two years.
“There is one aspect that makes Java 19 remarkable. It is right in the middle between LTS releases, which means we can already trace the trends of Java evolution,” said Dmitry Chuyko, Performance Architect at BellSoft, in a blog post. BellSoft is a key OpenJDK contributor and provider of the Liberica JDK.
Chuyko noted that JEPs added to JDK19 demonstrate that Java strives to be a universal programming language used in any environment, for any task, and with any technology.
“For instance, the addition of RISC-V port broadens the range of supported platforms, Foreign Function & Memory API enables the usage of data outside of the [Java Virtual Machine] JVM, and virtual threads will make Java an ideal choice for high-throughput concurrent applications. Thus, we expect this trend to be going strong all the way till the next LTS release and maybe even later,” he said.
Virtual Threads
Meanwhile, perhaps the most significant feature in Java 19 is JEP 425, Virtual Threads, released in preview. Virtual Threads “dramatically reduces the effort of writing, maintaining, and observing high-throughput concurrent applications by introducing lightweight virtual threads to the Java Platform. Using virtual threads allows developers to easily troubleshoot, debug, and profile concurrent applications with existing JDK tools and techniques,” Oracle said.
“I think that virtual threads is just going to be huge, although the thing to note here is that it’s the kind of piece that not necessarily every developer will encounter directly because this sort of low-level, threading control tends to be the kind of thing that most people encounter via some piece of Java software that they’re using,” explained Saab.
Indeed, Saab described Virtual Threads as “foundational.” The feature is part of Oracle’s Project Loom.
Virtual Threads “provides a new basis for scalability for Java workloads going forward, that no longer requires people to start to embrace different programming models like reactive or asynchronous programming, but instead allows you to map thousands or tens of thousands of Java threads to a native thread, allowing you to write easy to understand, easy to debug, synchronous code that can be scaled up,” Saab told The New Stack.
Moreover, BellSoft’s Chuyko called Virtual Threads one of the most exciting features of Java 19 because its goal is to enhance how concurrency is handled in Java.
“The introduction of Virtual Threads as part of the Project Loom will dramatically improve the performance of high-throughput concurrent applications,” he said. “Traditional threads in Java programming are wrapped around operating system threads. As a result, they are easy to monitor or debug, but their number is strictly limited. On the other hand, asynchronous programming, which is sometimes used for application scaling, doesn’t allow for efficient thread monitoring.”
Meanwhile, “For me, the biggest news with Java 19 is the preview of Virtual Threads (JEP 425), which will make it far easier for Java developers to write more scalable software that demands thousands or millions of simultaneous connections. Pretty cool,” Shimmin said.
And A N M Bazlur Rahman, a Senior Software Engineer at Contrast Security, gave an excellent description of the value of virtual threads in a tweet thread, noting that: “Virtual threads are an alternative implementation of Java threads that store their stack frames in Java’s garbage-collected heap rather than in monolithic blocks of memory allocated by the OS. It starts out at only a few hundred bytes and expands and shrinks automatically.”
JavaOne 2022, a Million Certs
Overall, Java 19 delivers thousands of performance, stability, and security improvements, including enhancements to the platform. Oracle will showcase Java 19 at JavaOne 2022, taking place Oct. 17-20 in Las Vegas, and via a keynote broadcast airing on dev.java/ at 9:00 a.m. PT on Tuesday, Sept. 20.
Oracle also announced that it has achieved one million certifications for Java professionals and will highlight this at JavaOne. “There’s a robust pool of very functional developers out there that understand that having that certification is important to differentiate themselves. And it’s something that we are going to be celebrating,” Sharat Chander, Director of Java SE Product Management at Oracle, told The New Stack.
“Our ongoing collaboration with the developer community is the lifeblood of Java. As the steward of Java, Oracle is steadfastly committed to providing developers and enterprises with the latest tools to help them create innovative apps and services,” Saab said in a statement.
Loads of Features
In addition to Virtual Threads, other key features of Java 19 include language improvements from OpenJDK Project Amber (Record Patterns and Pattern Matching for Switch), as well as library enhancements to interoperate with non-Java Code (Foreign Function and Memory API) and to leverage vector instructions (Vector API) from OpenJDK Project Panama.
Chander cited the features from Oracle’s Project Amber as productivity enhancers.
“At the end of the day, developers want to accelerate their productivity,” he said. “And we’re simplifying the Java language and syntax is core to what Project Amber brings forward. And so that’s just going to, in my opinion, make life easier for developers down the road, whether they’ve been using the language for many years, or just being introduced to Java.”
According to Oracle, aside from Virtual Threads, the most significant updates delivered in Java 19 are:
Updates and Improvements to the Language
- JEP 405: Record Patterns (Preview): Enables users to nest record patterns and type patterns to create a powerful, declarative, and composable form of data navigation and processing. This extends pattern matching to allow for more sophisticated and composable data queries.
- JEP 427: Pattern Matching for Switch (Third Preview): Enables pattern matching for switch expressions and statements by permitting an expression to be tested against a number of patterns. This allows users to express complex data-oriented queries concisely and safely.
Library Tools
- JEP 424: Foreign Function and Memory API (Preview): Enables Java programs to more easily interoperate with code and data outside of the Java runtime. By efficiently invoking foreign functions (i.e., code outside the Java Virtual Machine [JVM]), and by safely accessing foreign memory (i.e., memory not managed by the JVM), this API enables Java programs to call native libraries and process native data via a pure Java development model. This results in increased ease of use, performance, flexibility, and safety.
- JEP 426: Vector API (Fourth Incubator): Enables superior performance compared to equivalent scalar computations by expressing vector computations that reliably compile at runtime to vector instructions on supported CPU architectures.
Ports
- JEP 422: Linux/RISC-V Port: Sets the stage for easier Linux/RISC-V implementations by integrating this port into the JDK mainline repository.
Project Loom Preview/Incubator Features
- JEP 428: Structured Concurrency (Incubator): Streamlines error handling and cancellation, improves reliability, and enhances observability by simplifying multithreaded programming and treating multiple tasks running in different threads as a single unit of work.
“Java developers are increasingly seeking tools to help them efficiently build highly functional applications for deployment in the cloud, on-premises, and in hybrid environments,” said Arnal Dayaratna, research vice president of software development at IDC, in a statement. “The enhancements in Java 19 deliver on these requirements and illustrate how the Java ecosystem is well-positioned to meet the current and future needs of developers and enterprises.”