[BUG] 在Android SDK 34下JSON::toJSONString返回{}
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
*简要描述您碰到的问题。*
普通class正常
我定义了这样一个record
```java
public record Device(String username, String deviceName) {
@Override
public String toString() {
return username + "@" + deviceName;
}
}
```
使用JSON::toJSONString后返回"{}"
### 环境信息
*请填写以下信息:*
- OS信息: Android 14
- JDK信息:17
- 版本信息:Fastjson2 2.0.40
### 重现步骤
*如何操作可以重现该问题:*
1. 定义一个record类
2. 新建对象
3. 使用JSON::toJsonString并输出
### 期待的正确结果
*对您期望发生的结果进行清晰简洁的描述。*
返回```{"deviceName":"2","username":"1"}```等结果
### 相关日志输出
没有看到相关日志
#### 附加信息
无
Contributor guide
Research direction
Start by reproducing JSON::toJSONString on Android 14 with JDK 17 and Fastjson2 2.0.40 using the record shown in the issue. Trace how record components are detected during serialization and compare the Android result with the expected JSON containing username and deviceName. Done means the record no longer serializes as {} and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100