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

Closed
wants to merge 3 commits into 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.

Copy link
Member

Choose a reason for hiding this comment

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

Now that #4515 is completed, can rule out problem with linkage. I do think that BeanDeserializerBuilder needs access to the property-based creator, and that the issue here really is that CreatorProperty within that Creator does not properly updated when property in _properties is updated.

So the question is then how to pass it along, update properly.

@cowtowncoder
Copy link
Member

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

@cowtowncoder cowtowncoder changed the base branch from 2.17 to 2.18 June 1, 2024 00:55
@cowtowncoder
Copy link
Member

Fixed via #4556 for inclusion in 2.18.0.

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.

3 participants