IntentionallyInconsistentParameterOrder

annotation class IntentionallyInconsistentParameterOrder(val reason: ExemptionReason = ExemptionReason.OTHER, val description: String = "")(source)

Acknowledges that the annotated function or constructor deliberately orders its parameters differently from its other overloads.

The library-api-watchdog compiler plugin warns about publicly visible overloads that declare the same parameter names in a different relative order, because users transfer their expectations between overloads: an inconsistent order of same-named parameters invites silently swapped arguments. Apply this annotation to suppress the warning when the differing order is intended. The annotated declaration is also no longer used as an ordering reference for other overloads.

See the check documentation for rationale and examples.

Parameters

reason

why the differing parameter order is intended.

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