-
Notifications
You must be signed in to change notification settings - Fork 186
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
Unexpected warning about dereferencing without a null check #54
Comments
Surely FindBugs does not track whether method is pure (does not depend on external state and does not change it) or not. How we can know where two subsequent calls to
On the other hand probably we should not complain about |
Tagir, if you think it is more abusing, we should remove this method. Since this is a new API, I guess this is not used often yet. This was a personal hate to the File API in Java which is often inconsistent. |
Oh, I see. I simplified my original encounter down to the simple null check, but my original case was more like:
which satisfies the conditions in the javadoc of |
This project continues development in a new home: https://github.com/spotbugs/spotbugs/ Please do not open new issues here anymore! |
I figured a quick example repo would be the easiest way to describe the problem:
https://github.com/djeikyb/borken_findbugs
In short, I don't expect findbugs to complain about the call to
getFileName()
on the second line not being sufficiently null checked.In case it's useful, I included the build artifacts after running
mvn clean compile findbugs:findbugs
(class files, findbugs report),Used java 1.8 with findbugs 3.0.2, same results on linux and osx
The text was updated successfully, but these errors were encountered: