-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[java] Fix #4224 MissingStaticMethodInNonInstantiatableClass: Exclude lombok's UtilityClass #4228
Conversation
Generated by 🚫 Danger |
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.
Thanks!
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.
Sorry, need to revise my review: Now any class that is annotated with UtilityClass is flagged. However, this is wrong. Only classes that don't have methods should be flagged.
E.g. if you add a method in your test class, then the rule should not be triggered anymore. It doesn't matter, whether the method is static or not since the UtilityClass annotation makes all methods static.
Maybe we also need to look at the visibility of the methods - since if all methods are private, then they can't be called as well and the class remains unusable.
Thanks, I will recheck my commit |
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.
Thanks!
Describe the PR
This PR excludes lombok's UtilityClass which create a private method which throw a exception but PMD treats it as a false negative.
Related issues
Ready?
./mvnw clean verify
passes (checked automatically by github actions)