Skip to content

mapstruct#3836 sealed interface create impl class with switch #3885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mildw428
Copy link

I've fixed it for bug number 3836.

I added sourceArgumentType to know the parameter type of the subclass.

Generates as a switch or if-else syntax according to isSealed().

If you have any issues, please advise.

#3836

@mildw428
Copy link
Author

In version 17, the switch statement needs a default return, resulting in an error. If anyone has any branching ideas based on the version, please let me know.

@filiphr
Copy link
Member

filiphr commented Jun 15, 2025

I'll need some time to go through this one @mildw428. I am not sure that we can always use the enhanced switch. We can only do that if the type is correctly sealed otherwise we need a fallback.

@mildw428
Copy link
Author

I'll need some time to go through this one @mildw428. I am not sure that we can always use the enhanced switch. We can only do that if the type is correctly sealed otherwise we need a fallback.

Thank you for reviewing my code.

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