Java 25 尝鲜体验
王福强
2025-09-17
Java 25 出来啦~
把 JavaFX相关的几个项目先直接升级到了Java 25,没任何错误需要修复,相当丝滑,最主要的是,换完jdk,重新打包后,keeboxfx的安装包从919+M降到了715.6M🤣 ,就一个字,帅,三个字,干得漂亮
顺便把 KVectors 也一并升了:
LuckyJohn💫 ➜ kVectors git:(master) ✗ git ci -m "bump up java to 25"
[master 982663f] bump up java to 25
2 files changed, 27 insertions(+), 2 deletions(-)
有小兄弟说我追新,哈哈哈,只要这个新带来的是好的,就应该追。
什么都不做,只要升级单一依赖就能带来性能和效率上的绝大提升,干嘛不追?🤣
Java 25 这次发布主要包含了如下几个大的JEP特性:
- JEP 470 PEM Encodings of Cryptographic Objects // 这个好
- JEP 502 Stable Values // 线程安全的lazy init, 有点儿loading cache那种API设计风格。
- JEP 503 Remove the 32-bit x86 Port
- JEP 505 Structured Concurrency // // 这个可以
- JEP 506 Scoped Values // virtual threads的完美搭档
- JEP 507 Primitive Types in Patterns, instanceof, and switch // java语法特性
- JEP 508 Vector API (Tenth Incubator)// 这阵子个人关注最多的JEP
- JEP 509 JFR CPU-Time Profiling // JFR打头儿的都是技术保障部的事儿,性能与稳定性🤣
- JEP 510 Key Derivation Function API // 这个也好, 量子计算来了也不怕。
- JEP 511 Module Import Declarations // jpms带来的那啥
- JEP 512 Compact Source Files and Instance Main Methods // java 写脚本
- JEP 513 Flexible Constructor Bodies // 继承上的改进,super()和this()不用非得在方法第一行了。
- JEP 514 Ahead-of-Time Command-Line Ergonomics // AOT 打头儿的估计都从graalvm剥离出来的?Project Leyden vs. graalvm
- JEP 515 Ahead-of-Time Method Profiling
- JEP 518 JFR Cooperative Sampling
- JEP 519 Compact Object Headers // 省内存,$ java -XX:+UseCompactObjectHeaders …
- JEP 520 JFR Method Timing & Tracing
- JEP 521 Generational Shenandoah // 垃圾回收(gc)上的改进
当然,还有成千的微小改进和bug修复,这一般都一笔带过,但积攒多了带来的也是质变。
每个特性详细介绍,这篇文章我觉得写的挺好(下面表格也是整理自这篇文章),感兴趣的同学可以看看:https://hanno.codes/2025/09/16/heres-java-25/
JEP | Title | Status | Project | Feature Type | Changes since Java 24 |
---|---|---|---|---|---|
(#jep-470-pem-encodings-of-cryptographic-objects-preview) | PEM Encodings of Cryptographic Objects | Preview | Security Libs | Security | New feature |
(#jep-502-stable-values-preview) | Stable Values | Preview | Core Libs | New API | New feature |
(#jep-503-remove-the-32-bit-x86-port) | Remove the 32-bit x86 Port | HotSpot | Deprecation | Removal | |
(#jep-505-structured-concurrency-fifth-preview) | Structured Concurrency | Fifth Preview | Loom | Concurrency | Major |
(#jep-506-scoped-values) | Scoped Values | Loom | Concurrency | Minor | |
(#jep-507-primitive-types-in-patterns-instanceof-and-switch-third-preview) | Primitive Types in Patterns, instanceof, and switch | Third Preview | Amber | Language | None |
(#jep-508-vector-api-tenth-incubator) | Vector API | Tenth Incubator | Panama | New API | Minor |
(#jep-509-jfr-cpu-time-profiling-experimental) | JFR CPU-Time Profiling | Experimental | HotSpot / JFR | Profiling | New feature |
(#jep-510-key-derivation-function-api) | Key Derivation Function API | Security Libs | Security | None | |
(#jep-511-module-import-declarations) | Module Import Declarations | Amber | Language | None | |
(#jep-512-compact-source-files-and-instance-main-methods) | Compact Source Files and Instance Main Methods | Amber | Language | Major | |
(#jep-513-flexible-constructor-bodies) | Flexible Constructor Bodies | Amber | Language | None | |
(#jep-514-ahead-of-time-command-line-ergonomics) | Ahead-of-Time Command-Line Ergonomics | Leyden | Performance | New feature | |
(#jep-515-ahead-of-time-method-profiling) | Ahead-of-Time Method Profiling | Leyden | Performance | New feature | |
(#jep-518-jfr-cooperative-sampling) | JFR Cooperative Sampling | HotSpot / JFR | Profiling | New feature | |
(#jep-519-compact-object-headers) | Compact Object Headers | HotSpot | Performance | None | |
(#jep-520-jfr-method-timing–tracing) | JFR Method Timing & Tracing | HotSpot / JFR | Profiling | New feature | |
(#jep-521-generational-shenandoah) | Generational Shenandoah | HotSpot / GC | Performance | Stability and performance improvements |
NOTE
JEP life stages: incubation -> preview -> finalized.
开天窗,拉认知,订阅「福报」,即刻拥有自己的全模态人工智能。
