3 min Devops

Java gets more flexible than ever with launch of version 23

Java gets more flexible than ever with launch of version 23

Oracle recently released Java 23. This new release of the popular programming language brings twelve prominent improvements, although they appear mostly in preview. Performance and runtime have also been improved.

The introduction of Java 23 follows relatively shortly after the release of the prior version in March of this year.

However, most of the new features added in Java 23, such as the JDK Enhanchement Proposals (JEPs), are still in preview.

According to creator Oracle, this is a sign that the feedback process is working well. JEPs change a lot and often evolve a bit in the feedback process and then often come out better than if just something had been “thrown over the wall,” is Oracle’s comment.

New language features

New language features have been added in Java 23, among other things. These features stem from Project Amber. This project is an OpenJDK initiative to discover and encourage smaller productivity-oriented Java code features.

One feature added from this initiative in Java 23 in preview is primitive types in patterns, instanceof and switch(JEP 455). This removes restictions for primitive types when working with patterns matching, instanceof and switch. This helps Java to be more expressive, which in turn leads to more productivity.

Another preview feature is module import declarations(JEP 476) that allow developers to import all packages exported by a module without requiring the import code to be present in the module. This makes modular libraries more reusable, according to Oracle, and helps beginners use ban libraries from other vendors without having to learn the packet hierarchy to do so.

In the area of new language features, declared classes and instance main methods(JEP 477) and flexible constructor bodies(JEP 482) have now also been presented in preview.

Updates to libraries

Oracle has also added several updates for libraries in Java 23. Consider Class-File API, which is in a second round of previews, JEP 469 or a Vector API and a second preview of stream gatherers(JEP 473).

Further into this segment, other librray updates have also been added within the latest Java release. These are for structured currency, which allows developers to consolidate groups of tasks running in different threads(JEP 480) and scoped values(JEP 481) that allows sharing of immutable data within and between threads.

Other udates and changes

For performance and runtime, the most important update in the new Java version is that the Z Garbage Collector’s (ZGC) default mode is now in a generative mode. Non-generative mode is discontinued and will be removed in a future release.

Furthermore, Java 23 integrates the Grail JIT compiler into Oracle JDK. With this, Oracle JDK users will have access to features developed in GraalVM EE. This should give developers and administrators more options for optimizing and improving workload performance.

Last, but not least, as of Java 23, the JEP for String Templates is no longer present in the programming language. It has been removed and is being actively reworked based on feedback from the Java community.

Also read: Java 22 available: features for improved performance