-
Notifications
You must be signed in to change notification settings - Fork 15
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
chore: PMD rule for @Nonnull
/ @Nullable
on fields of public types
#369
Conversation
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.
I'm a bit unsure about this one. Those are a lot of warnings, and adding @Nonnull
everywhere is kinda annoying / code bloat.
I guess the unwritten rule should be: If it's nullable always annotate it as such. Otherwise it will be assumed to be nonnull.
Unfortunately we can't make a PMD rule for that I guess. Would have to be some static code style analysis that goes through the AST and tries to figure out if null
can potentially be assigned to a field not annotated as such..
<property name="xpath"> | ||
<value> | ||
<![CDATA[ | ||
//ClassOrInterfaceDeclaration[@Public=true()]/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration[ |
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.
I'd argue the issue is also relevant for non-public classes..
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.
There is an IntelliJ warning Suggest @Nullable annotation
that we could enable and that catches the NPE in #368
lombok says adding |
Follow-up #368
Context: mapping `int priority` to `severity`