From f2c05bf82cfb13eaac0b255ee4b9950331e2d409 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Tue, 31 Mar 2020 05:12:47 +0300 Subject: [PATCH] IR: Move annotation @JsExport to common source set in stdlib #KT-35966 --- .../common/src/kotlin/JsAnnotationsH.kt | 34 ++++++++++++++++++- libraries/stdlib/js/src/kotlin/annotations.kt | 25 ++++---------- .../kotlin-stdlib-runtime-merged.txt | 3 ++ 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/libraries/stdlib/common/src/kotlin/JsAnnotationsH.kt b/libraries/stdlib/common/src/kotlin/JsAnnotationsH.kt index db6b383235f..bdc34850524 100644 --- a/libraries/stdlib/common/src/kotlin/JsAnnotationsH.kt +++ b/libraries/stdlib/common/src/kotlin/JsAnnotationsH.kt @@ -12,4 +12,36 @@ import kotlin.annotation.AnnotationTarget.* */ @Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER) @OptionalExpectation -public expect annotation class JsName(val name: String) \ No newline at end of file +public expect annotation class JsName(val name: String) + +/** + * Marks experimental JS export annotations. + * + * Note that behavior of these annotations will likely be changed in the future. + * + * Usages of such annotations will be reported as warnings unless an explicit opt-in with + * the [OptIn] annotation, e.g. `@OptIn(ExperimentalJsExport::class)`, + * or with the `-Xopt-in=kotlin.js.ExperimentalJsExport` compiler option is given. + */ +@Suppress("DEPRECATION") +@Experimental(level = Experimental.Level.WARNING) +@RequiresOptIn(level = RequiresOptIn.Level.WARNING) +@MustBeDocumented +@Retention(AnnotationRetention.BINARY) +@SinceKotlin("1.4") +public annotation class ExperimentalJsExport + +/** + * Exports top-level declaration. + * + * Compiler exports from the module those top-level declarations that are marked with this annotation. + * There is no effect if this annotation is applied to a non-top-level declaration. + * + * This annotation has effect only on top-level declarations and only in IR-based JS backend. + */ +@ExperimentalJsExport +@Retention(AnnotationRetention.BINARY) +@Target(CLASS, PROPERTY, FUNCTION, FILE) +@SinceKotlin("1.4") +@OptionalExpectation +public expect annotation class JsExport() \ No newline at end of file diff --git a/libraries/stdlib/js/src/kotlin/annotations.kt b/libraries/stdlib/js/src/kotlin/annotations.kt index 1dde84dc95d..512f4466d05 100644 --- a/libraries/stdlib/js/src/kotlin/annotations.kt +++ b/libraries/stdlib/js/src/kotlin/annotations.kt @@ -161,29 +161,16 @@ public annotation class JsNonModule @Target(AnnotationTarget.FILE) public annotation class JsQualifier(val value: String) -/** - * Marks experimental JS export annotations. - * - * Note that behaviour of these annotations will likely be changed in the future. - * - * Usages of such annotations will be reported as warnings unless an explicit opt-in with - * the [OptIn] annotation, e.g. `@OptIn(ExperimentalJsExport::class)`, - * or with the `-Xopt-in=kotlin.js.ExperimentalJsExport` compiler option is given. - */ -@Suppress("DEPRECATION") -@Experimental(level = Experimental.Level.WARNING) -@RequiresOptIn(level = RequiresOptIn.Level.WARNING) -@SinceKotlin("1.3") -public annotation class ExperimentalJsExport - /** * Exports top-level declaration. * - * Used in future IR-based backend. - * Has no effect in current JS backend. + * Compiler exports from the module those top-level declarations that are marked with this annotation. + * There is no effect if this annotation is applied to a non-top-level declaration. + * + * This annotation has effect only on top-level declarations and only in IR-based JS backend. */ @ExperimentalJsExport -@SinceKotlin("1.3") @Retention(AnnotationRetention.BINARY) @Target(CLASS, PROPERTY, FUNCTION, FILE) -public annotation class JsExport +@SinceKotlin("1.3") +public actual annotation class JsExport diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt index 06ad803c221..2b5bb75c3bb 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt @@ -3045,6 +3045,9 @@ public final class kotlin/io/TextStreamsKt { public static final fun useLines (Ljava/io/Reader;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; } +public abstract interface annotation class kotlin/js/ExperimentalJsExport : java/lang/annotation/Annotation { +} + public final class kotlin/jvm/JvmClassMappingKt { public static final fun getAnnotationClass (Ljava/lang/annotation/Annotation;)Lkotlin/reflect/KClass; public static final fun getJavaClass (Ljava/lang/Object;)Ljava/lang/Class;