JDK 22 Brings Modest Feature Additions, Yet Excels in Other Key Areas
The latest version of Java, JDK 22, was released last week with the same regularity that Java developers have come to expect. Though this is not a long-term support (LTS) release, it’s perfectly viable for production use and introduces a variety of new features that are worth noting.
Let’s take a closer look at what JDK 22 has to offer.
Java updates are driven by JDK Enhancement Proposals (JEPs), and JDK 22 includes 12 of these proposals. Coincidentally, this matches the average number of JEPs (12) introduced across the last 13 Java releases since the switch to the six-month release cadence. In that sense, you could call this an “average” release, yet the enhancements it brings are quite useful.
In terms of breakdown, JDK 22 brings four finalized features and eight preview features or incubator modules, showing a healthy balance of finalized improvements alongside experimental features that could become fully adopted in future releases.
One noteworthy Java language change comes with JEP 447: Statements Before super()
. This preview feature is designed to address a limitation in Java’s object-oriented nature. When subclassing in Java, developers are required to call the superclass constructor as the first statement in a constructor, a constraint that can sometimes make the code overly complex. With JEP 447, a controlled mechanism is introduced allowing developers to place certain statements before the call to super()
. However, there are restrictions to prevent references to this
or super
from being accessed before the object is fully initialized.
Another significant update comes with JEP 456: Unnamed Patterns and Variables. This feature, introduced as a preview in JDK 21, is now finalized in JDK 22. It simplifies code by allowing developers to use a single underscore _
for variables that will not be used. This eliminates unnecessary named variables, helping to declutter code and improve readability without changing the syntactic structure.
Despite being an “average” release in terms of the number of JEPs, JDK 22 continues to refine the Java platform by introducing features that improve both the language’s flexibility and the developer’s experience. These updates illustrate the ongoing evolution of Java and hint at future advancements that could make their way into long-term support versions