After the first release candidate last month, Java 11 is now generally available. The GA version is the first release with long-term support (LTS). Some of the new features include nest-based access control, a new garbage collector, support for Unicode 11 and TLS 1.3.
Some of the new features in Java 11 include nest-based access control, dynamic class-file constants, a no-op garbage collector called Epsilon and more. Let’s look at these features in detail.
‘Nests’ are introduced as an access control context that aligns with the existing nested types in Java. Classes that are logically part of the same code but are compiled to distinct files can access private members with nests. It eliminates the need for compilers to insert bridge methods. Two members in a nest are described as ‘nestmates’. Nests do not apply to large scales of access control like modules.
The existing Java class-file format is extended to support a new constant-pool form called CONSTANT_Dynamic. Loading this new form will delegate its creation to a bootstrap method in the same way linking an invokedynamic call site delegates linkage to a bootstrap method. The aim is to reduce the cost and disruption of creating new forms of materializable class-file constants giving broader options to language designers and compiler implementors.
Epsilon is a new experimental garbage collector in Java 11 that handles memory allocation but does not actually reclaim any memory. It works by implementing linear allocation in a single contiguous chunk memory. The JVM will shut down when the available Java heap is exhausted.
Java 11 brings Unicode 11 support to existing platform APIs. The following Java classes are mainly supported with Unicode 10:
This upgrade includes Unicode 9 changes and adds a total of 16,018 characters and ten new scripts.
The flight recorder in Java 11 is a data collection framework for troubleshooting Java applications and the HotSpot JVM. It has a low overhead.
TLS 1.3 was recently standardized and is the latest version of the Transport Layer Security protocol. TLS 1.3 is not directly compatible with the previous versions. The goal here is not to support every feature of TLS 1.3.
Some of the features are also removed from Java 11. Applications depending on Java EE and COBRA modules need to explicitly call these modules. The Nashorn JavaScript Engine, Pack200 Tools and API have all been deprecated.
For a complete list of features and deprecations, visit the JDK website.
Oracle releases open source and commercial licenses for Java 11 and later
JEP 325: Revamped switch statements that can also be expressions proposed for Java 12
No more free Java SE 8 updates for commercial use after January 2019