Remove deprecated API from package kotlin.reflect

This is needed to avoid the split package problem on Java 9 (KT-19258):
both kotlin-stdlib.jar and kotlin-reflect.jar export the package
kotlin.reflect
This commit is contained in:
Alexander Udalov
2017-08-18 10:27:30 +03:00
committed by Ilya Gorbunov
parent a4f378d04d
commit d41c1d572b
5 changed files with 5 additions and 280 deletions
@@ -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 <T : Any> KClass<T>.primaryConstructor: KFunction<T>?
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<K, V>` [defaultType] would return the type `MyMap<K, V>`.
*/
@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<KFunction<*>>
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<KFunction<*>>
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<KFunction<*>>
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<KFunction<*>>
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<KFunction<*>>
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<KFunction<*>>
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<KFunction<*>>
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<KProperty0<*>>
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 <T : Any> KClass<T>.memberProperties: Collection<KProperty1<T, *>>
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 <T : Any> KClass<T>.memberExtensionProperties: Collection<KProperty2<T, *, *>>
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 <T : Any> KClass<T>.declaredMemberProperties: Collection<KProperty1<T, *>>
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 <T : Any> KClass<T>.declaredMemberExtensionProperties: Collection<KProperty2<T, *, *>>
get() = this.declaredMemberExtensionProperties
@@ -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)
@@ -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)
@@ -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)
class KotlinReflectionInternalError(message: String) : Error(message)
@@ -1,37 +1,4 @@
public class kotlin/reflect/IllegalCallableAccessException : java/lang/Exception {
public fun <init> (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 <init> (Ljava/lang/String;)V
}
public class kotlin/reflect/NoSuchPropertyException : java/lang/Exception {
public fun <init> ()V
public fun <init> (Ljava/lang/Exception;)V
public synthetic fun <init> (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 <init> (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 <init> ()V
public fun <init> (Ljava/lang/Exception;)V
public synthetic fun <init> (Ljava/lang/Exception;ILkotlin/jvm/internal/DefaultConstructorMarker;)V