Package kotlin.jvm

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

JvmDefault
Link copied to clipboard
annotation class JvmDefault

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

Since Kotlin

1.2
JvmDefaultWithoutCompatibility
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
JvmField
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.

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

JvmInline
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
JvmMultifileClass
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.

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

JvmName
Link copied to clipboard
expect annotation class JvmName(name: String)

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

actual annotation class JvmName(name: String)

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

JvmOverloads
Link copied to clipboard
expect annotation class JvmOverloads

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

actual annotation class JvmOverloads

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

JvmRecord
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
JvmStatic
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.

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.

JvmSuppressWildcards
Link copied to clipboard
expect annotation class JvmSuppressWildcards(suppress: Boolean)

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.

actual annotation class JvmSuppressWildcards(suppress: Boolean)

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.

JvmSynthetic
Link copied to clipboard

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

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

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

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

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

KotlinReflectionNotSupportedError
Link copied to clipboard
open class KotlinReflectionNotSupportedError : Error
PurelyImplements
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class PurelyImplements(value: String)
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class PurelyImplements(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.

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

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.

Synchronized
Link copied to clipboard
expect annotation class Synchronized

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.

actual annotation class Synchronized

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.

actual annotation class Synchronized
Throws
Link copied to clipboard
annotation class Throws(exceptionClasses: KClass<out Throwable>)
annotation class Throws(exceptionClasses: KClass<out Throwable>)

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

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

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

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

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

@Target(allowedTargets = [AnnotationTarget.FIELD])
actual annotation class Volatile

Functions

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

Checks if array can contain element of type T.

Properties

annotationClass
Link copied to clipboard
val <T : Annotation> T.annotationClass: KClass<out T>

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

annotationClass
Link copied to clipboard
val <T : Annotation> T.annotationClass: KClass<out T>

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

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

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

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

Returns the runtime Java class of this object.

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

Returns the runtime Java class of this object.

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

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

javaObjectType
Link copied to clipboard
val <T : Any> KClass<T>.javaObjectType: Class<T>

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

javaPrimitiveType
Link copied to clipboard
val <T : Any> KClass<T>.javaPrimitiveType: Class<T>?

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

javaPrimitiveType
Link copied to clipboard
val <T : Any> KClass<T>.javaPrimitiveType: Class<T>?

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

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

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