Deprecate 'kotlin.throws' in favor of 'kotlin.jvm.Throws'
This commit is contained in:
@@ -522,7 +522,11 @@ public class FunctionCodegen {
|
||||
|
||||
@NotNull
|
||||
public static String[] getThrownExceptions(@NotNull FunctionDescriptor function, @NotNull final JetTypeMapper mapper) {
|
||||
AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(new FqName("kotlin.Throws"));
|
||||
AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(new FqName("kotlin.throws"));
|
||||
if (annotation == null) {
|
||||
annotation = function.getAnnotations().findAnnotation(new FqName("kotlin.jvm.Throws"));
|
||||
}
|
||||
|
||||
if (annotation == null) return ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
|
||||
Collection<ConstantValue<?>> values = annotation.getAllValueArguments().values();
|
||||
|
||||
@@ -7,7 +7,7 @@ class A {
|
||||
@<!DEPRECATED_DECAPITALIZED_ANNOTATION!>jvmStatic<!> fun bar() {}
|
||||
}
|
||||
|
||||
<!DEPRECATED_DECAPITALIZED_ANNOTATION!>throws<!>(java.lang.RuntimeException::class)
|
||||
<!DEPRECATED_SYMBOL_WITH_MESSAGE!>throws<!>(java.lang.RuntimeException::class)
|
||||
<!DEPRECATED_DECAPITALIZED_ANNOTATION!>synchronized<!> fun <T> baz() {
|
||||
@<!DEPRECATED_DECAPITALIZED_ANNOTATION!>suppress<!>("UNCHECKED_CAST")
|
||||
(1 as T)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ kotlin.jvm.Strictfp() public fun bar(/*0*/ x: kotlin.Deprecated): @[kotlin.Exten
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
kotlin.Throws(exceptionClasses = {java.lang.RuntimeException::class}) kotlin.jvm.Synchronized() public final fun </*0*/ T> baz(): kotlin.Unit
|
||||
kotlin.throws(exceptionClasses = {java.lang.RuntimeException::class}) kotlin.jvm.Synchronized() public final fun </*0*/ T> baz(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.Deprecated(value = "") public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
|
||||
val DECAPITALIZED_DEPRECATED_ANNOTATIONS = arrayOf(
|
||||
"Deprecated", "Extension", "Suppress", "Throws",
|
||||
"Deprecated", "Extension", "Suppress",
|
||||
"jvm.Volatile", "jvm.Transient", "jvm.Strictfp", "jvm.Synchronized",
|
||||
"jvm.JvmOverloads", "jvm.JvmName", "jvm.JvmStatic", "annotation.Target"
|
||||
).map { FqName("kotlin.$it") }.toSet()
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package kotlin.jvm
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Instructs the Kotlin compiler to generate overloads for this function that substitute default parameter values.
|
||||
*
|
||||
@@ -64,4 +66,25 @@ public annotation class JvmMultifileClass
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@MustBeDocumented
|
||||
public annotation class publicField
|
||||
public annotation class publicField
|
||||
|
||||
/**
|
||||
* This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* throws(IOException::class)
|
||||
* fun readFile(name: String): String {...}
|
||||
* ```
|
||||
*
|
||||
* will be translated to
|
||||
*
|
||||
* ```
|
||||
* String readFile(String name) throws IOException {...}
|
||||
* ```
|
||||
*
|
||||
* @property exceptionClasses the list of checked exception classes that may be thrown by the function.
|
||||
*/
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(public vararg val exceptionClasses: KClass<out Throwable>)
|
||||
|
||||
@@ -23,7 +23,8 @@ import kotlin.reflect.KClass
|
||||
* @property exceptionClasses the list of checked exception classes that may be thrown by the function.
|
||||
*/
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
public annotation class Throws(public vararg val exceptionClasses: KClass<out Throwable>)
|
||||
@Deprecated("Use 'kotlin.jvm.Throws' instead", ReplaceWith("kotlin.jvm.Throws"))
|
||||
public annotation class throws(public vararg val exceptionClasses: KClass<out Throwable>)
|
||||
|
||||
/**
|
||||
* Returns the runtime Java class of this object.
|
||||
|
||||
Reference in New Issue
Block a user