JDK 16 is live!

March 16, 2021 | 2 minute read
Text Size 100%:

JDK 16 is live! Download it from the Java SE Downloads page. See the JDK 16 Release Notes for detailed information about this release. The following are some of the important additions and updates in Java SE 16 and JDK 16:

  • The Java programming language is enhanced with pattern matching for the instanceof operator. This feature allows common logic in a program, namely the conditional extraction of components from objects, to be expressed more concisely and safely.
  • Records, first previewed in Java SE 14, is a permanent feature in this release. The earlier restrictions have been relaxed whereby the inner classes can declare members that are either explicitly or implicitly static. This includes record class members, which are implicitly static.
  • By default, all internal elements of the JDK are strongly encapsulated, except for critical internal APIs such as sun.misc.Unsafe. You can choose the relaxed strong encapsulation that has been the default since JDK 9. See Illegal Reflective Access.
  • UNIX domain socket channels have been integrated into JDK 16. See Internet Protocol and UNIX Domain Sockets NIO Example.
  • The Z Garbage Collector processes the thread stacks concurrently. This allows all roots in the JVM to be processed by ZGC in a concurrent phase.
  • The jpackage tool, which was incubated in JDK 14, is now a permanent feature. The tool packages a Java application into a platform-specific package that includes the necessary dependencies.

The following are preview or incubator JDK 16 features:

  • Sealed classes, a preview feature from JDK 15, is re-previewed in this release. Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them. There has been several refinements in this release, including the introduction of character sequences sealed, non-sealed, and permits as contextual keywords.
  • An initial iteration of an incubator module, jdk.incubator.vector, is provided to express vector computations. It reliably compiles at runtime to optimal vector hardware instructions on supported CPU architectures and thus achieve superior performance to equivalent scalar computations.
  • The incubator module jdk.incubator.foreign introduces the Foreign Linker API, which offers statically-typed, pure-Java access to native code, and the Foreign-Memory Access API, which allows Java programs to safely and efficiently access foreign memory outside of the Java heap. These APIs will simplify the otherwise error-prone process of binding to a native library.

In addition, the following are security-related updates:

  • The class JarSigner and the tool jarsigner support the signing of a JAR file with an RSASSA-PSS or EdDSA key.
  • SUN, SunRsaSign, and SunEC providers support SHA-3-based signature algorithms, and the SunPKCS11 provider now supports SHA-3-related algorithms. See JDK Providers Documentation.

See Significant Changes in JDK 16 Release for more information.

Raymond Gallardo

Previous Post

Java Recognized as the Favorite Programming Language

Sharat Chander | 2 min read

Next Post

The Arrival of Java 16

Sharat Chander | 10 min read