Skip to content

Implement overloaded condition method selection based on parameter count#4055

Open
daberni wants to merge 2 commits into
mapstruct:mainfrom
daberni:feature/overloaded-condition-methods
Open

Implement overloaded condition method selection based on parameter count#4055
daberni wants to merge 2 commits into
mapstruct:mainfrom
daberni:feature/overloaded-condition-methods

Conversation

@daberni

@daberni daberni commented May 11, 2026

Copy link
Copy Markdown

This PR implements the fix for issue #3993 by adding logic to select the most specific overloaded condition method based on the number of bindable parameters.

Changes:

  • Modified PresenceCheckMethodResolver.java to include selectMostSpecificConditionMethod
  • Added regression test OverloadedConditionTest.java
  • Created test mapper OverloadedConditionMapper.java

The implementation allows overloaded condition methods by choosing the one with the most parameters that can be bound, avoiding ambiguity errors.

- Add selectMostSpecificConditionMethod to choose condition method with most bindable parameters
- Update getPresenceCheck and getPresenceCheckForSourceParameter to use new selection logic
- Add regression test OverloadedConditionTest to validate the fix for issue mapstruct#3993
@daberni daberni force-pushed the feature/overloaded-condition-methods branch from 0e3cb18 to 03df4c6 Compare May 31, 2026 21:04
@daberni daberni force-pushed the feature/overloaded-condition-methods branch from 0c7ac12 to 1c1e6dd Compare June 1, 2026 07:53
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.

1 participant