DEV Community

Cover image for Java 21 - Java 17 = 42 JEPs view
Petr Filaretov
Petr Filaretov

Posted on

Java 21 - Java 17 = 42 JEPs view

Java 21 is in Rampdown Phase One since the beginning of June, which means the feature set is frozen. The target date for general availability is September 19, 2023. It will be the next LTS version after Java 17 released in September 2021.

Teams usually update Java from one LTS version to another, skipping non-LTS releases, and our team is no different here. And since the Java 21 feature set is frozen now, I was curious which features will be available in Java 21 since Java 17.

This means not only new features in Java 21 itself but also features delivered in Java 18, 19, and 20.

The diff between the latest and planned LTS versions.

The delta... Okay, what am I talking about? Here is the code:

javaVersions.stream()
        .filter(v -> v.version() > 17)
        .filter(v -> v.version() <= 21)
        .flatMap(v -> v.features().stream())
        .toList()
Enter fullscreen mode Exit fullscreen mode

So, here is the list of all JDK Enhancement Proposals (JEPs), which were targeted into Java 18-21 plus some related JEPs from Java 17 (42 JEPs total) grouped by the feature name and the feature state in Java 21.

Features in each table go in order of my personal preference as a developer, meaning the higher row indicates the higher chances I would use this feature in my daily work.

Production-ready features in Java 21

Feature Java 17 Java 18 Java 19 Java 20 Java 21
Sequenced Collections - - - - Production: JEP 431
Pattern Matching for switch Preview: JEP 406 2nd Preview: JEP 420 3rd Preview: JEP 427 4th Preview: JEP 433 Production: JEP 441
Record Patterns - - Preview: JEP 405 2nd Preview: JEP 432 Production: JEP 440
Virtual Threads - - Preview: JEP 425 2nd Preview: JEP 436 Production: JEP 444
Generational ZGC - - - - Production: JEP 439
UTF-8 by Default - Production: JEP 400 + + +
Code Snippets in Java API Documentation - Production: JEP 413 + + +
Simple Web Server - Production: JEP 408 + + +
Internet-Address Resolution SPI - Production: JEP 418 + + +
Prepare to Disallow the Dynamic Loading of Agents - - - - Production: JEP 451
Key Encapsulation Mechanism API - - - - Production: JEP 452
Deprecate Finalization for Removal - Production: JEP 421 + + +
Deprecate the Windows 32-bit x86 Port for Removal - - - - Production: JEP 449
Linux/RISC-V Port - - Production: JEP 422 + +
Reimplement Core Reflection with Method Handles - Production: JEP 416 + + +

Preview features in Java 21

Feature Java 17 Java 18 Java 19 Java 20 Java 21
String Templates - - - - Preview: JEP 430
Unnamed Patterns and Variables - - - - Preview: JEP 443
Unnamed Classes and Instance Main Methods - - - - Preview: JEP 445
Scoped Values - - - Incubator: JEP 429 Preview: JEP 446
Structured Concurrency - - Incubator: JEP 428 2nd Incubator: JEP 437 Preview: JEP 453
Foreign Function & Memory API Incubator: JEP 412 2nd Incubator: JEP 419 Preview: JEP 424 2nd Preview: JEP 434 3rd Preview: JEP 442

Incubator features in Java 21

Feature Java 17 Java 18 Java 19 Java 20 Java 21
Vector API 2nd Incubator: JEP 414 3rd Incubator: JEP 417 4th Incubator: JEP 426 5th Incubator: JEP 438 6th Incubator: JEP 448

Experimental features in Java 21

Feature Java 17 Java 18 Java 19 Java 20 Java 21
Generational Shenandoah - - - - Experimental: JEP 404

Note

There are also changes in JDK that have no specific JEPs, but they are not covered in this post.


Dream your code, code your dream.

Top comments (0)