Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeanDeserializerModifier::updateBuilder shall work for immutable beans too (#4356) #4357

Open
wants to merge 2 commits into
base: 2.17
Choose a base branch
from

Conversation

herkrath
Copy link
Contributor

@herkrath herkrath commented Feb 1, 2024

The promised UTs and possible fix for #4356

@cowtowncoder
Copy link
Member

Ahh. Ok, also realized what "immutable" specifically means: properties being passed via Creator method. Makes sense, but somehow was thinking of something Lombok- or builder-style ones.

@@ -551,6 +551,14 @@ public void resolve(DeserializationContext ctxt) throws JsonMappingException
}
SettableBeanProperty newProp = prop.withValueDeserializer(deser);
_replaceProperty(_beanProperties, creatorProps, prop, newProp);
} else if (creatorProps != null) {
for (int i = 0, len = creatorProps.length; i < len; ++i) {
Copy link
Member

Choose a reason for hiding this comment

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

This feels wrong, as in it should not be necessary. But I'll need to spend some time figuring out why creator property in question was not updated.

Looking bit further ahead, commented out code-section at line 687 might be what is needed, and/or indicates there is a problem.

Copy link
Member

Choose a reason for hiding this comment

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

Nope, that won't help as apparently property has value deserializer but somehow creatorProps has not been properly updated earlier.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I guess creatorProps returned by [Std]ValueInstantiator has not been synced with changes made via updateBuilder(). So that is legit problem to resolve, just not sure where it should be done.

@cowtowncoder
Copy link
Member

Merged test from here to under .../failing/BeanDeserializerModifier4356Test.java so at least that is used.

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.

None yet

3 participants