Skip to content

Retain polymorphic key and value types for POJO-shaped Map.Entry - #6371

Merged
cowtowncoder merged 6 commits into
FasterXML:3.xfrom
wozhenbang2004:fix/map-entry-pojo-polymorphism
Nov 2, 2026
Merged

cowtowncoder merged 6 commits into
FasterXML:3.xfrom
wozhenbang2004:fix/map-entry-pojo-polymorphism

Conversation

@wozhenbang2004

Copy link
Copy Markdown
Contributor

POJO-shaped Map.Entry deserialization does not resolve type deserializers for its key or value. Valid JSON with @JsonTypeInfo therefore fails for abstract contents, although the natural entry shape handles the same polymorphic value. The POJO copy constructor also has its key/value TypeDeserializer parameters reversed.

Resolve both type handlers using the same existing-handler/configuration lookup as the natural path, and keep their positions consistent when copying the deserializer.

Five regressions cover polymorphic keys, values, both sides, property-level POJO shape and a natural-shape control. Four POJO cases fail on unchanged production code; the control passes. After the fix the full fork workflow passes on Java 17 (Ubuntu and Windows), 21 and 25: 7,617 tests, no failures or errors.

Regression control: https://github.com/wozhenbang2004/jackson-databind/actions/runs/41315899589
Passing build: https://github.com/wozhenbang2004/jackson-databind/actions/runs/41316319761

@cowtowncoder cowtowncoder added the cla-received PR already covered by CLA (optional label) label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.04% 📈 +0.040%
Branches branches 77.15% 📈 +0.060%

Coverage data generated from JaCoCo test results

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Retaining key and value type handlers for POJO-shaped Map.Entry changes polymorphic deserialization, which could instantiate unintended subtypes from input.

Retains polymorphic key and value type handlers for POJO-shaped Map.Entry deserialization, so @JsonTypeInfo contents now resolve the same way as the natural entry shape. The POJO copy constructor's key/value TypeDeserializer parameters are also corrected. 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

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.05% 📈 +0.040%
Branches branches 77.16% 📈 +0.050%

Coverage data generated from JaCoCo test results

@cowtowncoder
cowtowncoder merged commit 8bca052 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 83.06% 📈 +0.050%
Branches branches 77.22% 📈 +0.110%

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants