Annotation Type NonNullApi

  • @Target({PACKAGE,TYPE})
    public @interface NonNullApi
    Sets the convention to non null parameters and return values on a package level. We basically use that everywhere since its 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. An alternative would be to annotate @NonNull instead of having the default convention Non-null except locals (NNEL).

    Jens Wilke
    See Also:
    , , , ,