-
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
Fix NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE does not consider null val… #2709
Conversation
Thanks a lot for the contribution @mdouaihy
I think it would be good adding unit tests for these too |
spotbugs-tests/src/test/java/edu/umd/cs/findbugs/nullness/IssueRequireNotNullTest.java
Outdated
Show resolved
Hide resolved
spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindNullDeref.java
Outdated
Show resolved
Hide resolved
spotbugsTestCases/src/java/nullnessAnnotations/TestNonNull7.java
Outdated
Show resolved
Hide resolved
Leaving this one out of 4.8.2 release as a few other items need looked at here still. |
Hi, this would be great to get merged and released! Any chance you can take a look at the requested changes @mdouaihy ? |
hi @robinjhector, I am looking into applying the requested changes. I am just having a ClassNotFound when adding the tests to cover the changes and I am trying to figure out why. |
In this case, it can be a good idea to convert the PR to draft. |
@mdouaihy Can you look at last concern here? Would like to include this in next release in 2 weeks. |
@hazendaz, due to some personal problems, I was not able to fix the issues before. I'll fix that during the coming couple of days. |
@JuditKnoll Any chance you could pick this up and do the necessary items you were wanting adjusted? Seems @mdouaihy Has some personal issues to deal with so not available to make this go. If its not too difficult, we could get this included in upcoming release hopefully this weekend :) |
There is already a unit test for |
@JuditKnoll would you know if the missing class error is because of the way we are running unit tests? |
Yes, it seems really similar. P.S. I'm still looking into whether |
I addressed the issues mentioned in the reviews. However, when running the test separately from the IDE, the following is written to the std err*:
Locally I added these to the *When running from terminal using gradle, these missing classes messages does not appear in the output, the build is successful. IMO if there are missing classes, the tests should fail. |
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.
This LGTM, thank you!
This fixes the issue reported in
NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE is raised when using Objects.requireNonNull whereas it's not raised when using Guava Preconditions.checkNotNull.
Make sure these boxes are checked before submitting your PR -- thank you!
CHANGELOG.md
if you have changed SpotBugs code