close
Java Cup
Inside Java

News and views from members of the Java team at Oracle

The Arrival of Java 22!

Follow Java and OpenJDK on X.

JDK 22 is Now Available!

Oracle is proud to announce the general availability of JDK 22 for developers, enterprises, and end-users.

New with Java 22

JDK 22 delivers 12 enhancements that are significant enough to warrant their own JDK Enhancement Proposals (JEPs), including seven preview features and one incubator feature. They cover improvements to the Java Language, its APIs, its performance, and the tools included in the JDK.

Language Improvements

Unnamed Variables & Patterns - JEP 456

Improves readability when variable declarations or nested patterns are required but not used. Both are denoted by the underscore character.

Value:

Language Previews

Statements before super (…) [Preview] - JEP 447

In constructors, allow for statements that do not reference the instance being created to appear before an explicit constructor invocation.

Value:

String Templates (2nd Preview) - JEP 459

String templates complement Java's existing string literals and text blocks by coupling literal text with embedded expressions and template processors to produce specialized results.

Value:

Implicitly Declared Classes and Instance Main Methods (2nd Preview) - JEP 463

Students can write their first Java programs without needing to understand language features designed for large programs. Instead of using a separate dialect of the language, students can write streamlined declarations for single-class programs and then seamlessly expand their programs to use more advanced features as their skills grow.

Value:

To accelerate learning of Java -

Libraries

Foreign Function & Memory API - JEP 454

Allows Java programs to interoperate with code and data outside of the Java runtime. By efficiently invoking foreign functions (i.e., code outside the JVM), and by safely accessing foreign memory (i.e., memory not managed by the JVM), the API enables Java programs to call native libraries and process native data without the brittleness and danger of JNI.

Value:

Libraries Previews and Incubator

Class-File API (Preview) - JEP 457

Provides a standard API for parsing, generating, and transforming Java class files.

Value:

Stream Gatherers (Preview) - JEP 461

Enhances the Stream API to support custom intermediate operations. This will allow stream pipelines to transform data in ways that are not easily achievable with the existing built-in intermediate operations.

Value:

Structured Concurrency (2nd Preview) - JEP 462

Simplifies concurrent programming. Structured concurrency treats groups of related tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.

Value:

Scoped Values (2nd Preview) - JEP 464

Enables efficient sharing of immutable data within and across threads.

Value:

Vector API (7th Incubator) - JEP 460

An API to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPU architectures, thus achieving performance superior to equivalent scalar computations. This JEP proposes to re-incubate the API in JDK 22, with minor enhancements in the API relative to JDK 21. The implementation includes bug fixes and performance enhancements. We include the following notable changes:

Value:

Performance

Regional Pinning for G1 - JEP 423

Reduces latency by implementing regional pinning in G1, so that garbage collection need not be disabled during Java Native Interface (JNI) critical regions.

Value:

Tooling

Launch Multi-File Source-Code Programs - JEP 458

Allows users to run a program supplied as multiple files of Java source code without first having to compile it.

Value:

Note that preview features are fully specified and fully implemented Language or VM Features of the Java SE Platform, but are impermanent. They are made available in JDK Feature Releases to allow for developer feedback based on real-world uses, before them becoming permanent in a future release. This also affords tool vendors the opportunity to work towards supporting features before they are finalized into the Java SE Standard.

APIs in Incubator Modules put non-final APIs and non-final tools in the hands of developers and users to gather feedback that will ultimately improve the quality of the Java platform.

Besides the changes described in the JEPs, there are many smaller updates listed in the release notes which will be of interest to many application developers and system administrators. These include deprecation of obsolete APIs and removal of previously deprecated ones.

Some of the key updates from the Java 22 release notes:

Finally, like all Feature releases, JDK 22 includes hundreds of performances, stability, and security updates including adapting to underlying OS and firmware updates and standards. Users and application developers usually benefit from these changes without noticing them

And the constant feature included in all JDK releases: Predictability

JDK 22 is the 13th Feature Release delivered on time through the six-month release cadence. This level of predictability allows developers to easily manage their adoption of innovation thanks to a steady stream of expected improvements.

Chart showing number of features per release since Java 8

Java’s ability to boost performance, stability, and security continues to make it the world’s most popular programming language.

Oracle will not offer long-term support for JDK 22; we will provide updates until September 2024 when it will be superseded by Oracle JDK 23.

Java 22, Together

As with previous releases, Java 22 celebrates the contributions of many individuals and organizations in the OpenJDK Community — we all build Java, together!

JDK 22 Fix Ratio

The rate of change over time in the JDK releases has remained largely constant for years, but under the six-month cadence the pace at which production-ready features and improvements are delivered has sharply increased.

Instead of making tens of thousands of fixes and delivering close to one hundred JEPs (JDK Enhancement Proposals) every few years, as we did with past Major Releases, enhancements are delivered in leaner Feature Releases on a more manageable and predictable six-month schedule. The changes range from significant new features to small enhancements to routine maintenance, bug fixes, and documentation improvements. Each change is represented in a single commit for a single issue in the JDK Bug System.

Of the 26,447 JIRA issues marked as fixed in Java 11 through Java 22 at the time of their GA, 18,842 were completed by Oracle employees while 7,605 were contributed by individual developers and developers working for other organizations. Going through the issues and collating the organization data from assignees results in the following chart of organizations sponsoring the development of contributions in Java:

Issues fixed in JDK 11-JDK 22 per organization

In Java 22, of the 2,251 JIRA issues marked as fixed, 1,554 were completed by Oracle, while 697 were contributed by other members of the Java community.

Issues fixed in JDK 22 per organization

Oracle would like to thank the developers working for organizations including Amazon, ARM, Google, Huawei, IBM, Intel, ISCAS, Microsoft, Red Hat, Rivos, SAP, and Tencent for their notable contributions. We are also thankful to see contributions from smaller organizations such as Bellsoft Data Dog and Loongson, as well as independent developers who collectively contributed 7% of the fixes in Java 22.

Additionally, through the OpenJDK Quality Outreach program we would like to thank the following FOSS projects that provided excellent feedback on testing Java 22 early access builds to help improve the quality of the release:

Resources

Java continues to be the #1 programming language for today’s technology trends. As the on-time delivery of improvements with Java 22 demonstrates, through continued thoughtful planning and ecosystem involvement, the Java platform is well-positioned for modern development and growth in the cloud.

Continue staying current with news and updates by: