JDK 17 – New Features in Java 17
Introduction
In this blog, we will see what are the new features in java 17. Java 17 is LTS release LTS stands for Long term support release. LTS is an Oracle Marketing concept which means that long term support, that means for this version of Java Oracle will support for longer duration.
JEP | What is JEP ? JDK Enhancement Proposal
JEP stands JDK Enhancement Proposal. JEP is a document that is proposing an enhancement to Java core technology. These proposals are typically for enhancements
New features in java 17

Let’s see what are the new features introduced in java 17.
Restore Always-Strict Floating-Point Semantics:
Always restore strict floating points Semantics this is feature actually makes floating point operations consistently strict. So the default floating point operations are strict and strictfp both of which generates the same result from floating point calculation on every platform so what happens is that before Java 1.2 strictfp behaviour was the default one but because of hardware and other changes the keyword strictfp was necessary.
Now to re-enables of this behaviour, so there is no need to use this keyword any more, that means now you just don’t need to add strictfp keyword because it is now by default. Refer JEP 306 for more info.
Pattern Matching for switch (Preview)
This is a preview feature for now. With the release of java 12 we have seen we can use switch expressions, which was a preview feature, and it became permanent in java 14. With java 14 we can use -> token and no need to provide the break statement. If we are using -> then we don’t need to provide a break statement as there is no fall-through.
Pattern matching switch statement this is a preview feature in Java 17. Preview features are by default disable, so we must explicitly need to enable them. We can provide patterns in switch which helps in an expression to be tested against a number of patterns, each with a specific actions. e.g.
static String formatter(Object o) {
String formatted = "unknown";
if (o instanceof Integer i) {
formatted = String.format("int %d", i);
} else if (o instanceof Long l) {
formatted = String.format("long %d", l);
} else if (o instanceof Double d) {
formatted = String.format("double %f", d);
} else if (o instanceof String s) {
formatted = String.format("String %s", s);
}
return formatted;
}
The above snippet shows the old way of checking the instance for a given object o. now we can do this:
static String formatterPatternSwitch(Object o) {
return switch (o) {
case Integer i -> String.format("int %d", i);
case Long l -> String.format("long %d", l);
case Double d -> String.format("double %f", d);
case String s -> String.format("String %s", s);
default -> o.toString();
};
}
Let’s see with another example, given below, scenario of shape class and its implementation
class Shape {}
class Rectangle extends Shape {}
class Triangle extends Shape { int calculateArea() { ... } }
static void testTriangle(Shape s) {
switch (s) {
case null:
break;
case Triangle t:
if (t.calculateArea() > 100) {
System.out.println("Large triangle");
break;
}
default:
System.out.println("A shape, possibly a small triangle");
}
}
This above code snippet can be written as :
static void testTriangle(Shape s) {
switch (s) {
case Triangle t && (t.calculateArea() > 100) ->
System.out.println("Large triangle");
case Triangle t ->
System.out.println("Small triangle");
default ->
System.out.println("Non-triangle");
}
}
When we use pattern and then && with any of the boolean expression, it’s called as Guarded Pattern. Triangle t && (t.calculateArea() > 100) -> System.out.println(“Large triangle”); Refer JEP 406 for more info.
New macOS Rendering Pipeline
Since Apple deprecated the internal OpenGL API (in macOS 10.14), which was used in Swing GUI, this JEP provides a Java 2D internal rendering pipeline for macOS. Apart from the internal engine, there were no changes to the current APIs because the new implementation makes use of the Apple Metal API.
Sealed Classes
In JDK 15 and 16 this sealed classes are available as a preview mode, and it’s a part of project Amber. This new feature of java 17 restricts which other classes or interfaces may extend or implement a sealed component.
e.g.
public abstract sealed class Water
permits Person, Animals, Trees {...}
Uses sealed modifier in the declaration and the permit clause to specify classes that are allowed to extend the sealed class.
The subclass must be final, sealed or non sealed.
Enhanced Pseudo-Random Number Generators
New Pseudo-Random Number Generator APIs and implementations (PRNG).
Therefore, it’s simpler to use various algorithms interchangeably, and it also provides superior support for programming that uses streams of data. Legacy random classes, such as java.util.Random, SplittableRandom and SecureRandom now extend the new RandomGenerator interface.
macOS/AArch64 Port
Apple has announced a long-term plan to transition their line of Mac computers from x64 to AArch64. This port helps the JDK to run on AArch64 macOS platform.
Remove RMI Activation
This Remote Method Invocation activation mechanism was deprecated for removal in java 15, and removed in 17. It removed java.rmi.activation
package from the Java SE API specification.
Remove the Experimental AOT and JIT Compiler
With Java 17 they remove the experimental Java–based ahead-of-time (AOT) and just-in-time (JIT) compiler. This compiler has seen little use since its introduction, and the effort required to maintain it is significant. Retain the experimental Java-level JVM compiler interface (JVMCI) so that developers can continue to use externally-built versions of the compiler for JIT compilation.
Deprecate the Security Manager for Removal
This feature is used for securing client side java code, and it is marked for removal as it’s not being relevant now.
Foreign Function and Memory API (Incubator)
This new Foreign Function and Memory API is introduced in Java 17, which will help java developers call/access code and functions outside of java runtime.
Performance — Provide performance that is comparable to, if not better than, existing APIs such as JNI and sun.misc.Unsafe
.
Provide ways to operate on different kinds of foreign memory (e.g., native memory, persistent memory, and managed heap memory) and, over time, to accommodate other platforms (e.g., 32-bit x86) and foreign functions written in languages other than C (e.g., C++, Fortran).
Vector API (Second Incubator)
Java 17 introduced an API to express vector computations that reliably compile at runtime to optimal vector instructions. It deals with SIMD (Single Instruction Multiple Data) type of operation. It makes use of specialized CPU hardware that enables the processing of such instructions as pipelines and supports vector instructions.
Context-Specific Deserialization Filters
It allows applications to configure context-specific and dynamic-selected deserialization filters.
Deprecate the Applet API for Removal
Many browsers have already removed their support for Java plugins. As the API became irrelevant, this version marked it for removal, even though it has been marked as deprecated since JDK 9.
FAQ on Java 17
What is the feature of Java 17?
Restore Always-Strict Floating-Point Semantics, Pattern Matching for switch (Preview), New macOS Rendering Pipeline, Sealed Classes, Enhanced Pseudo-Random Number Generators, macOS/AArch64 Port, Remove RMI Activation, Remove the Experimental AOT and JIT Compiler.
How much faster is Java 17?
Java 17 is 6.54% faster than Java 11 and 0.37% faster than Java 16 for ParallelGC. The Parallel Garbage Collector is 16.39% faster than the G1 Garbage Collector.
Does spring boot work with Java 17?
Yes, it works with Spring Boot.
Is JDK 17 same as Java 11?
Java 17 is an LTS (Long Term Support) version, just like Java 11. In addition to new features.
Can I use Java 17 with spring?
Spring Boot 3.0 is now generally available. The new release is based on Spring Framework 6.0, requires Java 17 as a minimum version.
Can I use Java 17 for free?
Oracle JDK 17 and later is available under the Oracle No-Fee Terms and Conditions Licence, which permits free use for all users.
How old is Java 17?
Java 17 Long term support (LTS), released in September 2021.
Is Java 17 long term?
Yes, Java SE 7, 8, 11 and 17 are LTS releases.
Does Spring 6 need Java 17?
Spring Framework 6 requires Java 17 and Jakarta EE 9 and is compatible with the recently released Jakarta EE 10
What’s new from Java 11 to Java 17?
We generate sealed classes in java 17. The feature of the security manager is removed in java 17.JIT compiler and experimental AOT are removed in java 17. Java 17 contains the feature of foreign functions. The feature of switch pattern matching is available in java 17. It will contain the rendering pipeline of macOS. Contains the feature of vector API.
Conclusion
In this blog, we have seen almost all the features of java 17. It is LTS Long term support release from oracle. It is a recommended learning and upgrade for developers to start using these features in the day-to-day code cycles.