Package kotlin.jvm
Functions and annotations specific to the Java platform.
Annotations
JvmDefault
Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.
annotation class JvmDefault
JvmField
Instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.
annotation class JvmField
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.
annotation class JvmMultifileClass
JvmName
Specifies the name for the Java class or method which is generated from this element.
annotation class JvmName
JvmOverloads
Instructs the Kotlin compiler to generate overloads for this function that substitute default parameter values.
annotation class JvmOverloads
JvmStatic
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.
annotation class JvmStatic
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.
annotation class JvmSuppressWildcards
JvmSynthetic
Sets ACC_SYNTHETIC
flag on the annotated target in the Java bytecode.
annotation class JvmSynthetic
JvmWildcard
Instructs compiler to generate wildcard for annotated type arguments corresponding to parameters with declaration-site variance.
annotation class JvmWildcard
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.
annotation class PurelyImplements
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.
annotation class Strictfp
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.
annotation class Synchronized
Throws
This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
annotation class Throws
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.
annotation class Transient
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.
annotation class Volatile
Exceptions
KotlinReflectionNotSupportedError
open class KotlinReflectionNotSupportedError : Error
Extensions for External Classes
Properties
annotationClass
Returns a KClass instance corresponding to the annotation type of this annotation.
val <T : Annotation> T.annotationClass: KClass<out T>