Skip to content

#2101 inherited properties need to be analysed against redefined properties when inheriting mappings#2103

Merged
sjaakd merged 5 commits into
mapstruct:masterfrom
sjaakd:2101
Jul 4, 2020
Merged

#2101 inherited properties need to be analysed against redefined properties when inheriting mappings#2103
sjaakd merged 5 commits into
mapstruct:masterfrom
sjaakd:2101

Conversation

@sjaakd

@sjaakd sjaakd commented May 21, 2020

Copy link
Copy Markdown
Contributor

Possibly need to add some unit test.. Although quite some testcases failed when I implemented it wrong 😄

@sjaakd

sjaakd commented May 21, 2020

Copy link
Copy Markdown
Contributor Author

@filiphr .. shall we add the reproducer anyway..? Always good to have additional UT.

@filiphr

filiphr commented May 21, 2020

Copy link
Copy Markdown
Member

This is a tricky one. Basically what happens it the following mapper:

@Mapper
public interface Issue2101Mapper {
    @Mapping(target = "value1", source = "codeValue1")
    @Mapping(target = "value2", source = "codeValue2")
    Source map(Target target);

    //@InheritInverseConfiguration
    @Mapping(target = "codeValue1", source = "value1")
    @Mapping(target = "codeValue2", source = "value2")
    @Mapping(target = "codeValue1.code", constant = "c1")
    @Mapping(target = "codeValue1.value", source = "value1")
    @Mapping(target = "codeValue2.code", constant = "c2")
    @Mapping(target = "codeValue2.value", source = "value2")
    Target map(Source source);
}

Perhaps when doing the inverse inheritance if there is a target mapping which has the reversed segment we should not use it.

@sjaakd sjaakd closed this Jun 14, 2020
@sjaakd sjaakd deleted the 2101 branch June 14, 2020 11:56
@sjaakd sjaakd restored the 2101 branch July 4, 2020 12:10
@sjaakd sjaakd reopened this Jul 4, 2020
@sjaakd sjaakd requested a review from filiphr July 4, 2020 14:05
@sjaakd sjaakd changed the title #2101 reproducer #2101 inherited properties need to be analysed against redefined properties when inheriting mappings Jul 4, 2020

@filiphr filiphr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have only one comment

@filiphr filiphr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants