Movatterモバイル変換


[0]ホーム

URL:


PreviousNext JavaScript must be enabled to correctly display this content
  1. Oracle JDK Migration Guide
  2. Significant Changes in the JDK

2Significant Changes in the JDK

Before migrating your application to the latest JDK release, you must understand what the updates and changes are between it and the previous JDK release. If you are migrating from JDK 8, you should also be familiar with the differences between JDK 8 and later releases that are described inMigrating from JDK 8 to Later JDK Releases.

See the following sections to learn about some of the significant changes in JDK releases.

Significant Changes in JDK 23 Release

SeeJDK 23 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 23.

The following are some of the updates in Java SE 23 and JDK 23:

Language Preview Features

SeeJEP 12: Preview Features andPreview Language and VM Features inJava Platform, Standard Edition Java Language Updates.

Library Improvements Previews and Incubator

  • The Class-File API is used for parsing, generating, and transforming Java class files.

    SeeJEP 466: Class-File API (Second Preview) andClass-File API inJava Platform, Standard Edition Java Virtual Machine Guide.

  • Stream gatherers enable you to create custom intermediate operations, which allow stream pipelines to transform data in ways that aren't easily achievable with existing built-in intermediate operations.

    SeeJEP 473: Stream Gatherers (Second Preview) andStream Gatherers inJava Platform, Standard Edition Core Libraries.

  • Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.

    SeeJEP 480: Structured Concurrency (Third Preview) andStructured Concurrency inJava Platform, Standard Edition Core Libraries.

  • Scoped values enables sharing of immutable data within and across threads. They are preferred to thread-local variables, especially when using large numbers of virtual threads.

    SeeJEP 481: Scoped Values (Third Preview) and theScopedValue class in the Java API Specification.

  • The Vector API is introduced 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. SeeJEP 469: Vector API (Eighth Incubator).

SeeJEP 11: Incubator Modules.

Runtime Improvements

  • The ZGC garbage collector now runs in the generational mode by default. The non-generational mode of ZGC has been deprecated for removal. This will generally improve application performance, although a small number of workloads that are non-generational in nature may be impacted negatively.

    SeeJEP 474: ZGC: Generational Mode by Default and the sectionThe Z Garbage Collector inJava Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide.

  • The Oracle GraalVM JIT compiler (Graal JIT) is now included among the JITs available as part of the Oracle JDK. This integration offers innovations previously made available throughOracle GraalVM, such as novel JIT code optimization techniques (seeCompiler Advantages in the GraalVM documentation). This provides developers and system administrators more options to help fine tune and improve peak performance of their applications. The Graal JIT is enabled by passing the command line options to the Java executable:
    -XX:+UnlockExperimentalVMOptions -XX:+UseGraalJIT

    If you do not pass these flags at JVM startup, the Oracle JDK default JIT (C2) will run as usual.

Tooling

JavaDoc documentation comments can now be written in Markdown syntax along with HTML elements and JavaDoc tags.

SeeJEP 467: Markdown Documentation Comments andMarkdown in Documentation Comments inJava Platform, Standard Edition JavaDoc Guide.

Removed APIs, Tools, and Components

For more details on removals and deprecations, seeFeatures and Options Removed and Deprecated in JDK 23.

In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 23.

Significant Changes in JDK 22 Release

SeeJDK 22 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 22.

The following are some of the updates in Java SE 22 and JDK 22:

Language Features

  • Unnamed variables and unnamed patterns can be used when variable declarations or nested patterns are required but never used. Unnamed patterns can appear in a pattern list of a record pattern and can be used instead of a type pattern. You denote both with the underscore character(_).

    SeeJEP 456: Unnamed Variables & Patterns andUnnamed Variables and Patterns inJava Platform, Standard Edition Java Language Updates.

Preview Language Features

  • In constructors, you can add statements that don't reference the instance being created before an explicit constructor invocation. You can use this feature to prepare arguments for a superclass constructor by performing nontrivial computations or validate arguments you want to pass to a superclass constructor.

    SeeJEP 447: Statements before super(...) andStatements Before super(...) inJava Platform, Standard Edition Java Language Updates.

  • 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. Embedded expressions are Java expressions with additional syntax that differentiates them from the literal text in the string template. A template processor combines the literal text in the template with the values of the embedded expressions to produce a result.

    SeeJEP 459: String Templates (Second Preview) andString Templates inJava Platform, Standard Edition Java Language Updates.

  • The preview features Instance Main Methods and Implicitly Declared Classes enable students to write their first programs without needing to understand the full set of language features designed for large programs. They can write streamlined declarations for single-class programs and then seamlessly expand their programs to use more advanced features as their skills grow.

    SeeJEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview) andImplicitly Declared Classes and Instance Main Methods inJava Platform, Standard Edition Java Language Updates.

SeePreview Language and VM Features for more information about preview features.

Library Improvements

  • The Foreign Function and Memory (FFM) API enables Java programs to interoperate with code and data outside the Java runtime. This API enables Java programs to call native libraries and process native data without the brittleness and danger of JNI. The API invokes foreign functions, code outside the JVM, and safely accesses foreign memory, memory not managed by the JVM.

    SeeJEP 454: Foreign Function & Memory API andForeign Function and Memory API inJava Platform, Standard Edition Core Libraries.

Library Improvements Previews and Incubator

  • Stream gatherers enable you to create custom intermediate operations, which allow stream pipelines to transform data in ways that aren't easily achievable with existing built-in intermediate operations.

    SeeJEP 461: Stream Gatherers (Preview) andStream Gatherers inJava Platform, Standard Edition Core Libraries.

  • The Class-File API is used for parsing, generating, and transforming Java class files.

    SeeJEP 457: Class-File API (Preview) andClass-File API inJava Platform, Standard Edition Java Virtual Machine Guide.

  • Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.

    SeeJEP 462: Structured Concurrency (Second Preview) andStructured Concurrency inJava Platform, Standard Edition Core Libraries.

  • Scoped values enables sharing of immutable data within and across threads. They are preferred to thread-local variables, especially when using large numbers of virtual threads.

    SeeJEP 464: Scoped Values (Second Preview) and theScopedValue class in the Java API Specification.

  • The Vector API is introduced 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. SeeJEP 460: Vector API (Seventh Incubator).

SeeJEP 12: Preview Features andJEP 11: Incubator Modules for more information about preview features and incubating APIs.

Performance Improvements

Region pinning in G1 reduces latency so that garbage collection need not be disabled during Java Native Interface (JNI) critical regions.

SeeJEP 423: Region Pinning for G1 and the sectionEvacuation Failure inJava Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide.

Tooling

The Java application launcher is enhanced to run a program supplied as multiple files of Java source code. This will enable gradual transition from small programs to larger ones.

SeeJEP 458: Launch Multi-File Source-Code Programs.

Removed APIs, Tools, and Components

For more details on removals and deprecations, seeFeatures and Options Removed and Deprecated in JDK 22.

In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 22.

Significant Changes in JDK 21 Release

SeeJDK 21 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 21.

The following are some of the updates in Java SE 21 and JDK 21:

Language Features

  • Record patterns and type patterns can be nested to enable a powerful, declarative, and composable form of data navigation and processing. You can use a record pattern to test whether a value is an instance of a record class type and, if it is, to recursively perform pattern matching on its component values. In this release, support for record patterns appearing in the header of an enhancedfor statement has been removed.

    SeeJEP 440: Record Patterns andRecord Patterns inJava Platform, Standard Edition Java Language Updates.

  • Aswitch statement transfers control to one of several statements or expressions, depending on the value of its selector expression. Extending pattern matching toswitch allows an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely. In this release:
    • Parenthesized patterns have been removed.
    • Qualifiedenum constants ascase constants inswitch expressions and statements are allowed.

    SeeJEP 441: Pattern Matching for switch andPattern Matching for switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates.

Preview Language Features

SeePreview Language and VM Features for more information about preview features.

Library Improvements

  • Virtual threads are lightweight threads that reduce the effort of writing, maintaining, and debugging high-throughput concurrent applications.

    SeeJEP 444: Virtual Threads andVirtual Threads inJava Platform, Standard Edition Core Libraries.

  • Sequenced collections are collections with a defined encounter order. Each such collection has a well-defined first element, second element, and so forth, up to the last element. It is an interface that represents a sequenced collection, provides uniform APIs for accessing its first and last elements, and for processing its elements in reverse order.

    SeeJEP 431: Sequenced Collections andCreating Sequenced Collections, Sets, and Maps inJava Platform, Standard Edition Core Libraries.

  • The Key Encapsulation Mechanism API is introduced for key encapsulation mechanisms (KEMs), an encryption technique for securing symmetric keys using public key cryptography.

    SeeJEP 452: Key Encapsulation Mechanism API andThe KEM Class inJava Platform, Standard Edition Security Developer's Guide.

Library Improvements Previews and Incubator

  • The preview API Foreign Function and Memory API has been further refined as follows:
    • Centralized the management of the lifetimes of native segments in theArena interface
    • Enhanced layout paths with a new element to dereference address layouts
    • Provided a linker option to optimize calls to functions that are short-lived and will not upcall to Java (e.g.,clock_gettime)
    • Provided a fallback native linker implementation, based onlibffi, to facilitate porting
    • Removed theVaList class
    SeeJEP 442: Foreign Function & Memory API (Third Preview) andForeign Function and Memory API inJava Platform, Standard Edition Core Libraries.
  • Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.

    SeeJEP 453: Structured Concurrency (Preview) andStructured Concurrency inJava Platform, Standard Edition Core Libraries.

  • Scoped values enables sharing of immutable data within and across threads. They are preferred to thread-local variables, especially when using large numbers of virtual threads.

    SeeJEP 446: Scoped Values (Preview) and theScopedValue class in the Java API Specification.

  • The Vector API is introduced 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. SeeJEP 448: Vector API (Sixth Incubator).

SeeJEP 12: Preview Features andJEP 11: Incubator Modules for more information about preview features and incubating APIs.

Performance Improvements

Application performance has been improved by extending the Z Garbage Collector (ZGC) to maintain separategenerations for young and old objects. This will allow ZGC to collect young objects, which tend to die young, more frequently.

SeeJEP 439: Generational ZGC andThe Z Garbage Collector inJava Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide.

Stewardship

Warnings are issued when agents are loaded dynamically into a running JVM. These warnings aim to prepare users for a future release which disallows the dynamic loading of agents by default in order to improve integrity by default.

SeeJEP 451: Prepare to Disallow the Dynamic Loading of Agents.

Removed APIs, Tools, and Components

For more details on removals and deprecations, seeFeatures and Options Removed and Deprecated in JDK 21.

In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 21.

Significant Changes in JDK 20 Release

SeeJDK 20 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 20.

The following are some of the updates in Java SE 20 and JDK 20:

Concurrency Model Previews and Incubators

  • Virtual threads are lightweight threads that reduce the effort of writing, maintaining, and debugging high-throughput concurrent applications. This is a preview API. Minor changes have been made to this API since the last release. SeeJEP 436: Virtual Threads (Second Preview) andVirtual Threads inJava Platform, Standard Edition Core Libraries.
  • Structured Concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. SeeJEP 437: Structured Concurrency (Second Incubator). SeeJEP 11: Incubator Modules for more information about incubating APIs.
  • Scoped values enables sharing of immutable data within and across threads. They are preferred to thread-local variables, especially when using large numbers of virtual threads. SeeJEP 429: Scoped Values (Incubator) andJEP 11: Incubator Modules.
  • An API is introduced 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. SeeJEP 438: Vector API (Fifth Incubator).

Language Changes

  • The preview feature Pattern Matching forswitch Expressions and Statements has been further refined as follows:
    • An exhaustive switch (that is, aswitch expression or a patternswitch statement) over anenum class throws aMatchException instead of an IncompatibleClassChangeError if noswitch label applies at run time.
    • The grammar forswitch labels is simpler.
    • The compiler can infer the type of the type arguments for generic record patterns in all constructs that accept patterns:switch statements and expressions,instanceof expressions, and enhancedfor statements.
    SeeJEP 433: Pattern Matching for switch (Fourth Preview) andPattern Matching for switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates.
  • The preview feature Record Patterns has been further refined as follows:
    • The compiler can infer the type of the type arguments for generic record patterns.
    • Record patterns can appear in an enhancedfor statement.
    • Named record patterns are no longer supported.
    SeeJEP 432: Record Patterns (Second Preview) andRecord Patterns inJava Platform, Standard Edition Java Language Updates.

SeePreview Language and VM Features for more information about preview features.

Library Changes

Removed APIs, Tools, and Components

For more details on removals and deprecations, seeFeatures and Options Deprecated in JDK 20.

In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 20.

Significant Changes in JDK 19 Release

SeeJDK 19 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 19.

The following are some of the updates in Java SE 19 and JDK 19:

Concurrency Model Update Previews

  • Virtual threads are lightweight threads that reduce the effort of writing, maintaining, and debugging high-throughput concurrent applications. This is apreview API. SeeJEP 425: Virtual Threads (Preview) andVirtual Threads inJava Platform, Standard Edition Core Libraries.
  • An API is introduced to simplify multithreaded programming for structured concurrency. Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. SeeJEP 428: Structured Concurrency (Incubator).

Language Changes

  • Record Patterns is introduced as a preview feature for this release. A record pattern consists of a type, a record component pattern list used to match against the corresponding record components, and an optional identifier. You can nest record patterns and type patterns to enable a powerful, declarative, and composable form of data navigation and processing. SeeJEP 405: Record Patterns (Preview) andRecord Patterns inJava Platform, Standard Edition Java Language Updates.
  • The preview feature Pattern Matching forswitch Expressions and Statements has been re-previewed in this release. This feature enables an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely. SeeJEP 427: Pattern Matching for switch (Third Preview) andPattern Matching for switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates.

Library Changes

  • The Foreign Function and Memory API enables Java programs to interoperate with code and data outside the Java runtime. This API enables Java programs to call native libraries and process native data without the brittleness and danger of JNI. The API invokes foreign functions, code outside the JVM, and safely accesses foreign memory that is not managed by the JVM. This is apreview API. SeeJEP 424: Foreign Function & Memory API (Preview) andForeign Function and Memory API inJava Platform, Standard Edition Core Libraries.
  • The Vector API is introduced 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. SeeJEP 426: Vector API (Fourth Incubator).

Removed APIs, Tools, and Components

For more details on removals and deprecations, seeFeatures and Options Deprecated in JDK 19.

In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 19.

Significant Changes in JDK 18 Release

SeeJDK 18 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 18.

The following are some of the updates in Java SE 18 and JDK 18:

Tools

Library Changes

Preview Features and Incubator Modules

SeeJEP 12: Preview Features for more information about preview features andJEP 11: Incubator Modules for more information about incubator modules.

Removed APIs, Tools, and Components

For more details on removals and deprecations, see:

In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 18.

Significant Changes in JDK 17 Release

SeeJDK 17 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 17.

The following are some of the updates in Java SE 17 and JDK 17:

New Language Feature

  • Sealed Classes, first previewed in Java SE 15, is a permanent feature in this release. Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them. SeeJEP 409: Sealed Classes andSealed Classes inJava Platform, Standard Edition Java Language Updates guide.

Library Changes

Other Changes

  • By default, all internal elements of the JDK are strongly encapsulated, except for critical internal APIs such assun.misc.Unsafe. However, it will no longer be possible to relax the strong encapsulation of internal elements using a single command-line option, as it was possible in JDK 9 through JDK 16. SeeJEP 403: Strongly Encapsulate JDK Internals by Default.
  • The floating-point operations are now consistently strict, rather than having both strict floating-point semantics (strictfp) and subtly different default floating-point semantics. SeeJEP 306: Restore Always-Strict Floating-Point Semantics.

Deprecations

Preview Features and Incubator Modules

SeeJEP 12: Preview Features for more information about preview features andJEP 11: Incubator Modules for more information about incubator modules.

Removed APIs, Tools, and Components

See:

In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 17.

Significant Changes in JDK 16 Release

SeeJDK 16 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 16.

The following are some of the updates in Java SE 16 and JDK 16:

Preview Features and Incubator Modules

SeeJava Language Preview Feature for more information about preview features.

  • Sealed classes, a preview feature from JDK 15, is re-previewed in this release. Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them. There has been several refinements in this release, including the introduction of character sequencessealed,non-sealed, andpermits as contextual keywords. SeeJEP 397: Sealed Classes (Second Preview) andSealed Classes inJava Platform, Standard Edition Java Language Updates guide.
  • Initial iteration of an incubator module,jdk.incubator.vector, is provided to express vector computations. It reliably compiles at runtime to optimal vector hardware instructions on supported CPU architectures and thus achieve superior performance to equivalent scalar computations. SeeJEP 338: Vector API (Incubator).
  • Foreign Linker API is introduced that offers statically-typed, pure-Java access to native code. This API, along with the Foreign-Memory Access API (JEP 393), will simplify the otherwise error-prone process of binding to a native library. SeeJEP 389: Foreign Linker API (Incubator).
  • Foreign-Memory Access API allows Java programs to safely and efficiently access foreign memory outside of the Java heap. SeeJEP 393: Foreign-Memory Access API (Third Incubator).

Removed APIs, Tools, and Components

See:

In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 16.

Significant Changes in JDK 15 Release

SeeJDK 15 Release Notes for the complete list of new features and enhancements in JDK 15.

The following are some of the updates in Java SE 15 and JDK 15:

  • Text Blocks, first previewed in Java SE 13, is a permanent feature in this release and can be used without enabling preview features.

    Text blocks are multiline string literals that avoid the need for most escape sequences, automatically format the string in a predictable way, and give the developer control over the format when desired. SeeJEP 378: Text Blocks andProgrammer's Guide to Text Blocks.

  • The Z Garbage Collector (ZGC) is ready to use in production and no longer an experimental feature. Enable ZGC by using the command-line option-XX:+UseZGC. SeeJEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production).
  • Hidden classes are classes that cannot be used directly by the bytecode of other classes. Hidden classes are intended for use by frameworks that generate classes at run time and use them indirectly through reflection. SeeJEP 371: Hidden Classes.

Preview and Incubator Features

SeeJava Language Preview Feature for more information about preview features.

Removed APIs, Tools, and Components

See:

In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 15.

Significant Changes in JDK 14 Release

The following are some of the changes in Java SE 14 and JDK 14:

  • Switch is extended so it can be used as either a statement or an expression, so that both forms can use either traditionalcase ... : labels (with fall through) or newcase ... -> labels (with no fall through), with a further new statement for yielding a value from a switch expression. SeeJEP 361: Switch Expressions (Standard) andJava Language Changes.
  • G1 is enhanced to improve allocation performance on non-uniform memory access (NUMA) memory systems. SeeJEP 345: NUMA-Aware Memory Allocation for G1.
  • JDK Flight Recorder data is now available as a data stream allowing for continuous monitoring. SeeJEP 349: JFR Event Streaming.
  • New JDK-specific file mapping modes have been added so that theFileChannel API can be used to createMappedByteBuffer instances that refer to non-volatile (NVM) memory. SeeJEP 352: Non-Volatile Mapped Byte Buffers.
  • Allows currencies to be formatted with locale-specific accounting formats, for example, ($3.27) instead of -$3.27. SeeAccounting Currency Format Support.
  • Enhancedcom.sun.management.OperatingSystemMXBean to ensure that it reports values based on the current operating environment, such as a container environment. The MXBean for tools to get information on the operating system has been improved for container environments. SeeOperatingSystemMXBean made container aware.

Experimental, Preview, and Incubator Features

Removed APIs, Tools, and Components

See:

In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 14.

Significant Changes in JDK 13 Release

The following were some of the important enhancements in Java SE 13 and JDK 13:

Significant Changes in JDK 12 Release

The following were some of the important additions and updates in Java SE 12 and JDK 12:

Significant Changes in JDK 11 Release

JDK 11 had some significant changes too. As JDK 11 is a long term support (LTS) release, you should be familiar with the following important changes in JDK 11 release:


[8]ページ先頭

©2009-2025 Movatter.jp