Skip to content

#2021 Generate compilable code when Decorator is nested within the Mapper - #2040

Merged
filiphr merged 1 commit into
mapstruct:masterfrom
filiphr:2021
Apr 5, 2020
Merged

#2021 Generate compilable code when Decorator is nested within the Mapper#2040
filiphr merged 1 commit into
mapstruct:masterfrom
filiphr:2021

Conversation

@filiphr

@filiphr filiphr commented Mar 7, 2020

Copy link
Copy Markdown
Member

We need to treat the import of the decoratorType specially when it is nested.
Calling addIfImportRequired is not the most correct approach since it would
lead to checking if the type is to be imported and that would be false
since the Decorator is a nested class within the Mapper.
However, when generating the Decorator this is not needed, because the Decorator is a top level class itself

In a nutshell creating the Decorator should have its own ProcessorContext, but it doesn't

Fixes #2021

This was a tricky one. It was affected by the fix for #1460 and #1576

…in the Mapper

We need to treat the import of the decoratorType specially when it is nested.
Calling addIfImportRequired is not the most correct approach since it would
lead to checking if the type is to be imported and that would be false
since the Decorator is a nested class within the Mapper.
However, when generating the Decorator this is not needed, because the Decorator is a top level class itself

In a nutshell creating the Decorator should have its own ProcessorContext, but it doesn't
@filiphr
filiphr requested a review from sjaakd March 7, 2020 17:18
@filiphr
filiphr merged commit 4f76208 into mapstruct:master Apr 5, 2020
@filiphr
filiphr deleted the 2021 branch April 5, 2020 12:09
@filiphr

filiphr commented Apr 5, 2020

Copy link
Copy Markdown
Member Author

Thanks for the review @sjaakd

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.

Wrong decorator class name used when Decorator class is nested inside mapper interface

2 participants