Migrate exceptions to kotlin.reflect.full package and KotlinReflectInternalError to kotlin.reflect.jvm.internal package.

This commit is contained in:
Ilya Gorbunov
2016-12-22 21:02:13 +03:00
parent 9614404914
commit f7d64ac807
16 changed files with 71 additions and 11 deletions
@@ -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)
@@ -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.
@@ -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.
@@ -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)
@@ -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
/**
@@ -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(
@@ -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<*>
@@ -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<out R> : KCallable<R> {
@@ -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
@@ -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 {
@@ -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
@@ -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<out R> private constructor(
@@ -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(
@@ -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)
@@ -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
@@ -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")