The basic problem now is: Which annotations should I use to get the same checks within Eclipse and Findbugs?
If I want to rely on the @ParametersAreNonNullByDefault annotation, for Findbugs I have to rely on the 2 other annotations for indicating that something may be null as well: I would need to annotate methods which may return null with @CheckForNull and parameters which may be null with @Nullable (due to the @ParametersAreNonNullByDefault annotation)
Unfortunately I can configure Eclipse only to understand one(!) annotation for a parameter/return value which may be null (so either @CheckForNull or @Nullable is ignored by Eclipse).
To be compatible with Eclipse and Findbugs I would have to restrict myself to the following 2 annotations:
That way I would have to annotate methods with @CheckForNull whose return value should be checked for null and @NonNull for all parameters which are not supposed to be null (which is most of the parameters in a good API).
The drawback is that this is quite verbose!
Is there any way to use the @ParametersAreNonNullByDefault and still be compatible with Eclipse? A switch in Findbugs would be good to treat @Nullable exactly like @CheckForNull (in case it is set on a method).
Now tracked in https://github.com/spotbugs/spotbugs/issues/471
Last edit: Konrad Windszus 2017-10-23