W3cubDocs

/Kotlin

Package kotlin.jvm

Platform and version requirements: JVM

Functions and annotations specific to the Java platform.

Annotations

JvmField

annotation class JvmField

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

JvmMultifileClass

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

annotation class JvmName

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

JvmOverloads

annotation class JvmOverloads

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

JvmStatic

annotation class JvmStatic

Specifies that a static method or field needs to be generated from this element.

JvmSuppressWildcards

annotation class JvmSuppressWildcards

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

annotation class JvmSynthetic

JvmWildcard

annotation class JvmWildcard

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

PurelyImplements

annotation class PurelyImplements

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

annotation class Strictfp

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

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.

Throws

annotation class Throws

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

Transient

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

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.

Extensions for External Classes

java.lang.Class

Properties

annotationClass

val <T : Annotation> T.annotationClass: KClass<out T>

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

java

val <T> KClass<T>.java: Class<T>

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

javaClass

val <T : Any> T.javaClass: Class<T>

Returns the runtime Java class of this object.

javaObjectType

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

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.

Functions

isArrayOf

fun <T : Any> Array<*>.isArrayOf(): Boolean

Checks if array can contain element of type T.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/