Annotation
interface Annotation
Base interface implicitly implemented by all annotation interfaces. See Kotlin language documentation for more information on annotations.
Extension Properties
annotationClass
Returns a KClass instance corresponding to the annotation type of this annotation.
val <T : Annotation> T.annotationClass: KClass<out T>
Inheritors
AssociatedObjectKey
Makes the annotated annotation class an associated object key.
annotation class AssociatedObjectKey
BuilderInference
Allows to infer generic type arguments of a function from the calls in the annotated function parameter of that function.
annotation class BuilderInference
CCall
annotation class CCall
CEnumEntryAlias
Denotes property that is an alias to some enum entry.
annotation class CEnumEntryAlias
CEnumVarTypeSize
Stores instance size of the type T: CEnumVar.
annotation class CEnumVarTypeSize
CName
Makes top level function available from C/C++ code with the given name.
annotation class CName
CStruct
annotation class CStruct
Deprecated
Marks the annotated declaration as deprecated.
annotation class Deprecated
DeprecatedSinceKotlin
Marks the annotated declaration as deprecated. In contrast to Deprecated, severity of the reported diagnostic is not a constant value, but differs depending on the API version of the usage (the value of the -api-version
argument when compiling the module where the usage is located). If the API version is greater or equal than hiddenSince, the declaration will not be accessible from the code (as if it was deprecated with level DeprecationLevel.HIDDEN), otherwise if the API version is greater or equal than errorSince, the usage will be marked as an error (as with DeprecationLevel.ERROR), otherwise if the API version is greater or equal than warningSince, the usage will be marked as a warning (as with DeprecationLevel.WARNING), otherwise the annotation is ignored.
annotation class DeprecatedSinceKotlin
DslMarker
When applied to annotation class X specifies that X defines a DSL language
annotation class DslMarker
EagerInitialization
Forces a top-level property to be initialized eagerly, opposed to lazily on the first access to file and/or property. This annotation can be used as temporal migration assistance during the transition from the previous Kotlin/Native initialization scheme "eager by default" to the new one, "lazy by default".
annotation class EagerInitialization
Experimental
Signals that the annotated annotation class is a marker of an experimental API.
annotation class Experimental
ExperimentalAssociatedObjects
The experimental marker for associated objects API.
annotation class ExperimentalAssociatedObjects
ExperimentalContracts
This marker distinguishes the experimental contract declaration API and is used to opt-in for that feature when declaring contracts of user functions.
annotation class ExperimentalContracts
ExperimentalJsExport
Marks experimental JS export annotations.
annotation class ExperimentalJsExport
ExperimentalMultiplatform
The experimental multiplatform support API marker.
annotation class ExperimentalMultiplatform
ExperimentalPathApi
This annotation marks the extensions and top-level functions for working with java.nio.file.Path considered experimental.
annotation class ExperimentalPathApi
ExperimentalReflectionOnLambdas
This annotation marks the experimental kotlin-reflect API that allows to approximate a Kotlin lambda or a function expression instance to a KFunction instance. The behavior of this API may be changed or the API may be removed completely in any further release.
annotation class ExperimentalReflectionOnLambdas
ExperimentalStdlibApi
This annotation marks the standard library API that is considered experimental and is not subject to the general compatibility guarantees given for the standard library: the behavior of such API may be changed or the API may be removed completely in any further release.
annotation class ExperimentalStdlibApi
ExperimentalTime
This annotation marks the experimental preview of the standard library API for measuring time and working with durations.
annotation class ExperimentalTime
ExperimentalTypeInference
The experimental marker for type inference augmenting annotations.
annotation class ExperimentalTypeInference
ExperimentalUnsignedTypes
Marks the API that is dependent on the experimental unsigned types, including those types themselves.
annotation class ExperimentalUnsignedTypes
ExportObjCClass
Makes Kotlin subclass of Objective-C class visible for runtime lookup after Kotlin main
function gets invoked.
annotation class ExportObjCClass
ExtensionFunctionType
Signifies that the annotated functional type represents an extension function.
annotation class ExtensionFunctionType
ExternalObjCClass
annotation class ExternalObjCClass
InteropStubs
annotation class InteropStubs
JsExport
Exports top-level declaration on JS platform.
annotation class JsExport
JsModule
Denotes an external
declaration that must be imported from native JavaScript library.
annotation class JsModule
JsName
Gives a declaration (a function, a property or a class) specific name in JavaScript.
annotation class JsName
JsNonModule
Denotes an external
declaration that can be used without module system.
annotation class JsNonModule
JsQualifier
Adds prefix to external
declarations in a source file.
annotation class JsQualifier
JvmDefault
Specifies that a JVM default method should be generated for non-abstract Kotlin interface member.
annotation class JvmDefault
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
.
annotation class JvmDefaultWithoutCompatibility
JvmField
Instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.
annotation class JvmField
JvmInline
Specifies that given value class is inline class.
annotation class JvmInline
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
JvmRecord
Instructs compiler to mark the class as a record and generate relevant toString/equals/hashCode methods
annotation class JvmRecord
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
Metadata
This annotation is present on any class file produced by the Kotlin compiler and is read by the compiler and reflection. Parameters have very short JVM names on purpose: these names appear in all generated class files, and we'd like to reduce their size.
annotation class Metadata
MustBeDocumented
This meta-annotation determines that an annotation is a part of public API and therefore should be included in the generated documentation for the element to which the annotation is applied.
annotation class MustBeDocumented
nativeGetter
annotation class nativeGetter
nativeInvoke
annotation class nativeInvoke
nativeSetter
annotation class nativeSetter
ObjCAction
Makes Kotlin method in Objective-C class accessible through Objective-C dispatch to be used as action sent by control in UIKit or AppKit.
annotation class ObjCAction
ObjCConstructor
annotation class ObjCConstructor
ObjCFactory
annotation class ObjCFactory
ObjCMethod
annotation class ObjCMethod
ObjCOutlet
Makes Kotlin property in Objective-C class settable through Objective-C dispatch to be used as IB outlet.
annotation class ObjCOutlet
OptIn
Allows to use the API denoted by the given markers in the annotated file, declaration, or expression. If a declaration is annotated with OptIn, its usages are not required to opt in to that API.
annotation class OptIn
OptionalExpectation
Marks an expected annotation class that it isn't required to have actual counterparts in all platforms.
annotation class OptionalExpectation
OverloadResolutionByLambdaReturnType
Enables overload selection based on the type of the value returned from lambda argument.
annotation class OverloadResolutionByLambdaReturnType
ParameterName
Annotates type arguments of functional type and holds corresponding parameter name specified by the user in type declaration (if any).
annotation class ParameterName
PublishedApi
When applied to a class or a member with internal visibility allows to use it from public inline functions and makes it effectively public.
annotation class PublishedApi
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
Repeatable
This meta-annotation determines that an annotation is applicable twice or more on a single code element
annotation class Repeatable
ReplaceWith
Specifies a code fragment that can be used to replace a deprecated function, property or class. Tools such as IDEs can automatically apply the replacements specified through this annotation.
annotation class ReplaceWith
RequiresOptIn
Signals that the annotated annotation class is a marker of an API that requires an explicit opt-in.
annotation class RequiresOptIn
RestrictsSuspension
Classes and interfaces marked with this annotation are restricted when used as receivers for extension suspend
functions. These suspend
extensions can only invoke other member or extension suspend
functions on this particular receiver and are restricted from calling arbitrary suspension functions.
annotation class RestrictsSuspension
Retain
Preserve the function entry point during global optimizations.
annotation class Retain
RetainForTarget
Preserve the function entry point during global optimizations, only for the given target.
annotation class RetainForTarget
Retention
This meta-annotation determines whether an annotation is stored in binary output and visible for reflection. By default, both are true.
annotation class Retention
SharedImmutable
Marks a top level property with a backing field as immutable. It is possible to share the value of such property between multiple threads, but it becomes deeply frozen, so no changes can be made to its state or the state of objects it refers to.
annotation class SharedImmutable
SinceKotlin
Specifies the first version of Kotlin where a declaration has appeared. Using the declaration and specifying an older API version (via the -api-version
command line option) will result in an error.
annotation class SinceKotlin
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
Suppress
Suppresses the given compilation warnings in the annotated element.
annotation class Suppress
SymbolName
This annotation is deprecated. See KT-46649.
annotation class SymbolName
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
Target
This meta-annotation indicates the kinds of code elements which are possible targets of an annotation.
annotation class Target
ThreadLocal
Marks a top level property with a backing field or an object as thread local. The object remains mutable and it is possible to change its state, but every thread will have a distinct copy of this object, so changes in one thread are not reflected in another.
annotation class ThreadLocal
Throws
This annotation indicates what exceptions should be declared by a function when compiled to a platform method in Kotlin/JVM and Kotlin/Native.
annotation class Throws
typealias Throws = Throws
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
UnsafeNumber
Marker for typealias that will represent numbers of different bit width on at least two platforms.
annotation class UnsafeNumber
UnsafeVariance
Suppresses errors about variance conflict
annotation class UnsafeVariance
UseExperimental
Allows to use experimental API denoted by the given markers in the annotated file, declaration, or expression. If a declaration is annotated with UseExperimental, its usages are not required to opt-in to that experimental API.
annotation class UseExperimental
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
© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-annotation.html