diff --git a/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt b/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt deleted file mode 100644 index 9837224636a..00000000000 --- a/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-2016 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("KAnnotatedElements") -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package kotlin.reflect - -/** - * Returns an annotation of the given type on this element. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'findAnnotation' from kotlin.reflect.full package", ReplaceWith("this.findAnnotation()", "kotlin.reflect.full.findAnnotation"), level = DeprecationLevel.ERROR) -@SinceKotlin("1.1") -inline fun KAnnotatedElement.findAnnotation(): T? = - @Suppress("UNCHECKED_CAST") - annotations.firstOrNull { it is T } as T? diff --git a/core/reflection.jvm/src/kotlin/reflect/KCallables.kt b/core/reflection.jvm/src/kotlin/reflect/KCallables.kt deleted file mode 100644 index a80855b4b80..00000000000 --- a/core/reflection.jvm/src/kotlin/reflect/KCallables.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2010-2016 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("KCallables") -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package kotlin.reflect - -import kotlin.reflect.full.extensionReceiverParameter -import kotlin.reflect.full.findParameterByName -import kotlin.reflect.full.instanceParameter -import kotlin.reflect.full.valueParameters - -/** - * Returns a parameter representing the `this` instance needed to call this callable, - * or `null` if this callable is not a member of a class and thus doesn't take such parameter. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'instanceParameter' from kotlin.reflect.full package", ReplaceWith("this.instanceParameter", "kotlin.reflect.full.instanceParameter"), level = DeprecationLevel.ERROR) -@SinceKotlin("1.1") -inline val KCallable<*>.instanceParameter: KParameter? - get() = this.instanceParameter - -/** - * Returns a parameter representing the extension receiver instance needed to call this callable, - * or `null` if this callable is not an extension. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'extensionReceiverParameter' from kotlin.reflect.full package", ReplaceWith("this.extensionReceiverParameter", "kotlin.reflect.full.extensionReceiverParameter"), level = DeprecationLevel.ERROR) -@SinceKotlin("1.1") -inline val KCallable<*>.extensionReceiverParameter: KParameter? - get() = this.extensionReceiverParameter - -/** - * Returns parameters of this callable, excluding the `this` instance and the extension receiver parameter. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'valueParameters' from kotlin.reflect.full package", ReplaceWith("this.valueParameters", "kotlin.reflect.full.valueParameters"), level = DeprecationLevel.ERROR) -@SinceKotlin("1.1") -inline val KCallable<*>.valueParameters: List - get() = this.valueParameters - -/** - * Returns the parameter of this callable with the given name, or `null` if there's no such parameter. - */ -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'findParameterByName' from kotlin.reflect.full package", ReplaceWith("this.findParameterByName", "kotlin.reflect.full.findParameterByName"), level = DeprecationLevel.ERROR) -@SinceKotlin("1.1") -inline fun KCallable<*>.findParameterByName(name: String): KParameter? { - return this.findParameterByName(name) -} diff --git a/core/reflection.jvm/src/kotlin/reflect/KClasses.kt b/core/reflection.jvm/src/kotlin/reflect/KClasses.kt index c6f9a44db64..08dec7a880b 100644 --- a/core/reflection.jvm/src/kotlin/reflect/KClasses.kt +++ b/core/reflection.jvm/src/kotlin/reflect/KClasses.kt @@ -85,16 +85,6 @@ inline val KClass<*>.defaultType: KType get() = this.defaultType -/** - * Returns all functions and properties declared in this class. - * Does not include members declared in supertypes. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'declaredMembers' from kotlin.reflect.full package", ReplaceWith("this.declaredMembers", "kotlin.reflect.full.declaredMembers"), level = DeprecationLevel.ERROR) -inline val KClass<*>.declaredMembers: Collection> - get() = this.declaredMembers - /** * 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. @@ -194,92 +184,3 @@ inline val KClass.declaredMemberProperties: Collection KClass.declaredMemberExtensionProperties: Collection> get() = this.declaredMemberExtensionProperties - - -/** - * Immediate superclasses of this class, in the order they are listed in the source code. - * Includes superclasses and superinterfaces of the class, but does not include the class itself. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'superclasses' from kotlin.reflect.full package", ReplaceWith("this.superclasses", "kotlin.reflect.full.superclasses"), level = DeprecationLevel.ERROR) -inline val KClass<*>.superclasses: List> - get() = this.superclasses - -/** - * All supertypes of this class, including indirect ones, in no particular order. - * There is not more than one type in the returned collection that has any given classifier. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'allSupertypes' from kotlin.reflect.full package", ReplaceWith("this.allSupertypes", "kotlin.reflect.full.allSupertypes"), level = DeprecationLevel.ERROR) -inline val KClass<*>.allSupertypes: Collection - get() = this.allSupertypes -/** - * All superclasses of this class, including indirect ones, in no particular order. - * Includes superclasses and superinterfaces of the class, but does not include the class itself. - * The returned collection does not contain more than one instance of any given class. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'allSuperclasses' from kotlin.reflect.full package", ReplaceWith("this.allSuperclasses", "kotlin.reflect.full.allSuperclasses"), level = DeprecationLevel.ERROR) -inline val KClass<*>.allSuperclasses: Collection> - get() = this.allSuperclasses -/** - * Returns `true` if `this` class is the same or is a (possibly indirect) subclass of [base], `false` otherwise. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'isSubclassOf' from kotlin.reflect.full package", ReplaceWith("this.isSubclassOf(base)", "kotlin.reflect.full.isSubclassOf"), level = DeprecationLevel.ERROR) -inline fun KClass<*>.isSubclassOf(base: KClass<*>): Boolean = - this.isSubclassOf(base) - -/** - * Returns `true` if `this` class is the same or is a (possibly indirect) superclass of [derived], `false` otherwise. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'isSuperclassOf' from kotlin.reflect.full package", ReplaceWith("this.isSuperclassOf(derived)", "kotlin.reflect.full.isSuperclassOf"), level = DeprecationLevel.ERROR) -inline fun KClass<*>.isSuperclassOf(derived: KClass<*>): Boolean = - this.isSuperclassOf(derived) - - -/** - * Casts the given [value] to the class represented by this [KClass] object. - * Throws an exception if the value is `null` or if it is not an instance of this class. - * - * @see [KClass.isInstance] - * @see [KClass.safeCast] - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'cast' from kotlin.reflect.full package", ReplaceWith("this.cast(value)", "kotlin.reflect.full.cast"), level = DeprecationLevel.ERROR) -inline fun KClass.cast(value: Any?): T { - return this.cast(value) -} - -/** - * Casts the given [value] to the class represented by this [KClass] object. - * Returns `null` if the value is `null` or if it is not an instance of this class. - * - * @see [KClass.isInstance] - * @see [KClass.cast] - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'safeCast' from kotlin.reflect.full package", ReplaceWith("this.safeCast(value)", "kotlin.reflect.full.safeCast"), level = DeprecationLevel.ERROR) -inline fun KClass.safeCast(value: Any?): T? { - return this.safeCast(value) -} - - -/** - * Creates a new instance of the class, calling a constructor which either has no parameters or all parameters of which are optional - * (see [KParameter.isOptional]). If there are no or many such constructors, an exception is thrown. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'createInstance' from kotlin.reflect.full package", ReplaceWith("this.createInstance()", "kotlin.reflect.full.createInstance"), level = DeprecationLevel.ERROR) -inline fun KClass.createInstance(): T { - return this.createInstance() -} diff --git a/core/reflection.jvm/src/kotlin/reflect/KClassifiers.kt b/core/reflection.jvm/src/kotlin/reflect/KClassifiers.kt deleted file mode 100644 index 9d3ca1a29b8..00000000000 --- a/core/reflection.jvm/src/kotlin/reflect/KClassifiers.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2010-2016 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("KClassifiers") -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package kotlin.reflect - -import kotlin.reflect.full.createType -import kotlin.reflect.full.starProjectedType - -/** - * Creates a [KType] instance with the given classifier, type arguments, nullability and annotations. - * If the number of passed type arguments is not equal to the total number of type parameters of a classifier, - * an exception is thrown. If any of the arguments does not satisfy the bounds of the corresponding type parameter, - * an exception is thrown. - * - * For classifiers representing type parameters, the type argument list must always be empty. - * For classes, the type argument list should contain arguments for the type parameters of the class. If the class is `inner`, - * the list should follow with arguments for the type parameters of its outer class, and so forth until a class is - * not `inner`, or is declared on the top level. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'createType' from kotlin.reflect.full package", ReplaceWith("this.createType(arguments, nullable, annotations)", "kotlin.reflect.full.createType"), level = DeprecationLevel.ERROR) -inline fun KClassifier.createType( - arguments: List = emptyList(), - nullable: Boolean = false, - annotations: List = emptyList() -): KType = this.createType(arguments, nullable, annotations) - -/** - * Creates an instance of [KType] with the given classifier, substituting all its type parameters with star projections. - * The resulting type is not marked as nullable and does not have any annotations. - * - * @see [KClassifier.createType] - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'starProjectedType' from kotlin.reflect.full package", ReplaceWith("this.starProjectedType", "kotlin.reflect.full.starProjectedType"), level = DeprecationLevel.ERROR) -inline val KClassifier.starProjectedType: KType - get() = this.starProjectedType \ No newline at end of file diff --git a/core/reflection.jvm/src/kotlin/reflect/KTypes.kt b/core/reflection.jvm/src/kotlin/reflect/KTypes.kt deleted file mode 100644 index 0848efe9194..00000000000 --- a/core/reflection.jvm/src/kotlin/reflect/KTypes.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2010-2016 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("KTypes") -@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package kotlin.reflect - -import kotlin.reflect.full.isSubtypeOf -import kotlin.reflect.full.isSupertypeOf -import kotlin.reflect.full.withNullability - -/** - * Returns a new type with the same classifier, arguments and annotations as the given type, and with the given nullability. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'withNullability' from kotlin.reflect.full package", ReplaceWith("this.withNullability(nullable)", "kotlin.reflect.full.withNullability"), level = DeprecationLevel.ERROR) -inline fun KType.withNullability(nullable: Boolean): KType = this.withNullability(nullable) - - -/** - * Returns `true` if `this` type is the same or is a subtype of [other], `false` otherwise. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'isSubtypeOf' from kotlin.reflect.full package", ReplaceWith("this.isSubtypeOf(other)", "kotlin.reflect.full.isSubtypeOf"), level = DeprecationLevel.ERROR) -inline fun KType.isSubtypeOf(other: KType): Boolean = this.isSubtypeOf(other) - -/** - * Returns `true` if `this` type is the same or is a supertype of [other], `false` otherwise. - */ -@SinceKotlin("1.1") -@kotlin.internal.LowPriorityInOverloadResolution -@Deprecated("Use 'isSupertypeOf' from kotlin.reflect.full package", ReplaceWith("this.isSupertypeOf(other)", "kotlin.reflect.full.isSupertypeOf"), level = DeprecationLevel.ERROR) -inline fun KType.isSupertypeOf(other: KType): Boolean = this.isSupertypeOf(other)