Skip to content

Conversation

@JacksonJang
Copy link
Contributor

@JacksonJang JacksonJang commented Nov 29, 2025

Before anything else, thank you for creating such an excellent library.
Whenever I work on the source, I learn a lot from the precision of the code.

issue: #4690
Previously, for record types using a property-based creator, creator.build could be invoked prematurely as soon as all constructor parameters were bound in the parser loop.
As a result, if a duplicate of a creator property appeared later in the JSON, the later value could not be applied, it was either ignored or caused an error ("No fallback setter/field defined for creator property"), since records have no mutable setters.

This PR adjusts the logic so that record types defer creator.build(...) until the end of the object, ensuring that duplicate properties correctly follow the "last value wins" behavior.

In additional, I added a POJO class case(testDuplicatePropertyClassDeserialization) to DuplicatePropertyDeserializationRecord4690Test.

Thank you for taking the time to review this, especially when you're busy.
Have a good day :)

@cowtowncoder
Copy link
Member

cowtowncoder commented Nov 30, 2025

Thank you @JacksonJang -- I guess optimization for eager construction when all Constructor parameters gotten is no longer possible. I'll see if I can remove that from POJO case as well.

NOTE: there are 2 other code paths to modify as well.

@cowtowncoder
Copy link
Member

@JacksonJang Yes, unifying case works for the first case you added. Second and third have some complexity, will tackle tomorrow, will first merge this fix. Thank you for submitting it!

@JacksonJang
Copy link
Contributor Author

Thanks for merging, much appreciated

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.

2 participants