Browse topics
JVM & Interop
Annotations
Declare and use annotations, targets and retention in Kotlin.
kotlin annotationsAnnotation Declaration in KotlinAnnotations add metadata to classes, functions and properties. A Kotlin example with source code and sample output.kotlin annotationsAnnotation Usage in KotlinApply annotations before declaration using @AnnotationName. A Kotlin example with source code and sample output.kotlin annotationsAnnotation Targets in KotlinUse @Target to specify where annotation can be applied. A Kotlin example with source code and sample output.kotlin annotationsRetention and Inheritance in KotlinRetention policy controls whether annotation exists at runtime. A Kotlin example with source code and sample output.kotlin annotationsCommon Annotations in KotlinKotlin and Java provide built-in annotations such as Deprecated and Suppress. A Kotlin example with source code and sample output.