JDK 13 · JSR 388

Java 13

JDK 13 is Java SE 13, JSR 388, generally available on 17 September 2019. Two language features are in preview: text blocks, for the first time, and switch expressions, again. Neither is a permanent part of the language yet.

How to read the status

Language

Text Blocks (Preview)

JEP 355 · Preview · Language

A text block is a multi-line string literal. In Java 13 it is a preview.

Second preview in Java 14 (JEP 368). Standard in Java 15 (JEP 378).

OpenJDK JEP 355 (leaves JavaMastery)

Related reading: Strings

Switch Expressions (Preview)

JEP 354 · Preview · Language

Switch expressions are previewed again, with changes from the Java 12 preview. They are still not standard.

First preview in Java 12 (JEP 325). Standard in Java 14 (JEP 361).

OpenJDK JEP 354 (leaves JavaMastery)

Related reading: Control flow

JVM / Runtime

Reimplement the Legacy Socket API

JEP 353 · Final · JVM / Runtime

The java.net socket implementation is replaced with a simpler one. The NioSocketImpl work continues later. Application source usually does not change.

OpenJDK JEP 353 (leaves JavaMastery)

Dynamic CDS Archives

JEP 350 · Final · JVM / Runtime

An application run can generate a class-data sharing archive, extending the default archive from Java 12.

OpenJDK JEP 350 (leaves JavaMastery)

ZGC: Uncommit Unused Memory

JEP 351 · Final · JVM / Runtime

ZGC can return unused heap memory to the operating system. ZGC is still experimental in this release.

ZGC became experimental in Java 11 (JEP 333) and a product feature in Java 15 (JEP 377).

OpenJDK JEP 351 (leaves JavaMastery)

Examples

  • versions5Java17Features.javaCumulative Java 12–17 example · Requires Java 17Final forms only: switch expressions from Java 14, text blocks from Java 15, records and instanceof patterns from Java 16, and sealed classes from Java 17. This is not a Java 12 preview program. Pattern matching for switch was still a preview in Java 17 and is not used.

Related reading

Historical notes

Text blocks in the Java 17 example are the final form from Java 15, not the Java 13 preview.

Sources. General availability, JSR 388, and the JEP list: OpenJDK JDK 13. OpenJDK JDK 13 (leaves JavaMastery)

All versions