Skip to content

Resolve untyped values for POJO-shaped Map.Entry deserialization - #6370

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

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

Conversation

@wozhenbang2004

@wozhenbang2004 wozhenbang2004 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6366.

The POJO-shaped entry deserializer already treats a missing key type as Object, but passes null to value-deserializer lookup for a raw Map.Entry. Resolve the value type with containedTypeOrUnknown too.

Raw Map.Entry is now handled as Map.Entry<Object,Object> in all shapes. This also changes natural shape: MapEntryDeserializer no longer rejects raw types with "Missing generic type information", and resolves missing key and value types as Object. As a result, property-level @JsonFormat(shape = POJO) and @JsonFormat(shape = NATURAL) work on raw entries too.

Also corrects the parameter order of the POJOWrappedDeserializer copy constructor, which swapped the key and value type deserializers. This had no effect so far because both fields are always null.

Adds regression tests for raw entries with scalar and structured contents, a POJO mix-in, typed-value coercion, natural shape, both property-level formats and the constructor parameter order.

@cowtowncoder cowtowncoder added cla-received PR already covered by CLA (optional label) 3.3 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.85% 📈 +0.010%
Branches branches 76.92% 📈 +0.010%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder added this to the 3.3.0 milestone Nov 2, 2026
@cowtowncoder cowtowncoder changed the title Resolve untyped values for POJO-shaped Map.Entry deserialization Resolve untyped values for POJO-shaped Map.Entry deserialization Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.01% 📈 +0.000%
Branches branches 77.10% 📈 +0.000%

Coverage data generated from JaCoCo test results

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.01% 📈 +0.010%
Branches branches 77.10% 📈 +0.020%

Coverage data generated from JaCoCo test results

Remove the constructor check rejecting raw types in MapEntryDeserializer
and resolve missing key/value types as Object, so raw Map.Entry also works
in natural shape and with property-level @jsonformat.

Correct parameter order of POJOWrappedDeserializer copy constructor, which
swapped key and value type deserializers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.01% 📈 +0.010%
Branches branches 77.11% 📈 +0.030%

Coverage data generated from JaCoCo test results

@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Resolving raw Map.Entry key and value types as Object across POJO and natural shapes could change decoded values or accept inputs previously rejected.

Fixes raw Map.Entry deserialization in POJO shape by resolving value types with containedTypeOrUnknown, so raw entries are treated as Map.Entry<Object,Object> across shapes, and corrects the swapped key/value deserializer parameters in the POJOWrappedDeserializer copy constructor. Resolved the test style finding by switching the new test from a2q() to text blocks. No open issues found.

✅ 1 closed
✅ Quality: New test uses a2q() instead of the text blocks the project prefers

📄 src/test/java/tools/jackson/databind/format/RawMapEntryPOJO6366Test.java:30 📄 src/test/java/tools/jackson/databind/format/RawMapEntryPOJO6366Test.java:39 📄 src/test/java/tools/jackson/databind/format/RawMapEntryPOJO6366Test.java:49 📄 src/test/java/tools/jackson/databind/format/RawMapEntryPOJO6366Test.java:58 📄 src/test/java/tools/jackson/databind/format/RawMapEntryPOJO6366Test.java:67
The project's test guidelines say to prefer Java text blocks (""") over a2q(...) or backslash escaping. All five tests in the new RawMapEntryPOJO6366Test build their JSON with a2q. Switching to text blocks keeps the new test in line with the convention. Test behavior does not change.

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 14d2092 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.01% 📈 +0.010%
Branches branches 77.10% 📈 +0.020%

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

Development

Successfully merging this pull request may close these issues.

NullPointerException ("Null 'propertyType' passed") deserializing raw Map.Entry with a Shape.POJO config override

2 participants