What is new in Java 15 ?
4 minute read


This is an alive post of what will become Java 15, and, as expected, this post will expand and change over time, until the development of Java 15 is frozen in 2020. I am planning to update this post when a new feature (JEP) is targeted for JDK 15, or when there is an important update on an already targeted JEP.

Last Update: 2020/05/15

If something is a preview feature, it is fully specified and implemented, but provided in a release to gather feedback, so it is not a permanent change yet. You need to use --enable-preview to use such features.


2020/05/16: JEP 339, 384 added. JDK EA Build 23 (2020/5/13).

2020/05/15: JEP 373, 374, 375 added. JDK EA Build 23 (2020/5/13).

2020/04/22: JEP 371, 372, 377, 378, 379 added. JDK 15 EA Build 19 (2020/4/15).

2020/02/02: Java 15 EA Build 8 (2020/1/29).

Java 15 Features

The list is taken from the OpenJDK JDK 15 project page.

JEP 339: Edwards-Curve Digital Signature Algorithm (EdDSA)

This JEP covers the implemententation of EdDSA algorithm (RFC 8032). This is not a replacement of ECDSA. It will be implemented as a platform-independent code but will have a similar performance with the same security strength ECDSA algorithm which is implemented natively.

JEP 371: Hidden Classes

This introduces “hidden classes”, which are invisible to JVM but can be loaded from their bytecode dynamically and then they can be used by their reference (through reflection etc.).

JEP 372: Remove the Nashorn JavaScript Engine

Deprecated for removal in Java 11, Nashorn JavaScript Engine and its API and the jjs tool is removed.

JEP 373: Reimplement the Legacy DatagramSocket API

Following the reimplementation of Socket and ServerSocket API’s with JEP 353 in Java 13, this JEP is going to replace the implementations of DatagramSocket and MulticastSocket APIs. However, they are not going to replace the existing implementations (in DatagramSocketImpl and platform specific concrete implementations) but introduce a new (NIO-based) concrete instance of DatagramSocket (DatagramSocketAdaptor and DatagramChannel). The new implementation will be default and the old implementation can be used by using jdk.net.usePlainDatagramSocketImpl property.

JEP 374: Disable and Deprecate Biased Locking

Because the benefits of Biased Locking is becoming less important with modern computers, it will be disabled by default and deprecated. It can be enabled by using -XX:+UseBiasedLocking.

JEP 375: Pattern Matching for instanceof (Second Preview)

Pattern matching for instance of was first a preview feature (JEP 305) in Java 14. This is the second preview. It does both a test (instanceof?), casting (of the object to mentioned class) and a local variable declaration like below:

$ jshell --enable-preview
|  Welcome to JShell -- Version 15-ea
|  For an introduction type: /help intro

jshell> var s = "metebalci.com"
s ==> "metebalci.com"

jshell> if (s instanceof String s) System.out.println("it is a string")
if (s instanceof String s) System.out.println("it is a string")it is a string

JEP 377: ZGC: A Scalable Low-Latency Garbage Collector

ZGC is an experimental feature since Java 11, now it becomes a product feature.

JEP 378: Text Blocks

The experiments with multi-line strings started with JEP 326 in Java 12 and continued on Java 13, then with JEP 368 in Java 14. The result is this final and permanent feature.

A text block is opened with """ and closed with """. So you can use " without escape. Text block can also contain line terminators, so it becomes a multi-line string.

Here is an example from JEP 378 page executed on Java 15 EA Build 19.

$ jshell
Apr 22, 2020 7:33:11 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
|  Welcome to JShell -- Version 15-ea
|  For an introduction type: /help intro

jshell> String html = """
                      <p>Hello, world</p>
html ==> "<html>\n    <body>\n        <p>Hello, world</p>\n    </body>\n</html>\n"

jshell> System.out.println(html);
        <p>Hello, world</p>

JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector

Shenandoah GC is an experimental feature since Java 12, now it becomes a product feature.

JEP 384: Records (Second Preview)

This is the second preview of Records which were launched as JEP 359 in Java 14 as a preview feature.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.