JDK 13: The new features coming to Java 13

Due in late 2019, Java 13 is tentatively slated to gain raw string literals and a tool for packaging self-contained Java apps

While the OpenJDK reference webpage for Java Development Kit (JDK) 13 does not yet list any new features, a few proposals are said to be targeted for the release. These proposals cover packaging, unused heap memory, and application class-data sharing.

[ The new Java is coming! Discover the Jakarta EE enterprise Java roadmap. | The new Java versions are here! Learn everything you need to know about what’s new in Java JDK 11 and what’s new in Java EE 8. | Keep up with hot topics in programming with InfoWorld’s App Dev Report newsletter. ]

JDK 13 is due September 17, 2019, following rampdown and release candidate stages occurring in coming months. JDK Enhancement Proposals eyed for the release cover:

  • Development of a tool for packaging self-contained Java applications, called jpackage. The tool would be based on the JavaFX javapackagertool 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 javapackagertool was deleted from JDK 11 as part of the removal of JavaFX.
  • 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 scalable, 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 behavior 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 application 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.

Also expected in JDK 13

Two capabilities anticipated for JDK 13 have been cited previously by Mark Reinhold, chief architect of the Java platform group at Oracle:

  • 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 n Java by, for example, letting developersexpress 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 production-qiality 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 behavior.

[Get started with the new switch expressions in JDK 12! Learn how to use statements and expressions like ifif-elseswitchfor, and while to declare variables, make decisions, and iterate in Java 12.]

You can download the JDK 13 builds from the jdk.java.net website. The first JDK 13 beta builds are available for Linux, MacOS, and Windows.

This story, "JDK 13: The new features coming to Java 13" was originally published by InfoWorld.