What is new in Java 17 ?

March 21, 2021

Introduction

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

If something is implemented in an incubator module, it is not a permanent feature and it is released to get feedback from developers. API in such a module may change or completely removed (not released in any future JDK release). You need to use --add-modules to use incubator modules.

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.

Changes

  • 2021/11/20: JDK 17 is released on 2021/09/14.
  • 2021/07/12: JDK 17 is in Rampdown Phase One, so the feature set is frozen.
  • 2021/03/21: First post.

Java 17 Features

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

JEP 306: Restore Always-Strict Floating-Point Semantics

All floating-point operations by default will be like strictfp is used, so the results will be same on all platforms.

JEP 356: Enhanced Pseudo-Random Number Generators

This JEP will make it easy to use custom PRNG algorithms and provide a few concrete PRNG implementations.

It is difficult at the moment to have a custom PRNG implementation that can easily replace java.util.Random, because it is not an interface. This JEP will introduce a new interface called RandomGenerator, and also four specialized sub-interfaces.

This JEP will add six splittable (LXM family) and two other (Xoshiro256Plus and Xoroshiro128Plus) PRNG algorithm implementations.

JEP 382: New macOS Rendering Pipeline

This JEP will change Java 2D internal rendering pipeline from OpenGL to Apple Metal API. This is going to be an internal change with no visible change on any APIs.

JEP 391: macOS/AArch64 Port

This JEP aims to port JDK to run on AArch64 platforms on macOS (e.g. Apple M1 processors) natively without using the Rosetta 2 translator.

JEP 398: Deprecate the Applet API for Removal

Applet API is going to be removed so it is going to marked as deprecated.

JEP 403: Strongly Encapsulate JDK Internals

Other than some critical internal APIs (such as sun.misc.Unsafe) where there is no alternative, other internal classes will be encapsulated in a way it will not be possible to easily make them available to programs.

JEP 406: Pattern Matching for switch (Preview)

This is the first preview of Pattern Matching capability for switch.

JEP 407: Remove RMI Activation

Already deprecated in JDK 15, RMI Activation mechanism will be removed.

JEP 409: Sealed Classes

First previewed in JDK 15, Sealed Classes are finalized with no changes from JDK 16.

JEP 410: Remove the Experimental AOT and JIT Compiler

The experimental AOT and JIT compilers using Graal compiler is going to be removed.

JEP 411: Deprecate the Security Manager for Removal

Probably not used at all, Security Manager will be deprecated.

JEP 412: Foreign Function & Memory API (Incubator)

This is the continuation of the work started with JEP 370 and JEP 383 for Foreign Memory access, and JEP 389 Foreign Linker API. It provides a way to work on memory out of Java runtime (thus out of garbage collection) and provides an alternative to JNI.

JEP 414: Vector API (Second incubator)

This is the second iteration of Vector API introduced as JEP 338 in Java 16.

JEP 415: Context-Specific Deserialization Filters

This JEP improves the existing per-stream deserialization filters with a dynamic and context-sensitive filter selection mechanism.