I started using findbugs @Nonnull
and @CheckForNull
annotations on an existing Project, to prevent NPEs, and think it works quite nice.
I use @Nonnull
as default for return types and parameters and found already a few NPEs, just by adding the default values. Now I found a method similar to this:
@Nonnull
private Integer getInteger(String key) {
return Map.get(key);
}
And it does not produce a warning. I understand why this is the case, but how can I get around this? How do you work around this in your projects?
A solution that can be globally applied would be preferred, e.g. something like @ApplyCheckForNullToAllExternalCalls
.