-
Notifications
You must be signed in to change notification settings - Fork 80
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
Improve handling of interfaces in LombokValueToRecord #452
Improve handling of interfaces in LombokValueToRecord #452
Conversation
d0321f0
to
84b7b1f
Compare
84b7b1f
to
73a3101
Compare
&& !J.ClassDeclaration.Kind.Type.Record.equals(classDeclaration.getKind()) | ||
&& classDeclaration.getAllAnnotations().stream() | ||
.allMatch(ann -> LOMBOK_VALUE_MATCHER.matches(ann) && (ann.getArguments() == null || ann.getArguments().isEmpty())) | ||
&& !allAnnotations.isEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary because allMatch
will return true
on an empty set. The recipe would then convert an empty interface to a record. Not sure why that did not cause issue before.
this also considers methods inherited by super-interfaces.
73a3101
to
c5e8a58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice extension of what can now be converted for this recipe; thanks a lot @holgpar !
Hope that helps you convert more cases there to records.
What's changed?
Before, no conversion was done when any interface was implemented.
Now, it is checked that the interface declares a method which would "conflict" with the conversion.
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
@knutwannheden
Have you considered any alternatives or workarounds?
Any additional context
Checklist