diff --git a/core/reflection.jvm/src/kotlin/reflect/exceptions.kt b/core/reflection.jvm/src/kotlin/reflect/exceptions.kt index 76cc7f13d9e..7f1e17ed701 100644 --- a/core/reflection.jvm/src/kotlin/reflect/exceptions.kt +++ b/core/reflection.jvm/src/kotlin/reflect/exceptions.kt @@ -24,7 +24,8 @@ package kotlin.reflect * * @see [kotlin.reflect.jvm.isAccessible] */ -class IllegalCallableAccessException(cause: IllegalAccessException) : Exception(cause.message) { +@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) @@ -35,7 +36,8 @@ class IllegalCallableAccessException(cause: IllegalAccessException) : Exception( * 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. */ -class NoSuchPropertyException(cause: Exception? = null) : Exception() { +@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) { @@ -47,4 +49,5 @@ class NoSuchPropertyException(cause: Exception? = null) : Exception() { /** * Signals that Kotlin reflection had reached an inconsistent state from which it cannot recover. */ -class KotlinReflectionInternalError(message: String) : Error(message) +@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/KClasses.kt b/core/reflection.jvm/src/kotlin/reflect/full/KClasses.kt index e14110de089..881e3f07c10 100644 --- a/core/reflection.jvm/src/kotlin/reflect/full/KClasses.kt +++ b/core/reflection.jvm/src/kotlin/reflect/full/KClasses.kt @@ -28,6 +28,7 @@ import kotlin.reflect.jvm.internal.KCallableImpl import kotlin.reflect.jvm.internal.KClassImpl import kotlin.reflect.jvm.internal.KFunctionImpl import kotlin.reflect.jvm.internal.KTypeImpl +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError /** * Returns the primary constructor of this class, or `null` if this class has no primary constructor. diff --git a/core/reflection.jvm/src/kotlin/reflect/full/KClassifiers.kt b/core/reflection.jvm/src/kotlin/reflect/full/KClassifiers.kt index b2ec005474d..baad1bcc20e 100644 --- a/core/reflection.jvm/src/kotlin/reflect/full/KClassifiers.kt +++ b/core/reflection.jvm/src/kotlin/reflect/full/KClassifiers.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.types.* import kotlin.reflect.* import kotlin.reflect.jvm.internal.KClassifierImpl import kotlin.reflect.jvm.internal.KTypeImpl +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError /** * Creates a [KType] instance with the given classifier, type arguments, nullability and annotations. diff --git a/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt b/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt new file mode 100644 index 00000000000..9e55c6dc687 --- /dev/null +++ b/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package kotlin.reflect.full + + +/** + * 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] + */ +class IllegalCallableAccessException(cause: IllegalAccessException) : kotlin.reflect.IllegalCallableAccessException(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. + */ +class NoSuchPropertyException(cause: Exception? = null) : kotlin.reflect.NoSuchPropertyException(cause) + diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/KTypesJvm.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/KTypesJvm.kt index 84be2a34248..4d4379241ee 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/KTypesJvm.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/KTypesJvm.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind.ANNOTATION_CLASS import org.jetbrains.kotlin.descriptors.ClassKind.INTERFACE import kotlin.reflect.* +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError import kotlin.reflect.jvm.internal.KTypeImpl /** diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/AnnotationConstructorCaller.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/AnnotationConstructorCaller.kt index 5e9d042aed4..d8a1ce83975 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/AnnotationConstructorCaller.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/AnnotationConstructorCaller.kt @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.load.java.structure.reflect.wrapperByPrimitive import java.lang.reflect.Proxy import java.util.* import kotlin.reflect.KClass -import kotlin.reflect.KotlinReflectionInternalError import java.lang.reflect.Method as ReflectMethod internal class AnnotationConstructorCaller( diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/EmptyContainerForLocal.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/EmptyContainerForLocal.kt index d99d2174acc..ca678bfac67 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/EmptyContainerForLocal.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/EmptyContainerForLocal.kt @@ -21,7 +21,6 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.name.Name import kotlin.reflect.KCallable -import kotlin.reflect.KotlinReflectionInternalError internal object EmptyContainerForLocal : KDeclarationContainerImpl() { override val jClass: Class<*> diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt index cd3092f5829..cc648a1489e 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor import java.lang.reflect.Type import java.util.* import kotlin.reflect.* +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError import kotlin.reflect.jvm.javaType internal abstract class KCallableImpl : KCallable { diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt index c0ec584e620..48178c28a6b 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.deserialization.findClassAcrossModuleDependencies import kotlin.jvm.internal.TypeIntrinsics import kotlin.reflect.* +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError import kotlin.reflect.jvm.internal.KDeclarationContainerImpl.MemberBelonginess.DECLARED import kotlin.reflect.jvm.internal.KDeclarationContainerImpl.MemberBelonginess.INHERITED diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt index 7b3b9be36c0..b1f320fe469 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt @@ -29,7 +29,6 @@ import java.lang.reflect.Constructor import java.lang.reflect.Method import java.util.* import kotlin.jvm.internal.ClassBasedDeclarationContainer -import kotlin.reflect.KotlinReflectionInternalError internal abstract class KDeclarationContainerImpl : ClassBasedDeclarationContainer { abstract inner class Data { diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt index 649e3785802..925a89cbc84 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt @@ -27,7 +27,6 @@ import java.lang.reflect.Modifier import kotlin.jvm.internal.CallableReference import kotlin.jvm.internal.FunctionImpl import kotlin.reflect.KFunction -import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.jvm.internal.AnnotationConstructorCaller.CallMode.CALL_BY_NAME import kotlin.reflect.jvm.internal.AnnotationConstructorCaller.CallMode.POSITIONAL_CALL import kotlin.reflect.jvm.internal.AnnotationConstructorCaller.Origin.JAVA diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt index 3a99b8c53b2..fa0ff981179 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt @@ -29,7 +29,6 @@ import kotlin.jvm.internal.CallableReference import kotlin.reflect.KFunction import kotlin.reflect.KMutableProperty import kotlin.reflect.KProperty -import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.jvm.internal.JvmPropertySignature.* internal abstract class KPropertyImpl private constructor( diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt index 9cd2aeea301..c18c4caf4f8 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt @@ -33,7 +33,6 @@ import kotlin.LazyThreadSafetyMode.PUBLICATION import kotlin.reflect.KClassifier import kotlin.reflect.KType import kotlin.reflect.KTypeProjection -import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.jvm.jvmErasure internal class KTypeImpl( diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt new file mode 100644 index 00000000000..7818f77631f --- /dev/null +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KotlinReflectionInternalError.kt @@ -0,0 +1,24 @@ +/* + * 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. + */ + +package kotlin.reflect.jvm.internal + +import kotlin.reflect.KotlinReflectionInternalError + +/** + * Signals that Kotlin reflection had reached an inconsistent state from which it cannot recover. + */ +class KotlinReflectionInternalError(message: String) : KotlinReflectionInternalError(message) \ No newline at end of file diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt index f93a8c72e9e..39540e2b265 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt @@ -45,7 +45,6 @@ import java.lang.reflect.Constructor import java.lang.reflect.Field import java.lang.reflect.Member import java.lang.reflect.Method -import kotlin.reflect.KotlinReflectionInternalError internal sealed class JvmFunctionSignature { abstract fun asString(): String diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/util.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/util.kt index 17f2c9cd219..43e2df76366 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/util.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/util.kt @@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.classId import kotlin.jvm.internal.FunctionReference import kotlin.jvm.internal.PropertyReference -import kotlin.reflect.IllegalCallableAccessException +import kotlin.reflect.full.IllegalCallableAccessException import kotlin.reflect.KVisibility internal val JVM_STATIC = FqName("kotlin.jvm.JvmStatic")