diff --git a/core/reflection.jvm/src/kotlin/reflect/KClasses.kt b/core/reflection.jvm/src/kotlin/reflect/KClasses.kt deleted file mode 100644 index 08dec7a880b..00000000000 --- a/core/reflection.jvm/src/kotlin/reflect/KClasses.kt +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@file:JvmName("KClasses") -@file:Suppress("UNCHECKED_CAST", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") - -package kotlin.reflect - -import kotlin.reflect.full.allSuperclasses -import kotlin.reflect.full.allSupertypes -import kotlin.reflect.full.cast -import kotlin.reflect.full.companionObject -import kotlin.reflect.full.companionObjectInstance -import kotlin.reflect.full.createInstance -import kotlin.reflect.full.declaredFunctions -import kotlin.reflect.full.declaredMemberExtensionFunctions -import kotlin.reflect.full.declaredMemberExtensionProperties -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.reflect.full.declaredMemberProperties -import kotlin.reflect.full.declaredMembers -import kotlin.reflect.full.defaultType -import kotlin.reflect.full.functions -import kotlin.reflect.full.isSubclassOf -import kotlin.reflect.full.isSuperclassOf -import kotlin.reflect.full.memberExtensionFunctions -import kotlin.reflect.full.memberExtensionProperties -import kotlin.reflect.full.memberFunctions -import kotlin.reflect.full.memberProperties -import kotlin.reflect.full.primaryConstructor -import kotlin.reflect.full.safeCast -import kotlin.reflect.full.staticFunctions -import kotlin.reflect.full.staticProperties -import kotlin.reflect.full.superclasses - -/** - * Returns the primary constructor of this class, or `null` if this class has no primary constructor. - * See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/classes.html#constructors) - * for more information. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'primaryConstructor' from kotlin.reflect.full package", ReplaceWith("this.primaryConstructor", "kotlin.reflect.full.primaryConstructor"), level = DeprecationLevel.WARNING) -inline val KClass.primaryConstructor: KFunction? - get() = this.primaryConstructor - - -/** - * Returns a [KClass] instance representing the companion object of a given class, - * or `null` if the class doesn't have a companion object. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'companionObject' from kotlin.reflect.full package", ReplaceWith("this.companionObject", "kotlin.reflect.full.companionObject"), level = DeprecationLevel.WARNING) -inline val KClass<*>.companionObject: KClass<*>? - get() = this.companionObject - -/** - * Returns an instance of the companion object of a given class, - * or `null` if the class doesn't have a companion object. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'companionObjectInstance' from kotlin.reflect.full package", ReplaceWith("this.companionObjectInstance", "kotlin.reflect.full.companionObjectInstance"), level = DeprecationLevel.WARNING) -inline val KClass<*>.companionObjectInstance: Any? - get() = this.companionObjectInstance - - -/** - * Returns a type corresponding to the given class with type parameters of that class substituted as the corresponding arguments. - * For example, for class `MyMap` [defaultType] would return the type `MyMap`. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'defaultType' from kotlin.reflect.full package", ReplaceWith("this.defaultType", "kotlin.reflect.full.defaultType"), level = DeprecationLevel.WARNING) -inline val KClass<*>.defaultType: KType - get() = this.defaultType - - -/** - * Returns all functions declared in this class, including all non-static methods declared in the class - * and the superclasses, as well as static methods declared in the class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'functions' from kotlin.reflect.full package", ReplaceWith("this.functions", "kotlin.reflect.full.functions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.functions: Collection> - get() = this.functions - -/** - * Returns static functions declared in this class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'staticFunctions' from kotlin.reflect.full package", ReplaceWith("this.staticFunctions", "kotlin.reflect.full.staticFunctions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.staticFunctions: Collection> - get() = this.staticFunctions - -/** - * Returns non-extension non-static functions declared in this class and all of its superclasses. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'memberFunctions' from kotlin.reflect.full package", ReplaceWith("this.memberFunctions", "kotlin.reflect.full.memberFunctions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.memberFunctions: Collection> - get() = this.memberFunctions - -/** - * Returns extension functions declared in this class and all of its superclasses. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'memberExtensionFunctions' from kotlin.reflect.full package", ReplaceWith("this.memberExtensionFunctions", "kotlin.reflect.full.memberExtensionFunctions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.memberExtensionFunctions: Collection> - get() = this.memberExtensionFunctions - -/** - * Returns all functions declared in this class. - * If this is a Java class, it includes all non-static methods (both extensions and non-extensions) - * declared in the class and the superclasses, as well as static methods declared in the class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'declaredFunctions' from kotlin.reflect.full package", ReplaceWith("this.declaredFunctions", "kotlin.reflect.full.declaredFunctions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.declaredFunctions: Collection> - get() = this.declaredFunctions - -/** - * Returns non-extension non-static functions declared in this class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'declaredMemberFunctions' from kotlin.reflect.full package", ReplaceWith("this.declaredMemberFunctions", "kotlin.reflect.full.declaredMemberFunctions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.declaredMemberFunctions: Collection> - get() = this.declaredMemberFunctions - -/** - * Returns extension functions declared in this class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'declaredMemberExtensionFunctions' from kotlin.reflect.full package", ReplaceWith("this.declaredMemberExtensionFunctions", "kotlin.reflect.full.declaredMemberExtensionFunctions"), level = DeprecationLevel.WARNING) -inline val KClass<*>.declaredMemberExtensionFunctions: Collection> - get() = this.declaredMemberExtensionFunctions - -/** - * Returns static properties declared in this class. - * Only properties representing static fields of Java classes are considered static. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'staticProperties' from kotlin.reflect.full package", ReplaceWith("this.staticProperties", "kotlin.reflect.full.staticProperties"), level = DeprecationLevel.WARNING) -inline val KClass<*>.staticProperties: Collection> - get() = this.staticProperties - -/** - * Returns non-extension properties declared in this class and all of its superclasses. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'memberProperties' from kotlin.reflect.full package", ReplaceWith("this.memberProperties", "kotlin.reflect.full.memberProperties"), level = DeprecationLevel.WARNING) -inline val KClass.memberProperties: Collection> - get() = this.memberProperties - -/** - * Returns extension properties declared in this class and all of its superclasses. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'memberExtensionProperties' from kotlin.reflect.full package", ReplaceWith("this.memberExtensionProperties", "kotlin.reflect.full.memberExtensionProperties"), level = DeprecationLevel.WARNING) -inline val KClass.memberExtensionProperties: Collection> - get() = this.memberExtensionProperties - -/** - * Returns non-extension properties declared in this class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'declaredMemberProperties' from kotlin.reflect.full package", ReplaceWith("this.declaredMemberProperties", "kotlin.reflect.full.declaredMemberProperties"), level = DeprecationLevel.WARNING) -inline val KClass.declaredMemberProperties: Collection> - get() = this.declaredMemberProperties - -/** - * Returns extension properties declared in this class. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'declaredMemberExtensionProperties' from kotlin.reflect.full package", ReplaceWith("this.declaredMemberExtensionProperties", "kotlin.reflect.full.declaredMemberExtensionProperties"), level = DeprecationLevel.WARNING) -inline val KClass.declaredMemberExtensionProperties: Collection> - get() = this.declaredMemberExtensionProperties diff --git a/core/reflection.jvm/src/kotlin/reflect/exceptions.kt b/core/reflection.jvm/src/kotlin/reflect/exceptions.kt deleted file mode 100644 index 7f1e17ed701..00000000000 --- a/core/reflection.jvm/src/kotlin/reflect/exceptions.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package kotlin.reflect - -/** - * An exception that is thrown when `call` is invoked on a callable or `get` or `set` is invoked on a property - * and that callable is not accessible (in JVM terms) from the calling method. - * - * @param cause the original exception thrown by the JVM. - * - * @see [kotlin.reflect.jvm.isAccessible] - */ -@Deprecated("Use 'IllegalCallableAccessException' from kotlin.reflect.full package", ReplaceWith("IllegalCallableAccessException", "kotlin.reflect.full.IllegalCallableAccessException"), level = DeprecationLevel.WARNING) -open class IllegalCallableAccessException(cause: IllegalAccessException) : Exception(cause.message) { - init { - @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") - (this as java.lang.Throwable).initCause(cause) - } -} - -/** - * An exception that is thrown when the code tries to introspect a property of a class or a package - * and that class or the package no longer has that property. - */ -@Deprecated("Use 'NoSuchPropertyException' from kotlin.reflect.full package", ReplaceWith("NoSuchPropertyException", "kotlin.reflect.full.NoSuchPropertyException"), level = DeprecationLevel.WARNING) -open class NoSuchPropertyException(cause: Exception? = null) : Exception() { - init { - @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") - if (cause != null) { - (this as java.lang.Throwable).initCause(cause) - } - } -} - -/** - * Signals that Kotlin reflection had reached an inconsistent state from which it cannot recover. - */ -@Deprecated("Use 'KotlinReflectionInternalError' from kotlin.reflect.jvm.internal package", ReplaceWith("KotlinReflectionInternalError", "kotlin.reflect.jvm.internal.KotlinReflectionInternalError"), level = DeprecationLevel.WARNING) -open class KotlinReflectionInternalError(message: String) : Error(message) diff --git a/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt b/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt index 1bd02ad186f..38e97a1777d 100644 --- a/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt +++ b/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt @@ -28,7 +28,7 @@ import kotlin.reflect.jvm.isAccessible * @see [kotlin.reflect.jvm.isAccessible] */ @SinceKotlin("1.1") -class IllegalCallableAccessException(cause: IllegalAccessException) : kotlin.reflect.IllegalCallableAccessException(cause) +class IllegalCallableAccessException(cause: IllegalAccessException) : Exception(cause) /** * An exception that is thrown when `getDelegate` is invoked on a [KProperty] object that was not made accessible @@ -50,5 +50,4 @@ class IllegalPropertyDelegateAccessException(cause: IllegalAccessException) : Ex * and that class or the package no longer has that property. */ @SinceKotlin("1.1") -class NoSuchPropertyException(cause: Exception? = null) : kotlin.reflect.NoSuchPropertyException(cause) - +class NoSuchPropertyException(cause: Exception? = null) : Exception(cause) diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt index c385ac1eb41..701b5a0727e 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt @@ -16,10 +16,8 @@ package kotlin.reflect.jvm.internal -import kotlin.reflect.KotlinReflectionInternalError - /** * Signals that Kotlin reflection had reached an inconsistent state from which it cannot recover. * @suppress */ -class KotlinReflectionInternalError(message: String) : KotlinReflectionInternalError(message) \ No newline at end of file +class KotlinReflectionInternalError(message: String) : Error(message) diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-reflect.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-reflect.txt index 9ed6958fab9..c5365b4b7d1 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-reflect.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-reflect.txt @@ -1,37 +1,4 @@ -public class kotlin/reflect/IllegalCallableAccessException : java/lang/Exception { - public fun (Ljava/lang/IllegalAccessException;)V -} - -public final class kotlin/reflect/KClasses { - public static final fun getCompanionObject (Lkotlin/reflect/KClass;)Lkotlin/reflect/KClass; - public static final fun getCompanionObjectInstance (Lkotlin/reflect/KClass;)Ljava/lang/Object; - public static final fun getDeclaredFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getDeclaredMemberExtensionFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getDeclaredMemberExtensionProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getDeclaredMemberFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getDeclaredMemberProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getDefaultType (Lkotlin/reflect/KClass;)Lkotlin/reflect/KType; - public static final fun getFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getMemberExtensionFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getMemberExtensionProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getMemberFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getMemberProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getPrimaryConstructor (Lkotlin/reflect/KClass;)Lkotlin/reflect/KFunction; - public static final fun getStaticFunctions (Lkotlin/reflect/KClass;)Ljava/util/Collection; - public static final fun getStaticProperties (Lkotlin/reflect/KClass;)Ljava/util/Collection; -} - -public class kotlin/reflect/KotlinReflectionInternalError : java/lang/Error { - public fun (Ljava/lang/String;)V -} - -public class kotlin/reflect/NoSuchPropertyException : java/lang/Exception { - public fun ()V - public fun (Ljava/lang/Exception;)V - public synthetic fun (Ljava/lang/Exception;ILkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class kotlin/reflect/full/IllegalCallableAccessException : kotlin/reflect/IllegalCallableAccessException { +public final class kotlin/reflect/full/IllegalCallableAccessException : java/lang/Exception { public fun (Ljava/lang/IllegalAccessException;)V } @@ -91,7 +58,7 @@ public final class kotlin/reflect/full/KTypes { public static final fun withNullability (Lkotlin/reflect/KType;Z)Lkotlin/reflect/KType; } -public final class kotlin/reflect/full/NoSuchPropertyException : kotlin/reflect/NoSuchPropertyException { +public final class kotlin/reflect/full/NoSuchPropertyException : java/lang/Exception { public fun ()V public fun (Ljava/lang/Exception;)V public synthetic fun (Ljava/lang/Exception;ILkotlin/jvm/internal/DefaultConstructorMarker;)V