-
Notifications
You must be signed in to change notification settings - Fork 331
-
Notifications
You must be signed in to change notification settings - Fork 331
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
Spotbugs: CheckForNull does not override ParametersAreNonnullByDefault #8974
Comments
@bobjacobsen @pabender The JMRI documentation says that |
I have done additional testing of this class:
The annotation The annotation So my testing shows that The comment in the JMRI documentation about spotbugs which tells that |
A bit short of time right now, but see java/src/apps/FindBugsCheck.java
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. JMRI is governed by a small group of maintainers which means not all opened issues may receive direct feedback. |
This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the maintainers may elect to reopen this issue at a later date if deemed necessary. |
While trying to understand the problem in #6510 (comment), I found that
@CheckForNull
for a parameter does not overrides@ParametersAreNonnullByDefault
for the class.This means that Spotbugs will give an error on
new ClassA().testA(null);
but not onnew ClassA().testB(null);
, since the later is annotated with@Nullable
.The JMRI documentation about Spotbugs say that
@CheckForNull
can be used for parameters, but that's not true if the class is annotated with@ParametersAreNonnullByDefault
.The JMRI documentation says that
@Nullable
shouldn't be used and that@CheckForNull
should be used instead. But if the class is annotated with@ParametersAreNonnullByDefault
,@Nullable
works but@CheckForNull
doesn't.My branch nonnull_4_test has a working example of the above.
The text was updated successfully, but these errors were encountered: