|Java 11 Adds Nestmates|
|Written by Kay Ewbank|
|Monday, 01 October 2018|
Java 11 has been released with nest-based access controls, dynamic class-file constants, and a new garbage collector.
JDK 11 is the open-source reference implementation of version 11 of the Java SE 11 Platform. Production-ready binaries under the GPL are available from Oracle; binaries from other vendors will follow shortly.
This version is the first of the long-term support (LTS) releases that Oracle announced last September. From Java SE 9 onwards, Oracle has provided Oracle JDK for free under the BCL, but has also provided builds of OpenJDK under an open source license similar to that of Linux. The plan is to make the Oracle JDK and OpenJDK builds from Oracle interchangeable and is aiming them at developers and organizations who do not want commercial support or enterprise management tools. From this version onwards, the Oracle JDK royalty-free version is limited to use for development, testing, prototyping or demonstrating purposes.
This is an important aspect to bear in mind because it means it's important you download the OpenJDK build of Java 11, otherwise Oracle will require you to pay for a license if you're using its Oracle JDK for commercial purposes.
The main improvements to Java 11 start with the addition of nestmates - nest-based access controls. These are designed to fit alongside the existing notion of nested types in Java. Nests allow classes that are logically part of the same code entity, but which are compiled to distinct class files, to access each other's private members without the need for compilers to insert accessibility-broadening bridge methods
Dynamic class-file constants have also been added. These extend the Java class-file format, and loading a dynamic class-file constant will delegate creation to a bootstrap method. They have been introduced to reduce the cost and disruption of creating new forms of materializable class-file constants so that language designers and compiler implementors can be more creative when adding features.
Another improvement to the new version is the addition of not one but two new garbage collectors, both still at the experimental stage Epsilon is designed to handle memory allocation but does not implement any actual memory reclamation mechanism. Its aim is to provide a completely passive GC implementation with a bounded allocation limit and the lowest latency overhead possible, at the expense of memory footprint and memory throughput.
The second new garbage collector, ZGC, is a scalable low-latency garbage collector that aims to keep GC pause times under 10ms, and to handle heaps ranging from relatively small (a few hundreds of megabytes) to very large (many terabytes) in size. It also aims to have a less than 15% application throughput reduction compared to using G1.
Other improvements include an open source version of the Flight Recorder that until now was part of the commercial distribution. It is a data collection framework for troubleshooting Java applications and the HotSpot JVM. There's also a new standard HTTP library that standardizes the incubated HTTP Client API introduced in JDK 9.
or email your comment to: firstname.lastname@example.org