Skip to content

Retain replacement builders in non-vanilla array deserialization - #6368

Merged
cowtowncoder merged 5 commits into
FasterXML:3.xfrom
wozhenbang2004:fix/array-builder-return-values
Nov 2, 2026
Merged

cowtowncoder merged 5 commits into
FasterXML:3.xfrom
wozhenbang2004:fix/array-builder-return-values

Conversation

@wozhenbang2004

@wozhenbang2004 wozhenbang2004 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6363.

BeanAsArrayBuilderDeserializer._deserializeNonVanilla discards the result of deserializeSetAndReturn, so immutable builder methods lose their updates. Preserve each returned builder, as the vanilla and property-based paths already do.

Adds regression coverage for all properties visible in an active view, a filtered property, and view-annotated builders without an active view. On unchanged production code all three tests fail with zero-valued fields; after the one-line fix the fork's full build matrix passes on Java 17 (Ubuntu and Windows), 21 and 25.


Summary by Gitar

  • Object Id handling:
    • Null Object Id now returns the current instance in ObjectIdValueProperty instead of null, so builders are not lost

This will update automatically on new commits.

@cowtowncoder cowtowncoder added cla-needed PR needed, see https://github.com/FasterXML/jackson/blob/main/CONTRIBUTING.md#paperwork cla-received PR already covered by CLA (optional label) 3.3 and removed cla-needed PR needed, see https://github.com/FasterXML/jackson/blob/main/CONTRIBUTING.md#paperwork labels Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 82.84% 📈 +0.000%
Branches branches 76.91% 📈 +0.000%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder added this to the 3.3.0 milestone Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 82.83% 📉 -0.010%
Branches branches 76.89% 📉 -0.020%

Coverage data generated from JaCoCo test results

`deserializeSetAndReturn()` returned `null` for a JSON null id, which
lost the builder now that array-shape builder deserialization retains
the return value. Add Object Id tests, use `DatabindTestUtil`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Retaining replacement builders and the current instance for null IDs changes deserialization state, potentially changing field values for immutable builders.

Preserves replacement builders in BeanAsArrayBuilderDeserializer._deserializeNonVanilla by keeping the result of deserializeSetAndReturn, so immutable builder updates are no longer lost. Also returns the current instance for null Object Ids in ObjectIdValueProperty, with regression tests for active views, filtered properties, and view-annotated builders. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@cowtowncoder
cowtowncoder merged commit 50471d9 into FasterXML:3.x Nov 2, 2026
5 checks passed
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 82.84% 📈 +0.000%
Branches branches 76.91% 📈 +0.000%

Coverage data generated from JaCoCo test results

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

Labels

3.3 cla-received PR already covered by CLA (optional label)

Projects

None yet

2 participants