Skip to content

#4038 Use adder only for the matching collection property - #4116

Open
tanvir-ux wants to merge 1 commit into
mapstruct:mainfrom
tanvir-ux:issue-4038-adder-property-match
Open

#4038 Use adder only for the matching collection property#4116
tanvir-ux wants to merge 1 commit into
mapstruct:mainfrom
tanvir-ux:issue-4038-adder-property-match

Conversation

@tanvir-ux

Copy link
Copy Markdown

Fixes #4038.

With CollectionMappingStrategy.ADDER_PREFERRED, a single adder such as Lombok @Singular("addItem") was reused for every collection of the same element type (moreItems ended up calling addItem).

getAdderForType now requires the adder name to match the property (singular form first, then the exact name). An unmatched adder is not used, so the property keeps its setter.

Processor tests: Issue4038Test, AdderTest.

A single type-compatible adder was applied to every collection of that
element type. Match adder names to the property (singular first, then
exact) so other lists keep their own setters.
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.

Mapstruct mapping incorrect properties when one of them is supporting adder

1 participant