Added in API level 1

RetentionPolicy

class RetentionPolicy
kotlin.Any
   ↳ kotlin.Enum<java.lang.annotation.RetentionPolicy>
   ↳ java.lang.annotation.RetentionPolicy

Annotation retention policy. The constants of this enumerated class describe the various policies for retaining annotations. They are used in conjunction with the Retention meta-annotation interface to specify how long annotations are to be retained.

Summary

Enum values

Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time.

Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.

Annotations are to be discarded by the compiler.

Enum values

CLASS

Added in API level 1
enum val CLASS : RetentionPolicy

Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time. This is the default behavior.

RUNTIME

Added in API level 1
enum val RUNTIME : RetentionPolicy

Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.

SOURCE

Added in API level 1
enum val SOURCE : RetentionPolicy

Annotations are to be discarded by the compiler.