IntentionallyWithoutJvmOverloads

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

Acknowledges that the annotated function or constructor deliberately keeps its default parameter values invisible to Java callers.

The library-api-watchdog compiler plugin warns, in JVM compilations, about publicly visible functions and constructors that declare default parameter values without @JvmOverloads: only the full signature is compiled, so for Java callers the defaults don't exist and every argument must be spelled out. Prefer @JvmOverloads, which additionally compiles the overloads that omit defaulted parameters from the right, and apply this annotation to suppress the warning when serving Java callers the full signature only is intended (for example, when the defaulted parameters make no sense without Kotlin's named arguments).

See the check documentation for rationale and examples.

Parameters

reason

why the defaults deliberately stay invisible to Java callers.

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