Common kotlin.Throws annotation
Leave kotlin.native.Throws as a deprecated typealias #KT-34848 (cherry picked from commit 10fac5c96f915e0e008504a211ee70a3e1c9bdea)
This commit is contained in:
committed by
Vasily Levchenko
parent
3d6a5e0e74
commit
29aa2a75f9
+1
-1
@@ -21,7 +21,7 @@ object KonanFqNames {
|
|||||||
val nativePtr = internalPackageName.child(Name.identifier(NATIVE_PTR_NAME)).toUnsafe()
|
val nativePtr = internalPackageName.child(Name.identifier(NATIVE_PTR_NAME)).toUnsafe()
|
||||||
val nonNullNativePtr = internalPackageName.child(Name.identifier(NON_NULL_NATIVE_PTR_NAME)).toUnsafe()
|
val nonNullNativePtr = internalPackageName.child(Name.identifier(NON_NULL_NATIVE_PTR_NAME)).toUnsafe()
|
||||||
val Vector128 = packageName.child(Name.identifier(VECTOR128))
|
val Vector128 = packageName.child(Name.identifier(VECTOR128))
|
||||||
val throws = FqName("kotlin.native.Throws")
|
val throws = FqName("kotlin.Throws")
|
||||||
val threadLocal = FqName("kotlin.native.concurrent.ThreadLocal")
|
val threadLocal = FqName("kotlin.native.concurrent.ThreadLocal")
|
||||||
val sharedImmutable = FqName("kotlin.native.concurrent.SharedImmutable")
|
val sharedImmutable = FqName("kotlin.native.concurrent.SharedImmutable")
|
||||||
val frozen = FqName("kotlin.native.internal.Frozen")
|
val frozen = FqName("kotlin.native.internal.Frozen")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package kotlin
|
|||||||
import kotlin.annotation.AnnotationRetention.BINARY
|
import kotlin.annotation.AnnotationRetention.BINARY
|
||||||
import kotlin.annotation.AnnotationRetention.SOURCE
|
import kotlin.annotation.AnnotationRetention.SOURCE
|
||||||
import kotlin.annotation.AnnotationTarget.*
|
import kotlin.annotation.AnnotationTarget.*
|
||||||
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the annotated declaration as deprecated.
|
* Marks the annotated declaration as deprecated.
|
||||||
@@ -148,4 +149,23 @@ public annotation class DslMarker
|
|||||||
@Retention(AnnotationRetention.BINARY)
|
@Retention(AnnotationRetention.BINARY)
|
||||||
@MustBeDocumented
|
@MustBeDocumented
|
||||||
@SinceKotlin("1.1")
|
@SinceKotlin("1.1")
|
||||||
public annotation class PublishedApi
|
public annotation class PublishedApi
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This annotation indicates what exceptions should be declared by a function when compiled to a platform method.
|
||||||
|
*
|
||||||
|
* When compiling to Objective-C/Swift framework, functions having or inheriting
|
||||||
|
* this annotation are represented as `NSError*`-producing methods in Objective-C
|
||||||
|
* and as `throws` methods in Swift.
|
||||||
|
*
|
||||||
|
* When Kotlin function called from Swift/Objective-C code throws an exception
|
||||||
|
* which is an instance of one of the [exceptionClasses] or their subclasses,
|
||||||
|
* it is propagated as `NSError`. Other Kotlin exceptions reaching Swift/Objective-C
|
||||||
|
* are considered unhandled and cause program termination.
|
||||||
|
*
|
||||||
|
* @property exceptionClasses the list of checked exception classes that may be thrown by the function.
|
||||||
|
*/
|
||||||
|
@SinceKotlin("1.4")
|
||||||
|
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||||
|
@Retention(AnnotationRetention.BINARY)
|
||||||
|
public actual annotation class Throws(actual vararg val exceptionClasses: KClass<out Throwable>)
|
||||||
|
|||||||
@@ -32,24 +32,9 @@ public annotation class Retain
|
|||||||
public annotation class RetainForTarget(val target: String)
|
public annotation class RetainForTarget(val target: String)
|
||||||
|
|
||||||
|
|
||||||
// TODO: merge with [kotlin.jvm.Throws]
|
/** @suppress */
|
||||||
/**
|
@Deprecated("Use common kotlin.Throws annotation instead.", ReplaceWith("kotlin.Throws"), DeprecationLevel.WARNING)
|
||||||
* This annotation indicates what exceptions should be declared by a function when compiled to a platform method.
|
public typealias Throws = kotlin.Throws
|
||||||
*
|
|
||||||
* When compiling to Objective-C/Swift framework, functions having or inheriting
|
|
||||||
* this annotation are represented as `NSError*`-producing methods in Objective-C
|
|
||||||
* and as `throws` methods in Swift.
|
|
||||||
*
|
|
||||||
* When Kotlin function called from Swift/Objective-C code throws an exception
|
|
||||||
* which is an instance of one of the [exceptionClasses] or their subclasses,
|
|
||||||
* it is propagated as `NSError`. Other Kotlin exceptions reaching Swift/Objective-C
|
|
||||||
* are considered unhandled and cause program termination.
|
|
||||||
*
|
|
||||||
* @property exceptionClasses the list of checked exception classes that may be thrown by the function.
|
|
||||||
*/
|
|
||||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
|
||||||
@Retention(AnnotationRetention.BINARY)
|
|
||||||
public annotation class Throws(vararg val exceptionClasses: KClass<out Throwable>)
|
|
||||||
|
|
||||||
public typealias ThreadLocal = kotlin.native.concurrent.ThreadLocal
|
public typealias ThreadLocal = kotlin.native.concurrent.ThreadLocal
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user