English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Java 25 (LTS) New Features Overview: 18 JEPs for AI, Security, and Performance

Forum topic · ✨步子哥 · 2025-10-13

Summary

Java 25, the next long-term support (LTS) release of the Java platform, reached General Availability on September 16, 2025. It ships 18 JDK Enhancement Proposals (JEPs) spanning language features, standard libraries, APIs, and runtime improvements, including five features aimed at AI-related workloads. Highlights include Compact Object Headers (JEP 512) reducing object header size from 12 to 8 bytes, Key Derivation Functions (JEP 514) as a building block for post-quantum cryptography, PEM encodings of cryptographic objects (JEP 510), and the standardization of the Shenandoah low-latency garbage collector (JEP 518). Preview features include Structured Concurrency (third preview) and primitive types in patterns, instanceof, and switch. Experimental JFR CPU-Time Profiling, cooperative sampling, and method timing/tracing improve production diagnostics, while AOT command-line ergonomics pave the way for Project Leyden. Java 25 also drops 32-bit x86 support and optimizes String::hashCode via constant folding. This article provides a structured overview of the major features with a comparison table, upgrade advice from Java 21, and links to the official release notes.

Java 25 is the next long-term support (LTS) release of the Java platform, officially released (General Availability) on September 16, 2025. It is a major milestone, introducing enhancements across the language, standard libraries, APIs, and runtime — 18 JEPs (JDK Enhancement Proposals) in total, including 5 features targeting AI development, multiple preview and incubator features, plus performance optimizations and security improvements. These changes aim to boost developer productivity, application performance, and security, with particular support for post-quantum cryptography (PQC) and AI-related workloads.

Compared with the previous LTS release, Java 21, Java 25 accumulates iterations from multiple intermediate versions, including further refinements to pattern matching, maturation of virtual threads, and runtime optimizations. Upgrading from an earlier version also brings features added in between, such as the Foreign Function & Memory API.

Below is a list of the major new features in Java 25, compiled from official JEPs and reliable sources (Oracle, OpenJDK, and InfoWorld), presented as a table for easy comparison. Feature types (Standard/Preview/Incubator/Experimental) and brief impact are noted.

| JEP | Feature | Type | Description | Impact & Benefits | |-----|---------|------|-------------|-------------------| | JEP 509 | JFR CPU-Time Profiling | Experimental | Uses kernel CPU timers on Linux to capture CPU-time profiling of Java programs, enhancing JFR (JDK Flight Recorder). | Helps developers diagnose performance bottlenecks more precisely on Linux; may extend to other platforms later. | | JEP 510 | PEM Encodings of Cryptographic Objects | Standard | Supports Privacy-Enhanced Mail (PEM) encoding of cryptographic objects, per RFC 5705 and RFC 8446. | Strengthens TLS/SSL security and modern cryptography workflows. | | JEP 511 | Structured Concurrency (Third Preview) | Preview | Third preview of structured concurrency, supporting try-with-resources-style management of concurrent tasks. | Simplifies multithreaded code, reduces concurrency bugs, improves readability and reliability. | | JEP 512 | Compact Object Headers | Standard | Compresses object headers, reducing size from 12 bytes to 8 bytes. | Significantly lowers memory usage, especially in high-object-density applications; positive effects on GC and performance. | | JEP 513 | Ahead-of-Time Command-Line Ergonomics | Standard | New JVM flag -XX:AOTCacheOutput; disables dynamic features to evaluate AOT compilation compatibility. | Paves the way for future AOT compilation, helps identify reflection/class-loading issues, supports Project Leyden's static image generation. | | JEP 514 | Key Derivation Functions | Standard | New API for key derivation functions (KDF), a building block for post-quantum cryptography (PQC). | Improves cryptographic security against quantum computing attacks; Oracle highlights it as a key advance for AI and security. | | JEP 515 | Primitive Types in Patterns, instanceof, and switch (Third Preview) | Preview | Third preview of primitive types in pattern matching, instanceof, and switch. | Extends pattern matching for more concise code, e.g., direct pattern handling of int. | | JEP 516 | JFR Cooperative Sampling | Standard | Cooperative sampling mode for JFR that reduces sampling overhead. | Improves the performance of runtime diagnostics tools, suitable for production monitoring. | | JEP 517 | JFR Method Timing and Tracing | Standard | JFR support for method timing and tracing, enhancing method-level profiling. | Provides finer-grained performance insight to help optimize hot code paths. | | JEP 518 | Shenandoah Garbage Collector | Standard | Brings the Shenandoah GC into the platform, supporting low-latency collection. | Suited to real-time and high-throughput applications by reducing GC pause times. |

Other Notable Changes and Improvements

  • Performance: String::hashCode benefits from constant folding, giving notable speedups when string keys are used in statically immutable maps. Overall runtime is faster, including better memory management and GC efficiency.
  • Removed support: The 32-bit x86 port is no longer maintained, focusing development on 64-bit architectures; legacy 32-bit systems need to move to 64-bit.
  • AI and security focus: Oracle highlights 5 AI-related features (such as JFR enhancements and PQC support) to help build efficient AI applications.
  • Tooling: IDEs like IntelliJ IDEA have quickly integrated the new features, including inspections, quick fixes, and debugging support.

Upgrade Advice

Java 25 is the next LTS after Java 21; migrating early is recommended, especially for projects that need performance and modern language features. Downloads: Oracle JDK or OpenJDK (jdk.java.net). The full changelog is in the Oracle JDK 25 Release Notes. If you are upgrading from Java 21, pay particular attention to the pattern matching and concurrency preview features, which can greatly simplify your code.

Tags

#java#java-25#lts#openjdk#post-quantum-cryptography#structured-concurrency#jfr#shenandoah-gc

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176030901