Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
45 lines (35 loc) · 2.11 KB

File metadata and controls

45 lines (35 loc) · 2.11 KB
Copy raw file
Download raw file
Edit and raw actions
title Java 25 新特性概览
category Java
tag
Java新特性
head
meta
name content
keywords
Java 25,JDK25,LTS,作用域值,紧凑对象头,分代 Shenandoah,模块导入,结构化并发
meta
name content
description
概览 JDK 25 的关键新特性与预览改动,关注并发、GC 与语言/平台增强。

JDK 25 于 2025 年 9 月 16 日 发布,这是一个非常重要的版本,里程碑式。

JDK 25 是 LTS(长期支持版),至此为止,目前有 JDK8、JDK11、JDK17、JDK21 和 JDK 25 这四个长期支持版了。

JDK 21 共有 18 个新特性,这篇文章会挑选其中较为重要的一些新特性进行详细介绍:

下图是从 JDK 8 到 JDK 24 每个版本的更新带来的新特性数量和更新时间:

JEP 506: 作用域值

作用域值(Scoped Values)可以在线程内和线程间共享不可变的数据,优于线程局部变量 ThreadLocal ,尤其是在使用大量虚拟线程时。

final static ScopedValue<...> V = new ScopedValue<>();

// In some method
ScopedValue.where(V, <value>)
           .run(() -> { ... V.get() ... call methods ... });
Morty Proxy This is a proxified and sanitized view of the page, visit original site.