Repository navigation
Conversation
…ueCheckStrategy is ALWAYS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3390.
For update mappings into an existing mutable collection/map,
ExistingInstanceSetterWrapperForCollectionsAndMapscurrently emits the null-handlingelsebranch only when the null-value check strategy is notALWAYS. That incorrectly couples whether a source null check is generated to whether the configured null-value property action should run. WithNullValueCheckStrategy.ALWAYS, a null source collection therefore leaves a non-null target collection unchanged instead of applying the defaultSET_TO_NULLbehavior.This change makes the
elsebranch depend only on the null-value property mapping strategy: it is emitted forSET_TO_NULL,SET_TO_DEFAULT, andCLEAR, and remains omitted forIGNORE.Validation:
Issue3390Testpasses across MapStruct's two processor compiler variantsmvn -B -o -pl processor -am verify -DskipTestspassesWhy this is worth doing
#3390 is a reproducible update-mapping correctness bug, not a cosmetic or defensive edge case. The generated mapper silently preserves stale target collection data when the source value is null and
NullValueCheckStrategy.ALWAYSis enabled, even though the default update property strategy isSET_TO_NULL. The maintainer previously confirmed that this is a separate bug from #2843 with a different fix. The production change is one predicate in the wrapper that owns this exact generated-code decision, with a small regression fixture reproducing the user's configuration.