Repository navigation
Retain polymorphic key and value types for POJO-shaped Map.Entry - #6371
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 VerificationRules No rules evaluated Functional validation Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
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