IntentionallyWithoutEquals

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

Acknowledges that the annotated stateful class deliberately uses identity equality.

The library-api-watchdog compiler plugin warns about publicly visible stateful classes - classes with at least one property backed by a field - that neither declare nor inherit equals, because two instances holding the same meaningful state otherwise compare as different values. Apply this annotation to suppress the warning when identity equality is intended.

See the check documentation for rationale and examples.

Parameters

reason

why the class deliberately has no equals implementation.

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