What’s that smell? OpenJDK 15 lands with hidden classes, more garbage collection

What’s that smell? OpenJDK 15 lands with hidden classes, more garbage collection

Java developers with a taste for adventure can now get their hands on the latest open source implementation of the Java Platform Standard Edition, OpenJDK 15. The release includes new security and productivity functionalities and provides users with some preview features so they can kick the tires before finalisation.

One of these preliminary features are the so-called sealed classes, which allow class authors to restrict which other classes may extend or implement the class in question. The addition is meant to provide “a more declarative way than access modifiers to restrict the use of a superclass” and help with future pattern matching efforts.

Pattern matching is still a hot topic in Java circles, though the only effort visible in OpenJDK 15 is a new preview of pattern-matching for instanceof, which was first introduced in JDK 14. Other features included for feedback are reworked records classes, a kind of transparent carrier for immutable data fitted with data-driven methods such as equals, and an improved API to access foreign memory outside the Java heap.

Devs who like their features stable can take a look at the newly added Edwards-Curve Digital Signature Algorithm for cryptographic signatures, and hidden classes. The latter is a replacement of sorts for the sun.misc.Unsafe::defineAnonymousClass and aims to give framework creators a way of defining classes that cannot be linked against or discovered by other classes.

Meanwhile low-latency garbage collector ZGC got its final seal of approval and is now ready for production along with low-pause-time garbage collector Shenandoah, and multi-line string literal text blocks.

With the release of OpenJDK 15, the platform said goodbye to field java.management.rmi.RMIConnectorServer.CREDENTIAL_TYPES, and constructors java.lang.invoke.ConstantBootstraps.<init> and java.lang.reflect.Modifier.<init>. Other than that JavaScript engine Nashorn was removed and the java.rmi.activation package as well as biased locking were deprecated.

Java 15 will be supported until March 2021. Those who’d prefer jumping on a version that will be looked after for a longer time will have to wait until next year, since this is when long term support version 17 is planned to land. 

In the meantime, work on OpenJDK 16 is in full swing. After having moved the codebase to GitHub and switching to Git for version control, the team is now focusing on internal improvements and a couple of new features. These include a first version of an incubator module for expressing vector computations, and elastic metaspace to reduce HotSpot class-metadata’s notorious memory usage. The final result will supersede Java 15 in March 2021.

Java is a programming language which made its first public appearance in 1995. The project was started at Sun Microsystems, which was acquired by Oracle in 2010. 25 years in, Java has made itself at home in the top 5 of most popular programming languages in various analyst lists.

Despite being an open source project, Oracle still provides most of the OpenJDK contributions as director Java SE product management Sharat Chander points out in an announcement blog. Other committing organisations include Red Hat, SAP, Arm, and Amazon. OpenJDK 15 is also the first version that saw Microsoft adding to the codebase, which is at least noteworthy, given the company’s at times rocky, lawsuit-involving history with Java.