Skip to content

[685] Ensure the value type of a container being deserialized uses th…#686

Merged
jamezp merged 2 commits intoeclipse-ee4j:masterfrom
jamezp:issue685
Mar 16, 2026
Merged

[685] Ensure the value type of a container being deserialized uses th…#686
jamezp merged 2 commits intoeclipse-ee4j:masterfrom
jamezp:issue685

Conversation

@jamezp
Copy link
Copy Markdown
Member

@jamezp jamezp commented Oct 15, 2025

…e value types class model for custom deserialization.

resolves #685

…e value types class model for custom deserialization. Do the same for serialization.

Signed-off-by: James R. Perkins <jperkins@ibm.com>
…ue. Added tests for wildcards on map keys and values, lists and optional.

Signed-off-by: James R. Perkins <jperkins@ibm.com>
final MapContainer container = new MapContainer(Map.of(
"key1", new TestImpl("value1"),
"key2", new TestImpl("value2")
), Map.of("qKey1", "value1", "qKey2", "value2"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
), Map.of("qKey1", "value1", "qKey2", "value2"),
), Map.of("qKey1", new TestImpl("value1"), "qKey2", new TestImpl("value2")),

Question: I understand at runtime the deserializer would not be able to know it would have to use a specific @JsonbTypeDeserializer when a Wildcard generic type is used because it would not know the expected type.

However, I might expect a @JsonbTypeSerializer to honor the incoming type and still perform serialization even if the underlying property had a wildcard type.

Not necessary for this PR, but maybe something we should look to improve in the future.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. We could definitely do a follow up on that.

@jamezp jamezp merged commit 3711af5 into eclipse-ee4j:master Mar 16, 2026
4 checks passed
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.

@JsonbTypeDeserializer and @JsonbTypeSerializer annotations not recognized for types used in container elements/values

3 participants