Skip to content

Add @MethodsReturnNonnullByDefault #548

Closed

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".

Activity

  1. self-assigned this
    on Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementpriority: normal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions