6 min

As of today, JDK 20 is available for use. 6 JEPs get the necessary updates in JDK 20. We were able to get a sneak peek before the launch via a briefing with Oracle and briefly list them in this article.

For about five years now (since the launch of JDK 10), organizations and developers using Java as a programming language have known where they stand when it comes to new releases. Every year there is an update in March and in September. Since we are now in March, it is therefore time for the latest Java offspring, JDK 20. As usual, there have been updates. Oracle itself talks about thousands of updates in terms of stability and performance. In the end, it is mainly the updates to some JEPs (JDK Enhancement Proposals) that stand out the most.

Before going into some projects (JEPs) within the Java community, it is good to briefly outline the state of this programming language. In any case, Java is still one of the most popular programming languages. Of course, it depends a bit on how you measure and look at it – and especially who reports on it – but Java is at least among the most popular languages. Oracle itself states (obviously) that it is No. 1, but makes sure to put a hard-to-quantify qualification behind it. For example, it is the No. 1 language for current technology trends and No. 1 in ‘overall development organizational use’. It’s not entirely clear to us what they mean by that.

What is clear are the numbers of JVMs (Java Virtual Machines) Oracle claims for Java. 60 billion active JVMs and 38 billion cloud-based JVMs. In other words, the majority of JVMs are running in the cloud.

Release every six months, LTS versions closer together

We cited it, Java has been getting a new release every six months for about five years. This offers several advantages. First, this cycle makes it easier to get a new release up and running. The number of (major) changes is significantly lower than when there is a much longer time between releases.

In addition, it is possible to try out more things. Preview features are a good example of this. These are features that are in principle ready for production, but of which one wants to know whether they do what they are supposed to do for developers. These can work with them in combination with different use cases and provide feedback on them. These kinds of features are obviously not enabled by default. Another advantage of the shorter update cycle is that it is now possible to deliver features in parts. It is then also possible to change course along the way, should that better suit current events and developers’ needs.

Below you can see what such an incremental approach looks like for Project Amber, one of the JEPs within Java.

The initial plan was to release a release of Java every three years with Long-Term Support, or LTS. There are currently three versions with LTS on the market: 8, 11 and 17. The next version with LTS is version 21. That will be released later this year in September. The period between versions with LTS has shortened, by the way. Whereas initially it was three years, as of JDK 17 it is two years.

JEPs in the spotlight in JDK 20

Above, you already saw something about Project Amber in the feature rollout picture. That is one of the JEPs for which new features are available or have been moved to another phase. In addition to Amber, Oracle is placing particular emphasis on Project Loom and Project Panama. During the briefing, the names of Project Leyden, Project Valhalla and Project ZGC are also mentioned. These are all projects on which multiple parties (within OpenJDK) are working.

In general, Project Amber is about making Java easier to use and thus more accessible. Project Leyden focuses on improving performance, particularly in terms of the time it takes from startup/warming up to peak performance. Project Loom aims to make Java more scalable, by fundamentally changing the mapping between Java threads and platform threads. This is possible through virtual threads. This makes it possible to link tens of thousands of Java threads with a single platform thread. This should provide a solid boost in scalability. According to the Oracle spokesperson who gave the briefing, this is a very popular feature within the community.

Of the remaining three, Project Panama, Project Valhalla and Project ZGC, especially the second in this list stands out as far as we are concerned. Valhalla is quite an ambitious project, being quite fundamental. It aims to reshape the way Java handles memory and how data is seen in memory. Project Panama is, among other things, about how Java interacts with other programming languages. Finally, Project ZGC focuses on garbage collection with very low latency specifically for apps that use a lot of memory.

We are not going to cover all the specific updates to the JEPs further here. Below we have listed what Oracle believes to be the most important updates to Java 20. Of the JEPs, it highlights Project Loom and Project Panama in particular.

Language Updates and Improvements

  • JEP 432: Record Patterns (Second Preview): Enhances the Java language by allowingusers to nest record patterns and type patterns to create a powerful, declarative, and composable form of data navigation and processing. This helps increase developer productivity by enabling them to extend pattern matching to allow for more sophisticated and composable data queries.
  • JEP 433: Pattern Matching for Switch (Fourth Preview): By extending pattern matching to switch, an expression can be tested against a number of patterns – each with a specific action – so that complex data-oriented queries can be expressed concisely and safely. Expanding the expressiveness and applicability of switch expressions and statements helps increase developer productivity.

Project Loom Preview/Incubator Features

  • JEP 429: Scoped Values (Incubator): Enables the sharing of immutable data within and across threads, which are preferred to thread-local variables – especially when using large numbers of virtual threads. This increases ease-of-use, comprehensibility, robustness, and performance.
  • JEP 436: Virtual Threads (Second Preview): Significantly streamline the process of writing, maintaining, and observing high-throughput, concurrent applications by introducing lightweight virtual threads to the Java Platform. By enabling developers to easily troubleshoot, debug, and profile concurrent applications with existing JDK tools and techniques, virtual threads helps accelerate application development.
  • JEP 437: Structured Concurrency (Second Incubator): Simplifies multithreaded programming by treating multiple tasks running in different threads as a single unit of work. This helps development teams streamline error handling and cancellation, improve reliability, and enhance observability.

Project Panama Preview Features

  • JEP 434: Foreign Function & Memory API (Second Preview): Enables Java programs to 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 feature enables Java programs to call native libraries and process native data without requiring the Java Native Interface. This increases ease-of-use, performance, and safety.
  • JEP 438: Vector API (Fifth Incubator): Expresses vector computations that reliably compile at runtime to vector instructions on supported CPU architectures. This increases performance compared to equivalent scalar computations.

New licensing structure

Finally, the briefing also discussed the new license structure. We wrote a news story about that earlier this year. So this is not news specific to JDK 20, but still important for organizations that purchase the use of Java SE from Oracle. Oracle has figured out that a fixed price per employee works better than the previous system. In that calculation model, you had to count things like processors and NUPS (or Named Users). That was a tedious job for many organizations, according to Oracle. Hence the move to a simpler compute model.

What the new calculation model means for organizations in terms of costs remains to be seen. Chances are that costs will go up. Whether those higher costs outweigh the promised improvement in ease of use remains to be seen. For now, it is possible to continue working according to the old method. An Oracle spokesperson stated this during the briefing. Organizations that have this well organized do not (yet) have to switch to the new model.