OptIn

Common
JVM
JS
Native
1.3
@Target([AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.EXPRESSION, AnnotationTarget.FILE, AnnotationTarget.TYPEALIAS]) annotation class OptIn
(source)

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.

markerClass specifies marker annotations that require explicit opt-in. The marker annotation is not required to be itself marked with RequiresOptIn to enable gradual migration of API from requiring opt-in to the regular one, yet declaring such OptIn yields a compilation warning.

See also Kotlin language documentation for more information.

Constructors

Common
JVM
JS
Native
1.0

<init>

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.

OptIn(vararg markerClass: KClass<out Annotation>)

Properties

Common
JVM
JS
Native
1.0

markerClass

specifies marker annotations that require explicit opt-in.

vararg val markerClass: Array<out KClass<out Annotation>>