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

Closed
EmptyDreams opened this issue Jan 24, 2025 · 2 comments
Closed
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
@wenshao
Copy link
Member

wenshao commented Feb 3, 2025

可以帮忙提供重现问题的testcase么?

@EmptyDreams EmptyDreams marked this as a duplicate of #3312 Feb 5, 2025
@EmptyDreams
Copy link
Contributor Author

可以帮忙提供重现问题的testcase么?

我本地写了个测试试了一下没有问题,可能我当时代码哪里写错了,当时没留档,以后如果再遇到问题再说吧

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

2 participants