-
Notifications
You must be signed in to change notification settings - Fork 30
feature/spotbugs #150
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
feature/spotbugs #150
Conversation
| */ | ||
| @Nullable | ||
| public Class<?> getDerivedClass(@Nonnull final JsonObject jsonObject, @Nonnull final Class<?> parentClass) { | ||
| public Class<?> getDerivedClass(@Nonnull final JsonObject jsonObject, @Nullable final Class<?> parentClass) { |
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.
Probably off-topic but probably also doesn't hurt: if a parameter should be null ever (i.e. marked with Nonnull), then it might be a good practice to check that explicitly in the method (e.g. Objects.requireNonNull())
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.
yep, I'm planning to do a bulk pass for that as part of this static analysis effort. We didn't use to have any annotations not long ago...
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.
see the latest commits, I added a lot of defensive programming for nonnull annotations. Also corrected a few annotations that should've been Nullable instead
This comment has been minimized.
This comment has been minimized.
111d345 to
ab2ff30
Compare
fixes #148
related #149
This one is set to fail the build on infringements as we only have 60+ errors at this time.
It runs a light level of static analysis, (conditions structures, null checks, redundancy, etc...).
I'm providing examples of fixes to the team to get some early feedback.
I think the typo it caught in the defensive condition clearly demonstrates the value. It an honest mistake that's easy to make and easy to miss on pull requests that can have bad consequences and be hard to debug/find.