Skip to content

Implement overloaded condition method selection based on parameter count#4055

Open
daberni wants to merge 1 commit into
mapstruct:mainfrom
daberni:feature/overloaded-condition-methods
Open

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

Conversation

@daberni
Copy link
Copy Markdown

@daberni daberni commented May 11, 2026

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
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