• The Arrival of Java 16
  • Original article by Sharat Chander
  • The Nuggets translation Project
  • Translator: Hoarfroster

2020 will be a memorable year for Java as we celebrate its 25th anniversary. After more than 20 years of innovation, Java has been:

  • Flexibility by maintaining platform independence by adapting to the changing technology landscape.
  • Reliability is ensured by maintaining backward compatibility.
  • By accelerating innovation without sacrificing safety.

Coupled with Java’s ability to continuously improve platform performance, stability, and security, it remains the world’s most popular programming language among developers. According to IDC’s latest report Java Turns 25, more than 9 million developers (69% of full-time developers worldwide) use Java — more than any other language.

Further demonstrating Java’s continued innovation path, Oracle is proud to announce the full Release of Java 16, the seventh feature Release in six months of intense development. The constant flow of expected changes makes it easier for developers to manage their adoption of innovative suggestions.

Java 16 is now available!

Oracle now officially offers Java 16 to all developers and enterprises. According to the Oracle CPU Critical Patch Update schedule, Oracle JDK 16 will receive at least two quarterly updates before we release Oracle JDK 17. Java 17 will be fully available by September 2021, but the build version is already available on the jdk.java.net website.

Oracle is again offering Java 16 as the Oracle OpenJDK release using the open source GPLv2 and CPE protocols, and for using the Oracle JDK release as an Oracle product or service, Or for those who want commercial support, commercial licenses are also available.

Java 16, Together

As with previous releases, we will continue to thank the many individuals and organizations in the OpenJDK community for their contributions to Java 16 — we built Java together!

JDK 16 fixed development rate

The overall rate of change in the JDK has remained roughly constant for years, but the speed at which production-ready products are delivered has increased dramatically under the intense six-month development pace.

Instead of releasing thousands of fixes and about a hundred JDK enhancement proposals (Jeps) every few years in large major releases, we chose to offer enhancements in smaller Feature releases with a more manageable and predictable six-month schedule. These changes range from important features to minor enhancements, to routine maintenance, bug fixes, and documentation improvements. We present each issue and change in the JDK buggy system as a single commit.

Of the 1,897 issues marked as resolved in Java 16, 1,397 were resolved by Oracle staff, while another 500 were resolved by individual developers and developers working for other organizations. A close examination of these issues and the collation of organizational data from the grantees results in the following organizational chart. The organization chart is made up of people who helped develop patches in Java 16:

Oracle acknowledges the outstanding contributions of developers working at organizations such as ARM, SAP, Red Hat and Tencent. We were also pleased to see contributions from smaller organizations such as Ampere Computing, Bellsoft, DataDog, Microdoc, and other Indies, who collectively accounted for 3% of fixes in Java 16.

We also thank the many experienced developers who reviewed the proposed changes, the early adopters who tried to adopt early access versions and reported problems, and the dedicated professionals who provided feedback on the OpenJDK mailing list.

The following people provided valuable feedback on build quality, logged high quality bugs or provided frequent updates:

  • Jaikiran Pai (Apache Ant)
  • Gary Gregory (Apache Commons)
  • Uwe Schindler (Apache Lucene)
  • Robert Scholte (Apache Maven)
  • Mark Thomas (Apache Tomcat)
  • Enrico Olivelli (Apache Zookeeper)
  • Rafale Winterhalter (Byte Buddy)
  • Peter Karich (Graph Hopper)
  • Evgeny Yavits (JaCoCo)
  • Marc Hoffman (JaCoCo)
  • Vincent Privat (JOSM)
  • Christain Stein (JUnit 5)
  • David Karnok (RxJava)

In addition, through the Quality Expansion Program, we would like to thank the following FOSS projects and individuals who provided excellent feedback for testing early access releases of Java 16 to help improve the quality of the release.

  • Apache Ant
  • Apache Derby (Rich Hillegas)
  • Apache Lucene
  • Apache Maven
  • Apache Tomcat
  • Apache Wicket (Martin Grigorov)
  • Apache ZooKeeper
  • Eclipse Collections (Nikhil Nanivadekar)
  • eo-yaml (Mihai Andronache)
  • FXGL (Almas Baimagambetov)
  • FXyz (Sean Phillips)
  • Java Katas (Chandra Guntur)
  • GraphHopper
  • Hibernate ORM
  • Hibernate Validator
  • Hibernate Search
  • Hibernate Reactive (Sanne Grinovero & Yoann Rodiere)
  • JobRunr (Ronald Dehuysser)
  • jOOQ (Lukas Eder)
  • MyBatis (Iwao Ave)
  • Micrometer (Tommy Ludwig)
  • RxJava
  • Sejda
  • PDFsam (Andrea Vacondio)

New features in Java 16

Along with thousands of performance, stability, and security updates, Java 16 provides users with a total of 17 major enhancements, changes (called JDK Enhancement Recommendations, or JEP), including three incubator modules and a preview feature.

We have introduced enhancements in the Incubator module, which is a way to deliver non-final apis and non-final tools to developers, allowing users to provide feedback that ultimately improves the quality of the Java platform.

Also, enhancements have been introduced, in the form of preview, language, or VM capabilities for the Java SE platform, that are fully identified, fully implemented, but not permanent. We provided these features in the JDK feature release to stimulate feedback from developers based on actual usage, which might affect them and make them permanent in future releases. This approach gives users the opportunity to provide feedback in a timely manner, and gives tool vendors the opportunity to support this functionality before a large number of Java developers use it in production.

The 17 Jeps that come with Java 16 fall into six different categories:

1. New language features

JEP 394The Pattern Matching instanceof

Pattern Matching was first introduced as a preview feature in Java 14, and again in Java 15. Pattern Matching enhances the Java programming language by Pattern Matching the Instanceof operator.

Pattern matching enables the general logic in a program (that is, conditionally extracting components from objects) to be expressed more concisely and safely.

JEP 395 Records

Record was also introduced as a preview feature in Java 14 and Java 15, providing a compact syntax for declaring classes. These classes are transparent holders of shallow immutable data, greatly reducing the level of detail in these classes and improving the readability and maintainability of code.

2. JVM improvements

JEP 376ZGC concurrent thread processing

JEP 376 moves ZGC thread stack processing from the safe point to the concurrent phase. Even on large heaps, we can achieve submillisecond pauses within GC safety points. In this and subsequent versions, eliminating the ultimate source of latency in the ZGC garbage collector will greatly improve application performance and efficiency.

JEP 387 Elastic Metaspace

This feature returns unused HotSpot VM class metadata (that is, Metaspace) memory to the operating system more quickly, thereby reducing the footprint of Metaspace. Applications with a lot of load and unload activities can take up a lot of unused space.

The new scheme allocates meta-space memory in smaller chunks, reducing classloader overhead and fragmentation. It improves elasticity by returning unused meta-space memory to the operating system, thereby improving application performance and reducing memory utilization.

3. New tools and libraries

JEP 380 Unix-Domain Socket Channels

Unix-domain Socket Channels have always been a feature of most Unix platforms, and we now implement this feature in Windows 10 and Windows Server 2019. This feature adds Unix domain (AF_UNIX) Socket support to sockets in the Java.nio.Channels package and to the server Socket API. It extends the inherited channel mechanism to support Unix domain Socket channels and server Socket channels. Unix domain sockets are used for interprocess communication (IPC) on the same host and are similar to TCP-IP sockets in most respects, except that they are addressed by file system pathnames instead of Internet Protocol (IP) addresses and port numbers. For local interprocess communication, Unix sockets are more secure and efficient than TCP-IP loopback connections.

JEP 392Packaging tools

This feature was originally introduced in Java 14 as an incubator module, allowing standalone Java applications to be packaged. It supports a native packaging format to provide a natural installation experience for the end user. These formats include MSI and EXE on Windows, PKG and DMG on macOS, and Deb and RPM on Linux. It also allows you to specify boot-time parameters at package time and can be called directly from the command line or programmatically through the ToolProvider API. Notice that the name of the jpackage module was changed from jdk.incubator. Jpackage to JDK.jpackage. This will improve the end user experience when installing applications and simplify deployment using the “app store” model.

4. Future validation of work

JEP 390Warnings for value-based classes

This feature specifies the original wrapper classes (java.lang.Integer, java.lang.Double, etc.) as value-based (similar to java.util.Optional and java.time.localDateTime), And add forRemoval to its constructor. They are not recommended since JDK 9 and prompt new warnings. It provides warnings about incorrect attempts to synchronize on instances of any value-based class in the Java platform.

Many popular open source projects have responded to Java 9’s obsolescence warnings by removing packaged constructor calls from their sources, and given the urgency of the “obsolescence deletion is not recommended” warnings, we can expect more to do so.

JEP 396The JDK internals are forcibly encapsulated by default

By default, this feature strongly encapsulates all JDK internal elements, except for key internal apis, such as Sun.misc.unsafe. By default, code that was successfully compiled using an earlier version to access the JDK’s internal APIS may no longer work. This change is intended to encourage developers to move from using internal elements to using standard apis so that they and their users can easily upgrade to future Java versions. For JDK 9, strong startup is enabled by the launcher option — illegal-access, while JDK 15 is the default setting. JDK 9-15 will be a warning, and JDK 16 will default to reject. We can still (for the time being) loosen the encapsulation of all packages using a single command-line option, which will only work in the future with a — Add-labour open for specific packages.

5. Incubators and preview functions

JEP 338Vector API (Incubator)

The incubator API provides an initial iteration of the API to express vector computations that reliably compile at run time to the best vector hardware instructions on the supported CPU architecture, thus achieving better performance than equivalent scalar computations. It allows the use of single instruction multiple data (SIMD) instructions available on most modern cpus. Although HotSpot supports automatic vectorization, the set of scaler operations that can be transformed is limited and vulnerable to code changes. The API will make it easy for developers to write portable high-performance vector algorithms in Java.

JEP 389External Link API (Incubator)

The incubator API provides statically typed, pure Java access to native code. This API will greatly simplify the tedious and error-prone process of binding to a local library. Java has supported native method calls through the Java Native Interface (JNI) since Java 1.1, but it is difficult and fragile to use. Java developers should be able (for the most part) to use only any native library that is useful for a particular task. It also provides support for exotic functionality without the need for any intermediate JNI glue code.

JEP 393External memory access API (3 incubators)

First introduced in Java 14 and Java 15 as an incubator API, this API enables Java programs to operate safely and efficiently on various external stores (for example, native store, PMEP, managed heap store, and so on). It also provides the basis for an external linker API.

JEP 397Sealed classes (2nd preview)

This preview feature limits which other classes or interfaces can extend or implement them. It allows the author of a class or interface to control the code responsible for implementing that code. Moreover, it provides a more declarative way to restrict the use of superclasses than access modifiers. And it supports the future direction of pattern matching through detailed analysis of patterns.

6. Increase OpenJDK developer productivity

The remaining changes are not directly visible to the Java developer (the person who writes the code and runs the application in Java), but only to the Java developer (the person who develops the OpenJDK).

JEP 347Enable C++ 14 language functionality (in JDK source code)

This allows the C++ 14 language features to be used in JDK C++ source code and provides specific guidance on what features can be used in HotSpot code. In JDK 15, the language functionality used by C++ code in the JDK is limited to the C++ 98/03 language standard. This feature requires updating the minimum acceptable version of the compiler for each platform.

JEP 357Migrate from Mercurial to Git

JEP 369The migration to making

These two Jeps migrate JDK 11 and later versions of the OpenJDK community’s source code repository from Mercurial (Hg) to Git and host them on GitHub. Migration involves updating tools (such as jCheck, Webrev, and defPath tools) to Git. Git reduces the size of the metadata to about a quarter of its original size, saving local disk space and reducing cloning time. Modern tools integrate better with Git than Mercurial. The OpenJDK Git repository is now located at github.com/openjdk

JEP 386 Alphine Linux Port

JEP 388 Windows / AArch64 Port

The focus of these Jeps is not on the migration itself that has been done, but on integrating them into the JDK mainline repository.

JEP 386 ports the JDK to Alpine Linux and other distributions X64 and AArch64 that use MUSL as their primary C library. In addition, JEP 388 ports the JDK to Windows AArch 64 (ARM64).

7. Tool support

Current tool support can help increase developer productivity. With Java 16, we will continue to welcome the efforts of leading IDE developers whose tool solutions provide developers with support for the current version of Java. Developers can expect Java 16 support through the following ides:

  • JetBrains IDEA
  • Eclipse Market

Java remains the number one programming language of choice for software programmers. As the on-time delivery of improvements to Java 16 demonstrates, the Java platform is well positioned for modern development and growth in the cloud through continued thoughtful planning and ecosystem engagement.

Stay tuned for news and updates by:

  • Visit inside.java (News and views from the Oracle Java team)
  • Listen to the Inside.java podcast, a show for Java developers, directly from Oracle’s Java developers. We’ll talk about the language, the JVM, OpenJDK, platform security, and innovative projects like Loom and Panama, among other things.
  • Join the OpenJDK mailing list (the place to learn about the progress of your favorite OpenJDK project).