Metadata

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

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

Constructors

Metadata
Link copied to clipboard
fun Metadata(kind: Int = 1, metadataVersion: IntArray = [], bytecodeVersion: IntArray = [1, 0, 3], data1: Array<String> = [], data2: Array<String> = [], extraString: String = "", packageName: String = "", extraInt: Int = 0)

Properties

bytecodeVersion
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.

data1
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.

data2
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.

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

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

extraString
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.

kind
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):

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

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

packageName
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.