Richard Groß

IT Archaeologist

Home

Java Version History (up to JDK 23)

An ongoing list of Java features per release

Ever since Java switched to its six-month release cadence (Time-Based Release Versioning) it has become a bit harder to keep up with the features they have implemented. The following list tracks the stable (not incubating or in preview) feature changes I deemed most noteworthy. The releases that Oracle will provide Long-Term Support (LTS) for are marked as such, based on the plan that Oracle publishes. This list does not cover all api changes and only seldom things outside of JEPs. Check the Java Almanac to see api updates of the JDK. Use a current JDK to get all performance improvements that happen constantly.

The list is ongoing and will be updated with every new Java release. A ➕ marks an added feature, a ⚠ marks a deprecation that will likely lead to a ❌ breaking change when the feature is removed.

The full Java version history can be found via Open JDK, at Wikipedia or via the Java releases page. Another website that tracks java features but also gives upgrading advice is whichjdk.com.

The long term

It is rather impossible to say when we’ll get cool new features. The JDK developers are known for "getting it right" over "getting it fast".

For example raw string literals was developed, then dropped in 2018 and we got Text Blocks in 2019 instead but still no string interpolation. String interpolation was ignored in favor of the safer alternative, String templates (Preview) in 2023, but that went back to the drawing board in 2024 after one year of previews due to design concerns.

It is however rather known where the road is heading. At some point in the future we’ll get:

23

released

September 2024

Markdown Documentation Comments

Write markdown in Javadoc. Prefix every line with /// and then write markdown.

Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal

Most of its methods — 79 out of 87 — are for accessing memory. All these methods are used by performance-sensitive libraries and no longer needed since Foreign Function & Memory API (JDK 22) and Variable Handles (JDK 9), which is why the methods are now deprecated.

ZGC: Generational Mode by Default

Which was introduced in JDK 22.

22

released

March 2024

Foreign Function & Memory API

It provides native code access without the brittleness and danger of JNI. Previews in 19, 20 and 21.

Unnamed Variables & Patterns

Allows you to write _ when you don’t need a variable. Underscore as a variable name has been a warning since 8 and an error since 9.

catch (Exception _){ }
// or
switch(ball){
    case RedBall _ -> /* do sth*/
}
Launch Multi-File Source-Code Programs

Launch class that contains a main(). Referenced classes will also be compiled. Simply use java MyProg.java and all will be well.

Generational ZGC

Fixes most of the ZGC (JDK 15) throughput drawbacks and requires 75% less memory.


21 LTS

LTS until

September 2028

released

September 2023

TIP

This is an amazing LTS release. We get virtual threads and we are very close at making Data Oriented Programming in Java a reality with record patterns and pattern matching for switch

Record patterns
if (r instanceof Rectangle(ColoredPoint(Point(var x, var y)))){
    // if all types match you can now use x and y
}
switch (obj) {
    case Integer i -> // if obj is an Integer, you can now refer to it as i
}
// or
switch (str) {
        case null -> { }
        case "y", "Y" -> {
            System.out.println("You said yes");
        }
        case String s
        when s.equalsIgnoreCase("YES") -> {
            System.out.println("You said yes");
        }
        case String s -> {
            System.out.println("You said no");
        }
    }
list.addLast(...);
map.putFirst(...);
set.reversed();
// etc.
Virtual Threads (formerly Fibers)

Improving scalability of IO-bound operations with virtual threads that you can create 10.000 of without penalty.

Deprecate the Windows 32-bit x86 Port
Warning if Agents are dynamically loaded
Key Encapsulation Mechanism API

Introduces an API for key encapsulation mechanisms (KEMs), an encryption technique for securing symmetric keys using public key cryptography.

20

released

March 2023

INFO

Another huge release feature-wise but all features are either in preview or incubating.

19

released

September 2022

INFO

Another huge release feature-wise but all features are either in preview or incubating.

18

released

March 2022

UTF-8 by Default

Specify UTF-8 as the default charset of the standard Java APIs

Simple Web Server

Command-line tool to start a minimal web server that serves static files only.

Reimplement Core Reflection with Method Handles

Reimplements java.lang.reflect.Method, Constructor, and Field on top of java.lang.invoke method handles. Before up to three different internal mechanisms for reflective operations were used.


17 LTS

LTS until

September 2026

released

September 2021

New macOS Rendering Pipeline

Create a new Swing Renderer based on Metal Api before Apple removes OpenGL Api.

macOS/AArch64 Port

Port for Apple Silicon

Strongly Encapsulate JDK Internals by Default

JDK internals can no longer be opened via command-line option (except sun.misc.Unsafe for which this is still possible).

Remove RMI Activation

Only RMI Activation is removed after deprecation in JDK 15.

Sealed Classes and interfaces

Enums on steroids. Create a class or interface for which you know all allowed subtypes. Combines great with instanceof (JDK 17 or switch JDK 21 pattern matching.

abstract sealed class Shape permits Circle, Rectangle /*... */ {
}

16

released

March 2021

// the old way
if (obj instanceof String) {
    String s = (String) obj;    // grr...
}
// the new pattern-matching way
if (obj instanceof String s) {
    // Let pattern matching do the work!
}

Records Records are immutable carriers of data. Automatically implements data-driven methods such as equals and accessors.

record Point(int x, int y) { }
➕ Stream toList Shortcut
stream.toList();
// careful, the returned List is unmodifiable

15

released

September 2020

Remove Nashorn JavaScript Engine

Deprecated since JDK 11.

Text Blocks

(multi-line string literals)

String html = """
              <html>
                  <body>
                      <p>Hello, world</p>
                  </body>
              </html>
              """;
ZGC: A Scalable Low-Latency Garbage Collector

Cost of near-pauseless operation is a ~2% throughput reduction, and it uses more memory. G1 remains default garbage collector though.

14

released

March 2020

JFR Event Streaming

Expose JDK Flight Recorder data for continuous monitoring.

Helpful Nullpointer exceptions

Thrown exceptions now pinpoint what caused the nullpointer, not just filename and line number.

Switch Expressions
return switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
    case TUESDAY                -> System.out.println(7);
    case THURSDAY, SATURDAY     -> System.out.println(8);
    case WEDNESDAY              -> System.out.println(9);
}

13

released

September 2019

INFO

Smaller Release

12

released March 2019

INFO

Smaller Release


11 LTS

LTS until

September 2023

released

September 2018

Http Client
Launch Single-File Source-Code Programs

Enhance the java launcher to run a program supplied as a single file of Java source code, including usage from within a script by means of "shebang" files and related techniques.

❌ JavaFx

JavaFx was never part of Java SE but Oracle bundled it with their JDKs since 8. Now they’ve unbundled it and passed the torch to the OpenJFX project

10

released

March 2018

// now possible
var num = 42;
var user = new User("John");
Recognizes constraints set by container control groups (cgroup)

Before Java didn’t recognize that it was running in a container and used the maximum available resources, not the one for the cgroup. Was also backported to JDK 8.

➕ Optional API Additions
optional.orElseThrow(); // clearer version of `optional.get()`
// Also allows us to specify the exception being thrown.

9

released

September 2017

Modularized JDK

Project Jigsaw

Module System

Create a module (a jar that only exposes a defined set of types, not all of them) by adding module-info.java at the root:

module my.module { // name the module
    requires transitive other.module.name; // what modules it requires

    exports my.module.myapi; // what api to expose
}
JShell

Read-Eval-Print Loop

G1 is the Default Garbage Collector

The premise is that limiting GC pause times is, in general, more important than maximizing throughput. The previous GC, Parallel GC, was throughput-oriented.

Encapsulate Most Internal APIs

Things such as sun.misc.Unsafe are not encapsulated for now.

Interfaces supporting Reactive Streams

For interoperability across a number of async systems running on JVMs.

➕ Private Methods in Interfaces

Can be called from default methods.

Convenience Factory Methods for Collections
Set.of(a, b, c);
List.of(a, b, c)
Map.ofEntries(entry(k1, v1), entry(k2, v2));
➕ Optional API Additions
optional.or(() -> Optional.of("default"));
optional.ifPresentOrElse(it -> doSth(it), ::otherwise);
optional.stream();

8 LTS

LTS until

March 2022

released

March 2014

Lambda-Expressions

Project Lambda

➕ Default Methods for Interfaces
Nashorn JavaScript Engine

Supersedes Rhino JavaScript Engine

Launch JavaFX Applications

Only added to Oracle JDK.

Date & Time API

New java.time, inspired by Joda-Time. Supersedes java.util.Date and java.util.Calendar.

Bulk Data Operations for Collections

Adds streams to java:

list.stream()
    .filter(it -> it > 0)
    .map(it -> "it")
    .collect(Collectors.toList());
Optional<T>
Optional.of(name);
Optional.ofNullable(name);

opt.orElse("john").ifPresent(name -> println(name));

6

released

2006

➕ Rhino JavaScript Engine
➕ Dramatic performance improvements

5

released

2004

➕ Generics
➕ Autoboxing
➕ Enumerations
➕ Varargs
for each
java.util.concurrent

ConcurrentHasMap etc.

1.4

released

2002

assert Keyword
java.util.regex
java.nio

Non-Blocking I/O

1.3

released

2000

➕ HotSpot JVM
➕ Last Release for Microsoft Windows 95 :)

1.2

released

1998

➕ Swing
➕ JIT-Compiler
➕ Collections-Framework
➕ Modify Objects via Reflection

1.1

released

1997

➕ +inner classes
➕ RMI
➕ Serialization
➕ Reflection

1

released

1996

INFO

Initial release