PublishedApi

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
@Target([AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY]) annotation class 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.

Public inline functions cannot use non-public API, since if they are inlined, those non-public API references would violate access restrictions at a call site (https://kotlinlang.org/docs/reference/inline-functions.html#public-inline-restrictions).

To overcome this restriction an internal declaration can be annotated with the @PublishedApi annotation:

  • this allows to call that declaration from public inline functions;
  • the declaration becomes effectively public, and this should be considered with respect to binary compatibility maintaining.

Constructors

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

<init>

When applied to a class or a member with internal visibility allows to use it from public inline functions and makes it effectively public.

<init>()

Extension Properties

Platform and version requirements: JVM (1.0)

annotationClass

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

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

© 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/-published-api/index.html