Package-level declarations

Functions and annotations specific to the Java platform.

Functions and annotations specific to the Java platform.

Functions and annotations specific to the Java platform.

Functions and annotations specific to the Java platform.

Types

Link copied to clipboard

Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.

Since Kotlin 1.2
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class JvmDefaultWithCompatibility

Forces the compiler to generate compatibility accessors for the annotated interface in the DefaultImpls class. Please note that if an interface is annotated with this annotation for binary compatibility, public derived Kotlin interfaces should also be annotated with it, because their DefaultImpls methods will be used to access implementations from the DefaultImpls class of the original interface.

Since Kotlin 1.6
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class JvmDefaultWithoutCompatibility

Prevents the compiler from generating compatibility accessors for the annotated class or interface, and suppresses any related compatibility warnings. In other words, this annotation makes the compiler generate the annotated class or interface in the -Xjvm-default=all mode, where only JVM default methods are generated, without DefaultImpls.

Since Kotlin 1.4
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FIELD])
expect annotation class JvmField

Instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FIELD])
actual annotation class JvmField

Instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.

Since Kotlin 1.0
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
expect annotation class JvmInline

Specifies that given value class is inline class.

Since Kotlin 1.5
@Target(allowedTargets = [AnnotationTarget.CLASS])
actual annotation class JvmInline

Specifies that given value class is inline class.

Since Kotlin 1.5
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FILE])
expect annotation class JvmMultifileClass

Instructs the Kotlin compiler to generate a multifile class with top-level functions and properties declared in this file as one of its parts. Name of the corresponding multifile class is provided by the JvmName annotation.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FILE])
actual annotation class JvmMultifileClass

Instructs the Kotlin compiler to generate a multifile class with top-level functions and properties declared in this file as one of its parts. Name of the corresponding multifile class is provided by the JvmName annotation.

Since Kotlin 1.0
Link copied to clipboard

Specifies the name for the Java class or method which is generated from this element.

Since Kotlin 1.0

Specifies the name for the Java class or method which is generated from this element.

Since Kotlin 1.0
Link copied to clipboard
expect annotation class JvmOverloads

Instructs the Kotlin compiler to generate overloads for this function that substitute default parameter values.

Since Kotlin 1.0
actual annotation class JvmOverloads

Instructs the Kotlin compiler to generate overloads for this function that substitute default parameter values.

Since Kotlin 1.0
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
expect annotation class JvmRecord

Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods

Since Kotlin 1.5
@Target(allowedTargets = [AnnotationTarget.CLASS])
actual annotation class JvmRecord

Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods

Since Kotlin 1.5
Link copied to clipboard

Makes the annotation class repeatable in Java and Kotlin. A repeatable annotation can be applied more than once on the same element.

Since Kotlin 1.6
Link copied to clipboard

Specifies that an additional static method needs to be generated from this element if it's a function. If this element is a property, additional static getter/setter methods should be generated.

Since Kotlin 1.0

Specifies that an additional static method needs to be generated from this element if it's a function. If this element is a property, additional static getter/setter methods should be generated.

Since Kotlin 1.0
Link copied to clipboard

Instructs compiler to generate or omit wildcards for type arguments corresponding to parameters with declaration-site variance, for example such as Collection<out T> has.

Since Kotlin 1.0

Instructs compiler to generate or omit wildcards for type arguments corresponding to parameters with declaration-site variance, for example such as Collection<out T> has.

Since Kotlin 1.0
Link copied to clipboard

Sets ACC_SYNTHETIC flag on the annotated target in the Java bytecode.

Since Kotlin 1.0

Sets ACC_SYNTHETIC flag on the annotated target in the Java bytecode.

Since Kotlin 1.0
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.TYPE])
expect annotation class JvmWildcard

Instructs compiler to generate wildcard for annotated type arguments corresponding to parameters with declaration-site variance.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.TYPE])
actual annotation class JvmWildcard

Instructs compiler to generate wildcard for annotated type arguments corresponding to parameters with declaration-site variance.

Since Kotlin 1.0
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class PurelyImplements(val value: String)

Instructs the Kotlin compiler to treat annotated Java class as pure implementation of given Kotlin interface. "Pure" means here that each type parameter of class becomes non-platform type argument of that interface.

Since Kotlin 1.0
Link copied to clipboard

Marks the JVM method generated from the annotated function as strictfp, meaning that the precision of floating point operations performed inside the method needs to be restricted in order to achieve better portability.

Since Kotlin 1.0

Marks the JVM method generated from the annotated function as strictfp, meaning that the precision of floating point operations performed inside the method needs to be restricted in order to achieve better portability.

Since Kotlin 1.0
Link copied to clipboard

Marks the JVM method generated from the annotated function as synchronized, meaning that the method will be protected from concurrent execution by multiple threads by the monitor of the instance (or, for static methods, the class) on which the method is defined.

Since Kotlin 1.0

Marks the JVM method generated from the annotated function as synchronized, meaning that the method will be protected from concurrent execution by multiple threads by the monitor of the instance (or, for static methods, the class) on which the method is defined.

Since Kotlin 1.0
Link copied to clipboard

This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.

Since Kotlin 1.0
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FIELD])
expect annotation class Transient

Marks the JVM backing field of the annotated property as transient, meaning that it is not part of the default serialized form of the object.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FIELD])
actual annotation class Transient

Marks the JVM backing field of the annotated property as transient, meaning that it is not part of the default serialized form of the object.

Since Kotlin 1.0
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FIELD])
expect annotation class Volatile

Marks the JVM backing field of the annotated property as volatile, meaning that writes to this field are immediately made visible to other threads.

Since Kotlin 1.0
@Target(allowedTargets = [AnnotationTarget.FIELD])
actual annotation class Volatile
Since Kotlin 1.1
@Target(allowedTargets = [AnnotationTarget.FIELD])
actual annotation class Volatile

Marks the JVM backing field of the annotated property as volatile, meaning that writes to this field are immediately made visible to other threads.

Since Kotlin 1.0

Properties

Link copied to clipboard

Returns a KClass instance corresponding to the annotation type of this annotation.

Since Kotlin 1.0
Link copied to clipboard

Returns a Java Class instance of the enum the given constant belongs to.

Since Kotlin 1.7
Link copied to clipboard
@get:JvmName(name = "getJavaClass")
val <T> KClass<T>.java: Class<T>

Returns a Java Class instance corresponding to the given KClass instance.

Since Kotlin 1.0
Link copied to clipboard
val <T : Any> T.javaClass: Class<T>

Returns the runtime Java class of this object.

Since Kotlin 1.0
@get:JvmName(name = "getRuntimeClassOfKClassInstance")
val <T : Any> KClass<T>.javaClass: Class<KClass<T>>
Since Kotlin 1.0
Link copied to clipboard

Returns a Java Class instance corresponding to the given KClass instance. In case of primitive types it returns corresponding wrapper classes.

Since Kotlin 1.0
Link copied to clipboard

Returns a Java Class instance representing the primitive type corresponding to the given KClass if it exists.

Since Kotlin 1.0
Link copied to clipboard
@get:JvmName(name = "getKotlinClass")
val <T : Any> Class<T>.kotlin: KClass<T>

Returns a KClass instance corresponding to the given Java Class instance.

Since Kotlin 1.0

Functions

Link copied to clipboard
fun <T : Any> Array<*>.isArrayOf(): Boolean

Checks if array can contain element of type T.

Since Kotlin 1.0