Skip to content

Provide guidance for additional null check #8173

@jack-berg

Description

@jack-berg

We need to get consistent about whether or not we do this. We rely on javax.annotation.Nullable annotation, the assumption that params and returns are non-null unless otherwise specified, leveraging the net.ltgt.nullaway error prone plugin to validate at build time. Of course, at runtime there is no guarantee that callers adhere to these annotations, and so we have code like this which checks for null despite the params being non-null according to the annotations.

We need to be consistent about:

  • When and why do we add additional null checks
  • Where do we do this (i.e. in interface default methods or in the actual implementation)
  • What is the behavior when the null annotation is violated (throw or noop)

Let's hold off here until we get some repo level guidance on this. ConfigProperties, the env var / sys property analog of DeclarativeConfigProperties, has the exact same method and does not do this null check.

Originally posted by @jack-berg in #8079

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions