Java 13 is expected to be available later this year, and according to official development, Java 13 will include improvements for garbage collection and application class-data sharing.
We’re only a few months away from the planned release of JDK 13 (Java Development Kit 13), and we just received the official planned features for it. Although improvements such as re-implementation of the legacy socket API, garbage collector enhancements, and application class-data sharing were mentioned in the JDK Enhancement Proposals (JEPs), these have only now made official targets for JDK 13.
The official target release date for Java 13 (or JDK 13) is 17 September 2019. While beta versions are already available, release candidates are slated for public release around August.
Here are the official features proposed for Java 13 or JDK 13:
- Re-implementing the legacy socket API, which would involve replacing the underlying implementation used by the net.Socket and java.net.ServerSocket APIs with a simpler, more modern implementation that is easy to debug and maintain. The new implementation is intended to be easy for adaptation to work with user-mode threads, also known as fibers, which are being explored in Project Loom. The aforementioned legacy APIs date back to JDK 1.0 and comprise a mix of legacy C and Java code described as painful to debug and maintain. The legacy implementation also has other issues: a native data structure to support asynchronous close, causing reliability and porting issues, and concurrency issues requiring an overhaul.
- Enhancing the ZGC (Z Garbage Collector) to return unused memory to the operating system, a proposal cited as integrated into JDK 13. ZGC, which is billed as a scale-able, low-latency collector, currently does not return unused memory back to the OS even if the memory has not been used in a long time. This behaviour is not optimal for some applications and environments, especially those where memory footprint is a concern, such as containers or environments where an application might be idle for a long time and is sharing or competing for resources with other applications.
- Extending application class-data sharing (AppCDS) to enable dynamic archiving of classes at the end of application execution. Archived classes would include all loaded applications and library classes not present in the default, base-layer CDS archive. This proposal, which is in the targeted stage, is intended to improve the usability of AppCDS and eliminate the need for users to do trial runs to create a class list for each application.
Features expected in JDK 13 but not included in the official list of features:
- Development of a tool for packaging self-contained Java applications, called jpackage. The tool would be based on the JavaFX javapackager tool that supports native packaging formats to give the user a natural installation experience. It allows launch-time parameters to be specified at packaging time. The tool can be invoked directly from the command line or programmatically via the ToolProvider. Many applications need to be installed on a native platform in a “first-class” way rather than being placed on the class path or module path. A packaging tool also can fill gaps left by technologies such as Java Web Start, which was removed from Oracle’s JDK 11. The javapackager tool was deleted from JDK 11 as part of the removal of JavaFX.
- Raw string literals, which can span multiple lines of source code and do not interpret escape sequences. This capability had been cut from JDK 12, which arrived in March 2019. The plan is to offer raw string literals only as an opt-in beta in JDK 13. Its goal is to make development easier in Java by, for example, letting developers express sequences of characters in a readable form free of Java indicators, or supply strings targeted for grammars other than Java. Following the expected test run in JDK 13, raw string literals could be made with production-quality in the subsequent JDK 14 release.
- A production version of switch expressions, for which JDK will offer a beta implementation. The switch statement will be extended for use as either a statement or an expression, so both could use either a “traditional” or “simplified” scoping and control flow behaviour.
JDK 13 beta builds are currently available for Linux, MacOS, and Windows and you can download the different JDK 13 beta builds from the jdk.java.net website here.