Repository navigation
Fix JSONB decoding of typed lists in record constructors - #7980
Draft
wenwenwu999-maker wants to merge 1 commit into
Draft
wenwenwu999-maker wants to merge 1 commit into
wenwenwu999-maker wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
A record with a
List<Item>component fails to round-trip through JSONB whenWriteClassNameemits a type marker for a JDK immutable list. The constructor-argument reader callsstartArray()while the cursor is still onBC_TYPED_ANY. Empty and single-element lists both reproduce the exception on main at460d2e4. This also reproduces the symptom reported in apache/dubbo#16597.Change
For a typed JSONB list, dispatch to the field's existing object reader with the declared field type and reader features. The regression test checks record equality after round-tripping empty and single-element lists of records.
Verification
FieldReaderList*Test,JSONB*Test,List*Test).test-jdk17passed on Java 21, including the new regression. I ran the compiler and Surefire goals directly because an existing Checkstyle violation inissues/Issue3156.java:114blocks that module's normal test lifecycle.中文说明
记录类型的构造参数包含列表时,写入端可能先写入类型标记。原来的读取逻辑直接尝试读取数组,导致空列表和单元素列表都可能反序列化失败。修复将带标记的列表交给该字段已有的读取器处理,沿用声明的泛型和读取配置。
本地通过了 149 个 core 相关测试、12 个 JDK 17 模块测试和 8 个 Dubbo 集成及解码对照用例。JDK 17 模块的常规生命周期被已有的 Checkstyle 问题阻断,测试通过独立的编译及 Surefire 目标执行。