Skip to content

#2278 inherited property ignored entirely due to ignore on nested level#2332

Merged
sjaakd merged 1 commit intomapstruct:masterfrom
sjaakd:2278
Jan 23, 2021
Merged

#2278 inherited property ignored entirely due to ignore on nested level#2332
sjaakd merged 1 commit intomapstruct:masterfrom
sjaakd:2278

Conversation

@sjaakd
Copy link
Copy Markdown
Contributor

@sjaakd sjaakd commented Jan 16, 2021

No description provided.

@sjaakd sjaakd requested a review from filiphr January 16, 2021 18:30
@sjaakd sjaakd changed the title #2278 inherited property ignored due to ignore on nested level #2278 inherited property ignored entirely due to ignore on nested level Jan 16, 2021
@filiphr
Copy link
Copy Markdown
Member

filiphr commented Jan 16, 2021

The fix looks OK. However, I think that it fixes only the specific case in #2278.

What if instead of ignoring it we use a constant?

I also have a feeling that #2318 should be fixed in the same time as #2278 as those are more or less similar.

@sjaakd
Copy link
Copy Markdown
Contributor Author

sjaakd commented Jan 17, 2021

What if instead of ignoring it we use a constant?

I thought about that as well. It comes down on how you see merging of properties. I'll check what the "normal" behavior is (so how we merge properties).

@sjaakd
Copy link
Copy Markdown
Contributor Author

sjaakd commented Jan 17, 2021

I guess.. in the end I flipped just 2 arguments (not properly done when refactoring) and needed to add a null check for when the source is absent (I thought about making it equal to the target but I remember somehow that's not always right, for reversing you need to specify them both, but in case of ignoreByDefault you activate individual mappings)...

I also added a reference mapper.. Just to show how it is suppose to work in the normal forward case. And I copied the testcase from the other issue.. To show that works as well.

And a testcase (MapperB) to show that you can actually redefine on a nested level "forgetting" all on deeper nested levels in the same branch.

@sjaakd
Copy link
Copy Markdown
Contributor Author

sjaakd commented Jan 17, 2021

Replaces #2321

@filiphr
Copy link
Copy Markdown
Member

filiphr commented Jan 18, 2021

Thanks for doing this @sjaakd, the fix looks really simple.

One last things. Can we also add the test case from #2322? I think that it is the same problem and that this fixes that as well.

@sjaakd
Copy link
Copy Markdown
Contributor Author

sjaakd commented Jan 20, 2021

One last things. Can we also add the test case from #2322? I think that it is the same problem and that this fixes that as well.

I'll have a look..

@sjaakd
Copy link
Copy Markdown
Contributor Author

sjaakd commented Jan 22, 2021

One last things. Can we also add the test case from #2322? I think that it is the same problem and that this fixes that as well.

I created a test. But it still fails. The current fix is fixing stacking of inherited(reverse) properties. This seems to be a problem in our beanmapping (the reproducer does not call the logic that is fixed).

Let treat that as a separate issue. I can push the reproducer after merging this one. Perhaps you can have a look as well?

@filiphr
Copy link
Copy Markdown
Member

filiphr commented Jan 22, 2021

Sounds good. Thanks for trying it out. Go ahead and merge this. I'll take a look at the reproducer and try to find a fix

@sjaakd sjaakd merged commit 8478a54 into mapstruct:master Jan 23, 2021
@sjaakd
Copy link
Copy Markdown
Contributor Author

sjaakd commented Jan 23, 2021

Sounds good. Thanks for trying it out. Go ahead and merge this. I'll take a look at the reproducer and try to find a fix

See #2341

I'm not sure whether I've got time for it today.. It seems to be located somewhere in the BeanMapping - nested mapping handling.

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