Introduce platform specific annotations as optional in common stdlib
#KT-24478
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.js
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
/**
|
||||
* Gives a declaration (a function, a property or a class) specific name in JavaScript.
|
||||
*/
|
||||
@Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
@OptionalExpectation
|
||||
public expect annotation class JsName(val name: String)
|
||||
@@ -7,13 +7,123 @@ package kotlin.jvm
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, FILE)
|
||||
expect annotation class JvmName(val name: String)
|
||||
/**
|
||||
* Instructs the Kotlin compiler to generate overloads for this function that substitute default parameter values.
|
||||
*
|
||||
* If a method has N parameters and M of which have default values, M overloads are generated: the first one
|
||||
* takes N-1 parameters (all but the last one that takes a default value), the second takes N-2 parameters, and so on.
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmOverloads()
|
||||
|
||||
@Target(FILE)
|
||||
expect annotation class JvmMultifileClass()
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#static-methods)
|
||||
* for more information.
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmStatic()
|
||||
|
||||
expect annotation class JvmField()
|
||||
/**
|
||||
* Specifies the name for the Java class or method which is generated from this element.
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#handling-signature-clashes-with-jvmname)
|
||||
* for more information.
|
||||
* @property name the name of the element.
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FILE)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmName(val name: String)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Target(AnnotationTarget.FILE)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmMultifileClass()
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#instance-fields)
|
||||
* for more information.
|
||||
*/
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmField()
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* If the innermost applied `@JvmSuppressWildcards` has `suppress=true`, the type is generated without wildcards.
|
||||
* If the innermost applied `@JvmSuppressWildcards` has `suppress=false`, the type is generated with wildcards.
|
||||
*
|
||||
* It may be helpful only if declaration seems to be inconvenient to use from Java.
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPE)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmSuppressWildcards(val suppress: Boolean = true)
|
||||
|
||||
/**
|
||||
* Instructs compiler to generate wildcard for annotated type arguments corresponding to parameters with declaration-site variance.
|
||||
*
|
||||
* It may be helpful only if declaration seems to be inconvenient to use from Java without wildcard.
|
||||
*/
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class JvmWildcard()
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Marks the JVM backing field of the annotated property as `volatile`, meaning that writes to this field
|
||||
* are immediately made visible to other threads.
|
||||
*/
|
||||
@Target(FIELD)
|
||||
expect annotation class Volatile()
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class Volatile()
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Target(FIELD)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class Transient()
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Target(FUNCTION, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER, CLASS)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class Strictfp()
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
@MustBeDocumented
|
||||
@OptionalExpectation
|
||||
public expect annotation class Synchronized()
|
||||
Reference in New Issue
Block a user