Return to site

Introduction to Java 15

Java 15 is the next on-time release (September 15,2020), it will bring 15 new features.

· mashup,java
New features:
  • JEP 339: Edwards-curve Digital Signature Algorithm (EdDSA)
  • JEP 371: Hidden classes
Added to the standard
  • JEP 378: Text Blocks
  • JEP 372: Z Garbage Collector (ZGC)
  • JEP 379: Shenandoah
  • JEP 373: Reimplement the legacy DatagramSocket API
Looking forward
  • JEP 360: Sealed classes (Preview)
  • JEP 375: Pattern matching of instanceof (Second preview)
  • JEP 384:Records (Second preview)
  • JEP 383: Foreign-memory access API (Second incubator)
Deprecations & removals
  • JEP 374: Deprecate biased locking
  • JEP 385: Deprecate RMI activation
  • JEP 372: Remove Nashorn
  • JEP 381: Remove Solaris and SPARC ports

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

Platform-independent implementation of EdDSA with better performance than the existing ECDSA implementation (which uses native C code) at the same security strength.

Aims to prevent side-channel attacks:
  • Timing is independent of secrets
  • Willnot branch on secrets
JEP 371: Hidden classes

Classes that cannot be used directly by the bytecode of other classes.

Intended for use by frameworks that generate classes at runtime and use them indirectly, via reflection.

Allows us to deprecate the non-standard API sun.misc.Unsafe::defineAnonymousClass, with the intent to deprecate it for removal in a future release.

JEP 378: Text Blocks (previewed in JDK 13 & 14)

A text block is a multi-line string literal that avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over the format when desired.

To allow finer control of the processing of newlines and white space, this second preview introduces two new escape sequences.


\ escape sequence

\<line-terminator> escape sequence explicitly suppresses the insertion of a newline character.

With \<line-terminator>

(Both represent the same long line, not multi-line)

\s escape sequence

\s escape sequence can prevent the stripping of trailing white space.

(Represents 3 lines of exactly 5 characters long each)

JEP 372: Z Garbage Collector (ZGC)

Change the Z garbage collector from an experimental feature into a product feature.

ZGC, is a concurrent, NUMA-aware, scalable low latency garbage collector, geared to delivering <10 ms GC pauses even on multi-terabytes heaps.

-XX:+UnlockExperimentalVMOptions option no longer needed.

The default GC remains G1.

JEP 379: Shenandoah

Change the Shenandoah Garbage Collector from an experimental feature into a product feature.

-XX:+UnlockExperimentalVMOptions option no longer needed.

The default GC remains G1.

JEP 373: Reimplement the legacy DatagramSocket API

Replace the underlying impplementations of the and APIs with simpler and more modern implementations that are easy to maintain and debug.

To reduce the risk of switching the implementation after more than twenty years, the legacy implementation will not be removed.

A JDK-specific system property,, is introduced to configure the JDK to use the legacy implementation.

JEP 360: Sealed classes (Preview)

Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them.

  • Allow the author of a class or interface to control which code is responsible for implementing it.
  • Provide a more declarative way than access modifiers to restrict the use of a superclass.
  • Support future directions in pattern matching by underpinning the exhaustive analysis of patterns.
Sealed class constraints
  • The sealed class and its permitted subclasses must belong to the same module, and , if declared in an unnamed module, the same package.
  • Every permitted subclass must directly extend the sealed class.
  • Every permitted subclass must choose a modifier to describe how it continues the sealing initiated by its superclass; final sealed, or non-sealed (a sealed class cannot prevent its permitted subclasses fom doing this.)
JEP 375: Pattern matching of instanceof (Second preview)

Enhance the Java programming language with pattern matching for the instanceof operator.

Pattern matching allows common logic in a program, namely the conditional extraction of components from objects, to be expressed more concisely and safely.

Three things going on here above:

  1. a test: is obj a String
  2. declaration of a new variable s
  3. casting of obj to String into variable s

With JEP 375, we get to:

Pattern matches handles conditionals as you would expect...

When using conditional or...

JEP 384:Records (Second preview)

Records provide a compact syntax for declaring classes which are transparent holders for shallowly immutable data.


Any of the members that are automatically derived from the state description can also be declared explicitly.

Local Records - Added in Second preview
JEP 383: Foreign-memory access API (Second incubator)

API to allow Java programs to safely and efficiently access foreign memory outside of the Java heap.

Aims to provide a valid alternative to the main avenues by which Java programs access foreign memory today, namely java.nio.ByteBuffer and sun.misc.Unsafe.

First major content from Project Panama, a project with the goal of improving connections between Java and non-Java APIs.

  • Disable and deprecate Biased locking (JEP 374)
  • RMI activation for removal (JEP 385)
  • Nashorn Java Script Engine (JEP 372) --Deprecated for removal since JDK 11--
  • Solaris and SPARC ports (JEP 381) --Deprecated for removal sinc JDK14--

Source code for these features remains available

All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!