-
Notifications
You must be signed in to change notification settings - Fork 578
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
Possible Nullpointer dereference - False positive #456
Comments
Why do you need But yea, we could consider that method in the NPE analysis similar to an "assert". |
Because with Object.requireNonNull I can add a specific error message like Just like |
TL;DR Using
AFAICT it's not similar. When I do After an
then I hope that |
plus one, we have this problem in findbugs, and it's obnoxious. If I explicitly throw an NPE, whether it's by assert wise, IIRC you have to enable something in the JVM in order for those to actually trigger in a production run. |
you can use |
Sure, but this is still a bug. Is anyone working on this, or is there any place for someone else to start? |
There is a quote from Bloch's 'Effective Java' (3rd Edition) - Item 49: Check parameters for validity:
So this issue is definitely a bug and it must be resolved. |
Same problem here. |
Same here. Now I've got to manually suppress this warning for the whole method, unfortunately. |
Crap, just ran into it again in a new situation when I noticed I already added myself on the list here. I would +1 myself if I could :P |
I think this is a duplicate of #651 |
This issue is older than #651, so this can't be the duplicate. |
@stealthrabbi I mean that #651 is an issue that is actually considered as valid by the spotbugs team, contrary to this one which has been nicely ignored for 3 years :) hence, to focus effort of everybody interested in this to happen, we should close this one and all go complain on the other one :) |
fixed by #2709 |
File[] content = new File(".").listFiles();
Objects.requireNonNull(content);
results in "Possible Nullpointer dereference due to return value of called method" for the second line.
The text was updated successfully, but these errors were encountered: