[BUG]fastjson2 为了追求极致的序列化/反序列化性能,内部使用了 Unsafe 的底层内存操作,但这个做法在新版 JDK 中被标记为 terminally deprecated(终极废弃,确定会删除)
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
*简要描述您碰到的问题。*
出现警告:
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::arrayBaseOffset has been called by com.alibaba.fastjson2.util.JDKUtils (file:/fastjson2-2.0.61.jar)
WARNING: Please consider reporting this to the maintainers of class com.alibaba.fastjson2.util.JDKUtils
WARNING: sun.misc.Unsafe::arrayBaseOffset will be removed in a future release
### 环境信息
*请填写以下信息:*
- OS信息: windows 10
- JDK信息:JDK 25.0.3 2026-04-21 LTS
- 版本信息:fastjson2-2.0.61
### 重现步骤
只要使用 fastjson2-2.0.61.jar 即出现以上警告
Contributor guide
Research direction
Start by inspecting com.alibaba.fastjson2.util.JDKUtils and the use of Unsafe::arrayBaseOffset, then reproduce the warning with fastjson2-2.0.61 on JDK 25. Check the existing serialization and deserialization tests before changing the compatibility path. Done means the warning no longer appears on the reported JDK while serialization and deserialization continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100