Skip to content

Fix JSONB decoding of typed lists in record constructors - #7980

Draft
wenwenwu999-maker wants to merge 1 commit into
alibaba:mainfrom
wenwenwu999-maker:fix/jsonb-typed-record-list
Draft

wenwenwu999-maker wants to merge 1 commit into
alibaba:mainfrom
wenwenwu999-maker:fix/jsonb-typed-record-list

Conversation

@wenwenwu999-maker

Copy link
Copy Markdown

What this fixes

A record with a List<Item> component fails to round-trip through JSONB when WriteClassName emits a type marker for a JDK immutable list. The constructor-argument reader calls startArray() while the cursor is still on BC_TYPED_ANY. Empty and single-element lists both reproduce the exception on main at 460d2e4. 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

  • 149 selected core tests passed (FieldReaderList*Test,JSONB*Test,List*Test).
  • 12 tests in test-jdk17 passed on Java 21, including the new regression. I ran the compiler and Surefire goals directly because an existing Checkstyle violation in issues/Issue3156.java:114 blocks that module's normal test lifecycle.
  • All 8 downstream Dubbo 3.3.7 integration and direct-decoder comparison cases passed with the patched snapshot. Four of those cases fail with 2.0.66.
中文说明

记录类型的构造参数包含列表时,写入端可能先写入类型标记。原来的读取逻辑直接尝试读取数组,导致空列表和单元素列表都可能反序列化失败。修复将带标记的列表交给该字段已有的读取器处理,沿用声明的泛型和读取配置。

本地通过了 149 个 core 相关测试、12 个 JDK 17 模块测试和 8 个 Dubbo 集成及解码对照用例。JDK 17 模块的常规生命周期被已有的 Checkstyle 问题阻断,测试通过独立的编译及 Surefire 目标执行。

@CLAassistant

CLAassistant commented Dec 2, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants