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. Please note that other JDK distributions exist and they have their own plans. They follow the same tip and tail model though and only provide longer support for the same LTS versions as oracle. Take a look at the support roadmap of the most popular alternate distributions, Temurin and Corretto.
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:
-
Integrity by Default. Which means the removal of unsupported code like
sun.misc.unsafe
when adequate replacements have been developed. -
Derived Record creation (Preview), also called
record
withers, which make working with records so much nicer. -
Null-Restricted and Nullable Types, i.e. fields that can be marked as null-restricted
Name!
or nullableName?
. -
Value Classes and Objects (Preview) and Null-Restricted Value Class Types (Preview)
24
Expected |
March 2025 |
Stable JEPs |
14 |
Total JEPs |
24 |
- INFO
-
Preliminary, since JDK is in rampdown and not released yet.
- ⚠ Prepare to Restrict the Use of JNI
-
Issue warnings about uses of the Java Native Interface (JNI). People should instead use the Foreign Function & Memory API, which was introduced in JDK 22.
- ➕ Late Barrier Expansion for G1
-
Simplify the implementation of the G1 garbage collector’s barriers.
- ❌ Remove the Windows 32-bit x86 Port
-
Remove the source code and build support for the Windows 32-bit x86 port. The port was deprecated in JDK 21.
- ➕ Ahead-of-Time Class Loading & Linking
-
Improve startup time by making the classes of an application instantly available, in a loaded and linked state, when the HotSpot Java Virtual Machine starts.
- ➕ Class-File API
-
Provide a standard API for parsing, generating, and transforming Java class files. Will probably replace all instances of ASM library.
- ➕ Stream Gatherers
-
Enhance the Stream API to support custom intermediate operations. The result is the new
.gather
Method:
Stream.generate(() -> ThreadLocalRandom.current().nextInt())
.limit(1000)
.gather(selectOne(Math::max)) // the new interface
.findFirst();
for which we can write custom Gatherers or use the build-in ones: Gatherers.fold
, .mapConcurrent
, .scan
, .windowFixed
and .windowSliding
.
- ❌ Permanently Disable the Security Manager
-
The Security Manager has not been the primary means of securing client-side Java code for many years, it has rarely been used to secure server-side code, and it is costly to maintain. It was deprecated in JDK 17.
- ⚠ ZGC: Remove the Non-Generational Mode
-
Remove the non-generational mode of the Z Garbage Collector (ZGC). The mode was introduced in JDK 22 and made the default in JDK 23.
- ➕ Synchronize Virtual Threads without Pinning
-
Virtual threads that enter a
synchronized
block no longer pin, that is they used to block the carrier thread on which they were scheduled. - ➕ Linking Run-Time Images without JMODs
-
Reduce the size of the JDK by approximately 25% by enabling the
jlink
tool to create custom run-time images without using the JDK’s JMOD files. This feature must be enabled when the JDK is built; it will not be enabled by default, and some JDK vendors may choose not to enable it. The new JMOD format was introduced in JDK 9 and goes beyond JAR files to include native code, configuration files, and other kinds of data that do not fit naturally, if at all, into JAR files. - ➕ Quantum-Resistant Module-Lattice-Based Key Encapsulation Mechanism
-
Enhance the security of Java applications by providing an implementation of the quantum-resistant Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM). Builds on Key Encapsulation Mechanism API from JDK 21.
- ➕ Quantum-Resistant Module-Lattice-Based Digital Signature Algorithm
-
Enhance the security of Java applications by providing an implementation of the quantum-resistant Module-Lattice-Based Digital Signature Algorithm (ML-DSA). Builds on Key Encapsulation Mechanism API from JDK 21.
- ⚠ Warn upon Use of Memory-Access Methods in sun.misc.Unsafe
-
Issue a warning at run time on the first occasion that any memory-access method in sun.misc.Unsafe is invoked. All of these unsupported methods were terminally deprecated in JDK 23, because newer and better alternatives exist.
- ⚠ Deprecate the 32-bit x86 Port for Removal
-
Deprecate the 32-bit x86 port, with the intent to remove it in a future release. This specifically means the Linux 32-bit x86 port, because it is the only one remaining.
23
released |
September 2024 |
Stable JEPs |
3 |
Total JEPs |
12 |
- ➕ 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 |
Stable JEPs |
4 |
Total JEPs |
12 |
- ➕ 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 usejava 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 |
Sep 2028 (Oracle) |
released |
Sep 2023 |
Stable JEPs |
9 |
Total JEPs |
15 |
- 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 |
Stable JEPs |
0 |
Total JEPs |
7 |
- INFO
-
Another huge release feature-wise but all features are either in preview or incubating.
19
released |
September 2022 |
Stable JEPs |
1 |
Total JEPs |
7 |
- INFO
-
Another huge release feature-wise but all features are either in preview or incubating.
18
released |
March 2022 |
Stable JEPs |
6 |
Total JEPs |
9 |
- ⚠ 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 ofjava.lang.invoke
method handles. Before up to three different internal mechanisms for reflective operations were used.
17 LTS
LTS until |
Sep 2026 (Oracle) |
released |
Sep 2021 |
Stable JEPs |
11 |
Total JEPs |
14 |
- ➕ 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 |
Stable JEPs |
13 |
Total JEPs |
17 |
// 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 |
Stable JEPs |
10 |
Total JEPs |
14 |
- ❌ 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 |
Stable JEPs |
11 |
Total JEPs |
16 |
- ➕ 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 |
Stable JEPs |
3 |
Total JEPs |
5 |
- INFO
-
Smaller Release
12
released |
March 2019 |
Stable JEPs |
6 |
Total JEPs |
8 |
- INFO
-
Smaller Release
11 LTS
LTS until |
Sep 2023 (Oracle) |
released |
Sep 2018 |
Stable JEPs |
16 |
Total JEPs |
17 |
- ➕ 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 |
Stable JEPs |
12 |
Total JEPs |
12 |
// 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 |
Mar 2022 |
released |
Mar 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. Supersedesjava.util.Date
andjava.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