Targeting / retention for a set of standard annotations, some inapplicable annotation checks replaced with target check, some fixed tests
This commit is contained in:
@@ -16,42 +16,41 @@
|
||||
|
||||
package kotlin.jvm
|
||||
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
/**
|
||||
* Marks the JVM backing field of the annotated property as `volatile`, meaning that writes to this field
|
||||
* are immediately made visible to other threads.
|
||||
*/
|
||||
Retention(RetentionPolicy.SOURCE)
|
||||
public annotation class volatile
|
||||
target(PROPERTY, FIELD)
|
||||
public annotation(retention = AnnotationRetention.SOURCE) 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.
|
||||
*/
|
||||
Retention(RetentionPolicy.SOURCE)
|
||||
public annotation class transient
|
||||
target(PROPERTY, FIELD)
|
||||
public annotation(retention = AnnotationRetention.SOURCE) 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.
|
||||
*/
|
||||
Retention(RetentionPolicy.SOURCE)
|
||||
public annotation class strictfp
|
||||
target(FUNCTION, CONSTRUCTOR, PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER, CLASSIFIER)
|
||||
public annotation(retention = AnnotationRetention.SOURCE) 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.
|
||||
*/
|
||||
Retention(RetentionPolicy.SOURCE)
|
||||
public annotation class synchronized
|
||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.SOURCE) class synchronized
|
||||
|
||||
/**
|
||||
* Marks the JVM method generated from the annotated function as `native`, meaning that it's not implemented
|
||||
* in Java but rather in a different language (for example, in C/C++ using JNI).
|
||||
*/
|
||||
Retention(RetentionPolicy.SOURCE)
|
||||
public annotation class native
|
||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.SOURCE) class native
|
||||
|
||||
@@ -16,20 +16,17 @@
|
||||
|
||||
package kotlin.jvm
|
||||
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
Retention(RetentionPolicy.CLASS)
|
||||
public annotation class jvmOverloads
|
||||
target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||
public annotation(retention = AnnotationRetention.BINARY) class jvmOverloads
|
||||
|
||||
/**
|
||||
* Instructs the Kotlin compiler to generate a public backing field for this property.
|
||||
*/
|
||||
Retention(RetentionPolicy.SOURCE)
|
||||
public annotation class publicField
|
||||
target(AnnotationTarget.PROPERTY)
|
||||
public annotation(retention = AnnotationRetention.SOURCE) class publicField
|
||||
@@ -16,18 +16,22 @@
|
||||
|
||||
package kotlin.platform
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
/**
|
||||
* Specifies the name for the target platform element (Java class, method or field, JavaScript function)
|
||||
* Specifies the name for the target platform element (Java method, JavaScript function)
|
||||
* which is generated from this element.
|
||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#handling-signature-clashes-with-platformname)
|
||||
* for more information.
|
||||
* @property name the name of the element.
|
||||
*/
|
||||
public annotation class platformName(public val name: String)
|
||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME) class platformName(public val name: String)
|
||||
|
||||
/**
|
||||
* Specifies that a static method or field needs to be generated from this element.
|
||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#static-methods-and-fields)
|
||||
* for more information.
|
||||
*/
|
||||
public annotation class platformStatic
|
||||
target(FUNCTION, PROPERTY, FIELD, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME) class platformStatic
|
||||
|
||||
Reference in New Issue
Block a user