Upgraded to the Shiny Java 17? Now What?

Wenqi Glantz
Javarevisited
Published in
6 min readNov 14, 2021

--

Photo by Wenqi at PA Grand Canyon

So your boss told you to upgrade your Spring Boot microservices to Java 17, you did it, all went well! From Java 8 to Java 17, a big jump! What changed? You wonder. What does this upgrade mean for us Java developers in our day to day programming life? Well, let’s take a closer look.

Released on September 15, 2021, Java 17 is the latest LTS (long-term support release) for the Java SE platform. From Java 8 to Java 17, there have been 194 JDK Enhancement Proposals (JEPs) introduced, each of which brings some improvement to the platform. Let’s pick a few to explore.

· Sealed Classes
· Switch Expressions
· Pattern Matching for Switch (Preview)
· Pattern Matching for instanceof
· Text Blocks
· Record Classes
· Meaningful NPE
· Introduction of var
· New String Methods
· Collection Factory Methods

Sealed Classes

Sealed classes or interfaces can restrict which classes or interfaces can extend or implement them. It’s done so by using the sealed modifier, example below:

public abstract sealed class Tree
permits Maple, Willow, Dogwood, Oak{ … }

--

--