Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 手动注册的 ObjectReader 在解序列化 Collection 时不生效 #3315

Open
EmptyDreams opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@EmptyDreams
Copy link
Contributor

问题描述

我有下面的代码:

data class TestWrapper(
    val uris: Collection<Test>?
)

然后使用 JSON.registerIfAbsentTest 类注册一个 Reader。

此时使用 JSON.parseObject("xxxxx", DocContentInfo::class.java) 解析 json 的时候,fastjson2 仍然会使用默认的 Reader 去创建 Test 的对象,而不是使用我注册的。

环境信息

请填写以下信息:

  • OS信息: Mac 15.1.1 (24B91) 2.6 GHz 六核Intel Core i7
  • JDK信息:Graalvm 21.0.6
  • 版本信息:Fastjson2 2.0.53

期待的正确结果

应该使用我自己注册的 Reader 去创建 Test 对象。

@EmptyDreams EmptyDreams added the bug Something isn't working label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant