11 Dec

JDK 22: A Majority of New Features

    Java’s next iteration, scheduled for release in March, will introduce 12 new capabilities, including previews of scoped values, structured concurrency, stream gatherers, and multi-file program execution.

    Key Additions:

    • Scoped Values: Enables secure and efficient sharing of immutable data within and across threads.
    • Stream Gatherers: Enhances the stream API for custom intermediate operations, transforming data in new ways.
    • Structured Concurrency: Simplifies concurrent programming with an API that treats groups of tasks as a single unit, facilitating error handling and cancellation.
    • Multi-File Program Execution: Allows the Java application launcher to run programs provided as multiple Java source code files.
    • Class-File API: Provides a standard API for parsing, generating, and transforming Java class files.
    • Region Pinning for G1: Reduces latency by enabling garbage collection during Java Native Interface critical regions.
    • Implicitly Declared Classes and Instance Methods: Evolves the Java language, allowing students to write simple programs without complex features.
    • Statements before super(…): Allows statements not referencing the instance being created to appear before an explicit constructor.
    • String Templates (Second Preview): Complements string literals and text blocks by coupling literal text with embedded expressions and template processors for specialized results.
    • Vector API (Seventh Incubator): Enables vector computations that compile to optimal vector instructions on supported CPUs, achieving superior performance.
    • Unnamed Variables and Patterns: Captures developer intent and improves code maintainability by identifying unused variables and allowing multiple patterns in single case labels.
    • Foreign Function and Memory API (Final): Allows Java programs to interoperate with code and data outside the Java runtime, invoking foreign functions and safely accessing foreign memory.

    Release Schedule:

    • Early-access builds: Available for Linux, Windows, and Mac.
    • Rampdown phase 1: Feature set frozen, December 7th, 2023.
    • Second rampdown phase: January 18th, 2024.
    • Release candidates: February, 2024.
    • General availability: March 19th, 2024.

    Additional Notes:

    • JDK 22 will receive six months of support from Oracle.
    • Long-term support (LTS) releases occur every two years, with the most recent being JDK 21.
    • Companies besides Oracle can offer extended support for JDK 22.

    Overall, JDK 22 focuses on improving developer experience, performance, and interoperability, paving the way for more efficient and powerful Java applications.

    Share this