Skip to content

@Condition applied on wrong source parameter while mapping #4037

Description

@altaiezior

Expected behavior

@Condition method should be correctly applied on correct source parameters when we are using nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS

Actual behavior

When we have the mapping mapping with 2 source parameters, for eg:

@Mapping(target = "browserId", source = "requestBean.deviceInfo.browserId")
public abstract AudienceProfileRequest map(RequestBean requestBean, String slotId);

If we are mapping some Integer source field from RequestBean to AudienceProfileRequest then the condition is applied on slotId which is not expected. Following is the snippet of the generated code:

Integer browserId = requestBeanDeviceInfoBrowserId( requestBean );
if ( prechecksSupport.isNotBlank( slotId ) ) {
    audienceProfileRequest.browserId( browserId );
}

Steps to reproduce the problem

https://github.com/altaiezior/mapstruct-issues/tree/master/issue-4037

MapStruct Version

MapStruct 1.5.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions