Annotation Type NonNullApi

  • @Target({PACKAGE,TYPE})
    public @interface NonNullApi
    Sets the convention to not null parameters and return values on a package level (Non-null except locals). It is used everywhere since it is a common convention and implied by tools like NullAway. However, we need to formally define it in the API so Kotlin can infer the nullability correctly.

    This uses the @TypeQualifierDefault from JSR305, which is also recognized by Kotlin. Unfortunately Kotlin does not support the @DefaultQualifiers annotation from the checker framework. For best tooling support we annotate the packages with both annotations.

    Jens Wilke
    See Also:
    , , , ,