IntentionallyNullableBoolean

Acknowledges that the annotated declaration deliberately exposes a nullable Boolean in the public API.

The library-api-watchdog compiler plugin warns about public signatures - return types, property types, and parameter types, including their type arguments - that mention Boolean?, as well as Boolean? bounds on type parameters. A nullable Boolean models three states but names only two of them, so every use site has to know what null stands for, and three-state logic hides in two-branch ifs. Prefer an enum class naming all three states. Apply this annotation to suppress the warning when the nullable Boolean is an intended part of the API contract. On a function, a property, or a constructor it covers the whole signature. On a single parameter or type parameter it covers just that parameter. On a type usage (List<@IntentionallyNullableBoolean Boolean?>) it covers the annotated type and everything nested in it.

See the check documentation for rationale and examples.

Parameters

reason

why the declaration deliberately exposes a nullable Boolean.

description

free-form explanation of the exemption. May be empty only when reason explains the exemption on its own (ExemptionReason.FOR_BACKWARDS_COMPATIBILITY, ExemptionReason.API_DESIGN).

Properties

Link copied to clipboard
Link copied to clipboard