[BUG]fastjson2的JDKUtils调用了sun.misc.Unsafe::arrayBaseOffset,告警提示。
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
fastjson2的JDKUtils调用了sun.misc.Unsafe::arrayBaseOffset,告警提示。
### 环境信息
*请填写以下信息:*
- OS信息: [e.g.:Windows 11 ]
- JDK信息: [e.g.:KonaJDK-21]
- 版本信息:[e.g.:Fastjson2 2.0.61]
### 重现步骤
库调用了不安全的操作,未来JDK国产化可能移除或限制访问的sum.misc包,是否可以迁移
### 期待的正确结果
不用启动参数抑制报错
### 相关日志输出
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:/D:/WorkStation/maven/repo/com/alibaba/fastjson2/fastjson2/2.0.61/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
Contributor guide
Research direction
Start in the com.alibaba.fastjson2.util.JDKUtils code path that calls sun.misc.Unsafe::arrayBaseOffset, using the warning output to locate the affected entry point. Check the project’s existing compatibility tests or test layout before reproducing the warning with the reported fastjson2 2.0.61 setup. Done means the relevant operation no longer produces the deprecated Unsafe warning or requires startup suppression, with compatibility preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100