IntentionallyDataClass

@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class IntentionallyDataClass(val reason: ExemptionReason = ExemptionReason.OTHER, val description: String = "")(source)

Acknowledges that the annotated data class is deliberately part of the public API.

The library-api-watchdog compiler plugin warns about publicly visible data classes, because the generated copy and componentN functions and the constructor bake the exact property list into the compiled API: adding, removing, or reordering a property later breaks users. Apply this annotation to suppress the warning when the property list is an intended, stable part of the API contract.

See the check documentation for rationale and examples.

Parameters

reason

why the class is deliberately a data class.

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