Metadata

@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Metadata(val kind: Int = 1, val metadataVersion: IntArray = [], val bytecodeVersion: IntArray = [1, 0, 3], val data1: Array<String> = [], val data2: Array<String> = [], val extraString: String = "", val packageName: String = "", val extraInt: Int = 0)(source)

This annotation is present on any class file produced by the Kotlin compiler and is read by the compiler and reflection. Parameters have very short JVM names on purpose: these names appear in all generated class files, and we'd like to reduce their size.

Since Kotlin

1.3

Properties

Link copied to clipboard
@get:JvmName(name = "bv")
val bytecodeVersion: IntArray

The version of the bytecode interface (naming conventions, signatures) of the class file annotated with this annotation.

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "d1")
val data1: Array<String>

Metadata in a custom format. The format may be different (or even absent) for different kinds.

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "d2")
val data2: Array<String>

An addition to data1: array of strings which occur in metadata, written in plain text so that strings already present in the constant pool are reused. These strings may be then indexed in the metadata by an integer index in this array.

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "xi")
val extraInt: Int = 0

An extra int. Bits of this number represent the following flags:

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "xs")
val extraString: String

An extra string. For a multi-file part class, internal name of the facade class.

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "k")
val kind: Int = 1

A kind of the metadata this annotation encodes. Kotlin compiler recognizes the following kinds (see KotlinClassHeader.Kind):

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "mv")
val metadataVersion: IntArray

The version of the metadata provided in the arguments of this annotation.

Since Kotlin 1.3
Link copied to clipboard
@get:JvmName(name = "pn")
val packageName: String

Fully qualified name of the package this class is located in, from Kotlin's point of view, or empty string if this name does not differ from the JVM's package FQ name. These names can be different in case the JvmPackageName annotation is used. Note that this information is also stored in the corresponding module's .kotlin_module file.

Since Kotlin 1.3