Introduce platform specific annotations as optional in common stdlib

#KT-24478
This commit is contained in:
Ilya Gorbunov
2018-05-24 20:18:52 +03:00
parent ce7a863843
commit 0c89996e34
9 changed files with 148 additions and 45 deletions
@@ -60,11 +60,10 @@ internal annotation class marker
* @property name the name which compiler uses both for declaration itself and for all references to the declaration.
* It's required to denote a valid JavaScript identifier.
*
* @since 1.1
*/
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER)
annotation class JsName(val name: String)
public actual annotation class JsName(actual val name: String)
/**
* Denotes an `external` declaration that must be imported from native JavaScript library.
@@ -93,11 +92,10 @@ annotation class JsName(val name: String)
* It is not interpreted by the Kotlin compiler, it's passed as is directly to the target module system.
*
* @see JsNonModule
* @since 1.1
*/
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, PROPERTY, FUNCTION, FILE)
annotation class JsModule(val import: String)
public annotation class JsModule(val import: String)
/**
* Denotes an `external` declaration that can be used without module system.
@@ -125,11 +123,10 @@ annotation class JsModule(val import: String)
* ```
*
* @see JsModule
* @since 1.1
*/
@Retention(AnnotationRetention.BINARY)
@Target(CLASS, PROPERTY, FUNCTION, FILE)
annotation class JsNonModule
public annotation class JsNonModule
/**
* Adds prefix to `external` declarations in a source file.
@@ -159,8 +156,7 @@ annotation class JsNonModule
* Examples of valid qualifiers are: `foo`, `bar.Baz`, `_.$0.f`.
*
* @see JsModule
* @since 1.1
*/
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FILE)
annotation class JsQualifier(val value: String)
public annotation class JsQualifier(val value: String)
@@ -7,28 +7,7 @@ package kotlin.jvm
// these are used in common generated code in stdlib
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
@Retention(AnnotationRetention.SOURCE)
internal annotation class JvmOverloads
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE)
@MustBeDocumented
@Suppress("ACTUAL_WITHOUT_EXPECT") // TODO: KT-19507
internal actual annotation class JvmName(public actual val name: String)
@Target(AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE)
@MustBeDocumented
@Suppress("ACTUAL_WITHOUT_EXPECT") // TODO: KT-19507
internal actual annotation class JvmMultifileClass
@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.SOURCE)
@MustBeDocumented
@Suppress("ACTUAL_WITHOUT_EXPECT") // TODO: KT-19507
internal actual annotation class JvmField
// TODO: find how to deprecate these ones
@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.SOURCE)
@@ -36,4 +15,4 @@ public actual annotation class Volatile
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
@Retention(AnnotationRetention.SOURCE)
public annotation class Synchronized
public actual annotation class Synchronized