Java Development Kit 22: What’s New in Java 22

Within JDK 22, there are 12 JEPs focusing on enhancements spanning garbage collection, memory API, reduction of code verbosity, and facilitating the launching of multiple source code files. Additionally, there are preview features introducing advancements in constructors, class-files, stream gatherers, and other areas

JDK 22 release is happening today, with 12 JEPs included.

JEP 423 adds Region Pinning for G1, allowing garbage collection during critical regions.

JEP 454 finalizes the Foreign Function and memory API, improving productivity, performance, and platform support.

JEP 456 adds Unnamed Variables & patterns, reducing code verbosity and improving code intent.

JEP 458 allows the Java launcher to compile and launch multiple source code files.

Preview JEPs include enhancements for constructors, class-files, stream gatherers, and more.

JEP 460 introduces the vector API, which remains in incubator status pending Valhalla features.

In JDK 22, there are four finalized feature JEPs. JEP 423 introduces support for Region Pinning for G1, ensuring that garbage collection need not be disabled during critical JNI regions. JEP 454 finalizes the Foreign Function and Memory API (FFMAPI), offering improvements over JNI in terms of productivity, performance, and platform support. JEP 456 introduces Unnamed Variables & Patterns, allowing unused variables to be replaced with underscores, thereby reducing code verbosity and improving code clarity. Finally, JEP 458, Launch Multi-File Source-Code Programs, enhances the Java launcher to compile and launch multiple source code files, building upon the previous JEP 330.

Furthermore, JDK 22 includes seven Preview JEPs. JEP 447 enables statements to be added before a call to super in constructors. JEP 457 provides a standard API for class-files, improving the upgrade experience between JDK versions. JEP 461 introduces stream gatherers, an intermediate operation for transforming elements within streams. JEP 463, Implicitly Declared Classes and Instance Main Methods, brings rule changes to implicit class declaration and main method selection. Additionally, String Templates, Structured Concurrency, and Scoped Values enter the second preview with JEPs 459, 462, and 464 respectively, featuring minor or no API changes.

Lastly, the only incubator feature in JDK 22 is JEP 460, the Vector API, now in its seventh iteration of incubator status. The Vector API will continue to be in incubator status until the release of Project Valhalla features.

That wraps up the JEPs in JDK 22.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *