Skip to content

Add @MethodsReturnNonnullByDefault #548

@Zabuzard

Description

@Zabuzard

Similar to #541 , we should take the next step and make our methods also return @Nonnull by default. Fortunately, this is fairly simple with a custom annotation:

@Nonnull
@TypeQualifierDefault({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MethodsReturnNonnullByDefault {
}

(credits go to Minecraft where I snacked this annotation from - kudos to Quinteger#4169 who raised awareness)

The annotation then goes into all package-info.java just like seen in #541 . In the same wave, we should go through the code base and eliminate all explicit @Nonnull, hurray 🙌


If there is an actual dependency introducing this type already, we should use it instead of "reinventing the wheel".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions