Why does Java support 16 languages

Java 16 migrates to GitHub and supports Alpine Linux

With Java 16, the last release was released before the next version with long-term support announced for autumn 2021, as Mark Reinhold has now announced on the official mailing list. The last reference implementation before that was Java 15, which was released on September 15, 2020. The JDK 16 (Java Development Kit) has a number of new features: A total of 17 proposals with suggestions for changes were received.

The new version pushes the classes further and includes a second preview of the sealed classes, it offers ports for Alpine Linux and Windows under ARM64. C ++ 14 features are new on board, and concurrent thread stack processing is implemented. The change in version management is probably trend-setting: Java 16 has migrated from Mercurial to Git and also moved to the GitHub platform as the new host (JEP 357 and 369).

Single repository projects move to Git

The move includes all OpenJDK projects that are in a single repository. This also applies to all update releases from Java 11. The version control process and the tags should be retained. The associated tools jcheck, webrev and defpath are also moving to Git. The team behind JEP 357 (Java Enhancement Proposal) is said to have developed a tool with which Mercurial hashes can be translated into Git hashes (and vice versa).

OpenJDK projects that are split across multiple repositories (as is still the case with the updates to JDK 8) will remain with Mercurial for the time being, according to the announcement. As soon as these projects are consolidated into a single repository, they too are about to move (JEP 357). According to the initiators of the JEP, the reasons for the change are the available tool sets, the hosting options and the extent of the metadata to be hosted by the version control system.

Garbage Collection: Thread stack processing is now lazy

The developers have moved the thread stack processing of the Z Garbage Collector (ZGC) from the Safepoints to a concurrent phase. The processing of the stack is therefore considered to be lazy (demand-oriented), concurrent and incremental. The further thread-wise root processing has also been removed from the ZGC Safepoints, because a new mechanism allows HotSpot subsystems to carry out process processing as required (JEP 376).

New vector API

A new vector API should be able to express vector calculations that compile into suitable vector hardware instructions on supported CPU architectures at runtime. The performance should thereby approach that of equivalent scalar calculations. The API is considered to be agnostic with regard to the underlying architecture and is intended to enable runtime implementations on multiple CPU architectures. According to the project developers, the challenge was apparently to keep the API portable at the same time (some platform-specific expressions cannot be converted directly into portable code). In cases where the vector calculation cannot be fully expressed as a sequence of hardware instructions at runtime, the new vector API should cautiously graduate and still work.

Ports for Alpine Linux and for Windows with ARM64

Two ports are new: JDK 16 supports Alpine Linux and other Linux distributions such as OpenWrt, which use musl as the primary C library. A number of Linux distributions such as Arch Linux provide an optional musl package. Alpine Linux is widespread in the cloud, in microservices and in container environments because it requires little storage space (the base Docker image for Alpine Linux only takes 6 MB).

Tomcat, Jetty, Spring and other frameworks should be able to run natively in this environment, since Java is already preconfigured ready to use (out of the box). The memory requirement is also important for embedded systems, since there are hardware-related upper limits. JDK 16 has also been ported to Windows with the ARM64 architecture - according to JDK developers, this was necessary because of the great demand for the new ARM servers and consumer hardware with ARM64. The integration into the JDK repository should be completed with the release.

Careful modernization of the C ++ features in the JDK

According to the announcement, the activation of C ++ 14 features in the C ++ source code of the JDK also includes handouts on which of the features can be meaningfully used in the HotSpot code of the virtual machine (VM). Up to and including JDK 15, C ++ language features in the Development Kit were essentially limited to the outdated C ++ 98/03 standard. Careful modernization took place with the long-term version JDK 11, which at least allowed the use of more current C ++ standards. The innovation in JDK 16 remains limited to the C ++ code in HotSpot and is intended to support more contemporary compiler versions, among other things.

Classes and Interfaces

Further changes affect the Java classes: Primitive wrapper classes are now considered value-based, their constructors are marked as deprecated and intended for removal, which will probably trigger new deprecation warnings. The design and implementation of primitive classes in Java is now considered mature enough that some classes of the Java platform may migrate to the primitive classes in future releases. The value-based classes in the API specifications are considered candidates for such a migration. The Valhalla project is running the renovations with the aim of reworking the Java programming model by adding primitive classes.

Sealed classes and interfaces had already determined which other classes and interfaces they could extend or implement. This is apparently intended to give the creators of the code a certain amount of control over the way in which their APIs are used in succession. After the first preview in JDK 15, the feature is included in JDK 16 as a second preview.

Further changes and further information

A number of other changes have found their way into the new JDK, for example the strong encapsulation of JDK internals as a basic setting (except for critical internal APIs), the Foreign Linker API for statically typed access to Java code and elastic Metaspace capabilities for output unused metadata from HotSpot VM classes.

A more complete listing of the proposals and innovations can be found in the JDK-16 instance at OpenJDP. Builds for Linux, Windows and Mac are available from the jdk Javanet website. At the moment, the latest JDK with long-term support is JDK 11, which came onto the market in September 2018. JDK 17 with long-term support has been announced for autumn: It should include all features and innovations from JDK 11 to 16.

See also: