Community
Participate
Working Groups
SpotBugs (the successor to Findbugs) does not have a single "NonNullByDefault" annotation. Rather it provides several different annotations that set defaults for a given type (or catch all) and take an annotation to configure if they are Nullable or nonNull etc. e.g. DefaultAnnotation DefaultAnnotationForFields DefaultAnnotationForMethods DefaultAnnotationForParameters This is a request to support the Eclipse compiler null check to be more flexible for the defaults. Even without support for these Findbugs annotations the NonNullByDefault is mostly useless if paramters are going to be Nullable, yet return values are never null. re: https://javadoc.io/doc/com.github.spotbugs/spotbugs-annotations/3.1.1
(In reply to James Nord from comment #0) > DefaultAnnotation > DefaultAnnotationForFields > DefaultAnnotationForMethods > DefaultAnnotationForParameters > What I don't like about these annotations: - They are not only for NonNull - We'd have to hardcode the names because of the different targets. OTOH, I've just implemented bug 518839, which is similar so implementing this wouldn't be hard. > Even without support for these Findbugs annotations the NonNullByDefault is > mostly useless if paramters are going to be Nullable, yet return values are > never null. With the changes for bug 518839, you can in 4.8 also define multiple NonNullByDefault-like annnotations with DefaultLocation[] value (with different defaults) when using declaration null annotations and use multiple different ones at the same target.
Maybe @Andrey has an idea how to bridge this gap :) Maybe we can open up for the SpotBugs Eclipse plugin to interpret these default annotations on JDT's behalf (which would be strictly an IDE-only solution, since the batch compiler is not pluggable).
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.