alibaba / alibaba/fastjson2

[BUG] com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: An object of type 'com.alibaba.fastjson2.JSONFactory$CacheItem' was found in the image heap.

Open
#3,914 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述
*简要描述您碰到的问题。*

### 环境信息
*请填写以下信息:*

- OS信息: []
- JDK信息: [raalvm-jdk-25.0.1+8.1]
- 版本信息:[2.0.60]

### 重现步骤

GraalVM 25编译报错

### 期待的正确结果

### 相关日志输出
The following detailed trace displays from which field in the code the object was reached.
Object was reached by
indexing into array com.alibaba.fastjson2.JSONFactory$CacheItem[]@6da48dbf: [Lcom.alibaba.fastjson2.JSONFactory$CacheItem;@6da48dbf at index 7
scanning root com.alibaba.fastjson2.JSONFactory$CacheItem[]@6da48dbf: [Lcom.alibaba.fastjson2.JSONFactory$CacheItem;@6da48dbf embedded in
com.alibaba.fastjson2.JSONWriterUTF16.(JSONWriterUTF16.java:71)
parsing method com.alibaba.fastjson2.JSONWriterUTF16.(JSONWriterUTF16.java:70) reachable via the parsing context

at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onObjectReachable(ImageHeapScanner.java:618)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.onObjectReachable(SVMImageHeapScanner.java:127)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$markReachable$0(ImageHeapScanner.java:589)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:166)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:152)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)

#### 附加信息

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the GraalVM 25 native-image compilation failure with fastjson2 2.0.60, then inspect JSONWriterUTF16.java around lines 70-71 and the reported JSONFactory$CacheItem reachability path. Done means the compilation no longer reports this unsupported object, with a regression test covering the failing native-image scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.