Skip to content

#1797 Use EnumSet.noneOf when creating a new instance of EnumSet#1806

Merged
filiphr merged 1 commit into
mapstruct:masterfrom
filiphr:1797
May 5, 2019
Merged

#1797 Use EnumSet.noneOf when creating a new instance of EnumSet#1806
filiphr merged 1 commit into
mapstruct:masterfrom
filiphr:1797

Conversation

@filiphr

@filiphr filiphr commented May 3, 2019

Copy link
Copy Markdown
Member

Fixes #1797

@sjaakd

sjaakd commented May 4, 2019 via email

Copy link
Copy Markdown
Contributor

@filiphr

filiphr commented May 4, 2019

Copy link
Copy Markdown
Member Author

From the top of my head.. isn't there a list of interfaces and respective implementations in Typefactory?

Yes, there is an implementationType for a certain Type. However, the EnumSet does not have an implementation type since it is a class. We then do:

    new
        <#if resultType.implementationType??>
            <@includeModel object=resultType.implementationType/><#if ext.useSizeIfPossible?? && ext.useSizeIfPossible && canUseSize>( <@sizeForCreation /> )<#else>()</#if>
        <#else>
            <@includeModel object=resultType/>()</#if>
        </#if>

@filiphr

filiphr commented May 4, 2019

Copy link
Copy Markdown
Member Author

@chris922 if you are OK with the PR I will merge it. No need to wait for @sjaakd I think :)

@sjaakd

sjaakd commented May 4, 2019 via email

Copy link
Copy Markdown
Contributor

@chris922 chris922 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.

Yes, just go on. Thanks for the fix!

@filiphr filiphr merged commit 1415e32 into mapstruct:master May 5, 2019
@filiphr filiphr deleted the 1797 branch May 5, 2019 10:42
@filiphr

filiphr commented May 5, 2019

Copy link
Copy Markdown
Member Author

Thanks for the review @chris922

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.

[REGRESSION] Make MapStruct generate compilable mapping code for attributes of type EnumSet

3 participants