ArrayKClassValue

data class ArrayKClassValue(val className: ClassName, val arrayDimensionCount: Int) : KmAnnotationArgument

Annotation argument whose type is one of the kotlin.Array KClasses.

Due to the nature of JVM, Arrays with different arguments are represented by different kotlin.reflect.KClass and java.lang.Class instances (while e.g. List has always one KClass instance regardless of generic arguments). As a result, Kotlin compiler allows using generic arguments for the arrays in annotations: @Foo(Array<Array<String>>::class). ArrayKClassValue allows to distinguish such arguments from regular KClassValue.

className is the array element type's fully qualified name — in the example above, it is kotlin/String. arrayDimensionCount is the dimension of the array — 1 for Array<String>::class, 2 for Array<Array<String>>::class, and so on. It is guaranteed to be at least 1.

For platforms other than JVM, the value for className is always kotlin/Any and arrayDimensionCount is always 1. This represents untyped Array::class expression.

See also: https://youtrack.jetbrains.com/issue/KT-31230

Constructors

Link copied to clipboard
constructor(className: ClassName, arrayDimensionCount: Int)

Properties

Link copied to clipboard

Referenced array dimension.

Link copied to clipboard

FQ name of the referenced array element type.