Search⌘ K
AI Features

Meta Annotations

Learn about Kotlin's meta-annotations, which annotate other annotations, and understand how to use Target, Retention, Repeatable, and MustBeDocumented. This lesson helps you apply these concepts with examples such as annotating constructors and list literals, improving your control over annotations and their documentation.

Annotations that are used to annotate other annotations are known as meta-annotations. There are four key meta-annotations from Kotlin stdlib:

  • Target: It indicates the kinds of code elements that are possible targets of an annotation. As arguments, it accepts AnnotationTarget enum values, ...