Java 16 - Overview

Java 16 is a major feature release and it has brought many JVM specific changes and language specific changes to JAVA. It followed the Java release cadence introduced Java 10 onwards and it was released on Mar 2021, just six months after Java 15 release.

Java 16 is a non-LTS release.

New Features

Following are the major new features which are introduced in Java 16.

  • JEP 338 - Vector API (Incubator) − New Vector APIs introduced allowing developers to perform the vector operations explicitly.

  • JEP 347 - Enable C++14 Language Features − C++ 14 features can be used in c++ source code with the JDK 16.

  • JEP 357, JEP 369 - Migrate from Mercurial to Git/GitHub − OpenJDK source code is moved from mercurial to Git/GitHub

  • JEP 376 - ZGC - Concurrent Thread-Stack Processing − Z Garbage Collector improved by moving its thread-stack processing from safepoints to concurrent phase.

  • JEP 380 - Unix-Domain Socket Channels − SocketChannel and ServerSocketChannel now supports Unix Domain sockets.

  • JEP 386 - Alpine Linux Port − Now JDK is available for Alpine Linux and other Linux distributions which use musl implementation.

  • JEP 387 - Elastic Metaspace − Metaspace memory management is improved by returning unused HotSpot class-metadata or metaspace memory to the operating system quickly, reduces the metaspace footprint, and simplify the metaspace code.

  • JEP 388 - Windows/AArch64 Port − Now JDK can run on AArch64, on ARM hardware server or ARM based laptops.

  • JEP 389 - Foreign Linker API (Incubator) − Java code can be called by C/C++ or vice versa using new API replacing the JNI.

  • JEP 390 - Warnings for Value-Based Classes − Warnings are raised in case of value-based classes are synchronised using synchronize.

  • JEP 392 - Packaging Tool − jpackage is now a standard instead of incubator feature.

  • JEP 393 - Foreign-Memory Access API (Third Incubator) − Minor enhancements to Foreign Memory Access API.

  • JEP 394 - Pattern Matching for instanceof − Pattern matching for instanceOf is now a standard feature.

  • JEP 395 - Records − records are now a standard feature.

  • JEP 396 - Strongly Encapsulate JDK Internals by Default − default mode of --illegal-access option is now deny. Earlier it was permit.

  • JEP 397 - Sealed Classes (Second Preview) − Minor enhancements to sealed classes.

Java 16 enhanced numerous APIs with new methods and options. We'll see these changes in next chapters.