Get rid of deprecated annotations and modifiers in project code
This commit is contained in:
@@ -26,7 +26,7 @@ package kotlin.reflect
|
||||
*/
|
||||
public class IllegalCallableAccessException(cause: IllegalAccessException) : Exception(cause.getMessage()) {
|
||||
init {
|
||||
@suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
(this as java.lang.Throwable).initCause(cause)
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class IllegalCallableAccessException(cause: IllegalAccessException) : Exc
|
||||
*/
|
||||
public class NoSuchPropertyException(cause: Exception? = null) : Exception() {
|
||||
init {
|
||||
@suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
if (cause != null) {
|
||||
(this as java.lang.Throwable).initCause(cause)
|
||||
}
|
||||
|
||||
@@ -19,39 +19,39 @@ package kotlin.reflect.jvm
|
||||
import java.lang.reflect.Field
|
||||
import kotlin.reflect.*
|
||||
|
||||
@deprecated("Use kotlinProperty instead.", ReplaceWith("kotlinProperty"))
|
||||
@Deprecated("Use kotlinProperty instead.", ReplaceWith("kotlinProperty"))
|
||||
public val Field.kotlin: KProperty<*>?
|
||||
get() = kotlinProperty
|
||||
|
||||
|
||||
@deprecated("Use memberProperties instead.", ReplaceWith("memberProperties"))
|
||||
@Deprecated("Use memberProperties instead.", ReplaceWith("memberProperties"))
|
||||
public val <T : Any> KClass<T>.properties: Collection<KProperty1<T, *>>
|
||||
get() = memberProperties
|
||||
|
||||
@deprecated("Use extensionProperties instead.", ReplaceWith("extensionProperties"))
|
||||
@Deprecated("Use extensionProperties instead.", ReplaceWith("extensionProperties"))
|
||||
public val <T : Any> KClass<T>.extensionProperties: Collection<KProperty2<T, *, *>>
|
||||
get() = memberExtensionProperties
|
||||
|
||||
@deprecated("Use declaredMemberProperties instead.", ReplaceWith("declaredMemberProperties"))
|
||||
@Deprecated("Use declaredMemberProperties instead.", ReplaceWith("declaredMemberProperties"))
|
||||
public val <T : Any> KClass<T>.declaredProperties: Collection<KProperty1<T, *>>
|
||||
get() = declaredMemberProperties
|
||||
|
||||
@deprecated("Use declaredMemberExtensionProperties instead.", ReplaceWith("declaredMemberExtensionProperties"))
|
||||
@Deprecated("Use declaredMemberExtensionProperties instead.", ReplaceWith("declaredMemberExtensionProperties"))
|
||||
public val <T : Any> KClass<T>.declaredExtensionProperties: Collection<KProperty2<T, *, *>>
|
||||
get() = declaredMemberExtensionProperties
|
||||
|
||||
|
||||
@deprecated("Use isAccessible instead.", ReplaceWith("isAccessible"))
|
||||
@Deprecated("Use isAccessible instead.", ReplaceWith("isAccessible"))
|
||||
public var KProperty<*>.accessible: Boolean
|
||||
get() = isAccessible
|
||||
set(value) { isAccessible = value }
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Moved to package kotlin.jvm", ReplaceWith("java"))
|
||||
@Deprecated("Moved to package kotlin.jvm", ReplaceWith("java"))
|
||||
public val <T : Any> KClass<T>.java: Class<T>
|
||||
get() = java
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Moved to package kotlin.jvm", ReplaceWith("kotlin"))
|
||||
@Deprecated("Moved to package kotlin.jvm", ReplaceWith("kotlin"))
|
||||
public val <T : Any> Class<T>.kotlin: KClass<T>
|
||||
get() = kotlin
|
||||
|
||||
@@ -60,7 +60,7 @@ internal interface KCallableImpl<out R> : KCallable<R>, KAnnotatedElementImpl {
|
||||
override val returnType: KType
|
||||
get() = KTypeImpl(descriptor.returnType!!) { caller.returnType }
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun call(vararg args: Any?): R = reflectionCall {
|
||||
return caller.call(args) as R
|
||||
}
|
||||
@@ -112,7 +112,7 @@ internal interface KCallableImpl<out R> : KCallable<R>, KAnnotatedElementImpl {
|
||||
arguments.add(null)
|
||||
}
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return reflectionCall {
|
||||
caller.call(arguments.toTypedArray()) as R
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ internal class KClassImpl<T : Any>(override val jClass: Class<T>) : KDeclaration
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun getProperties(name: Name): Collection<PropertyDescriptor> =
|
||||
(memberScope.getProperties(name, NoLookupLocation.FROM_REFLECTION) +
|
||||
staticScope.getProperties(name, NoLookupLocation.FROM_REFLECTION)) as Collection<PropertyDescriptor>
|
||||
@@ -110,7 +110,7 @@ internal class KClassImpl<T : Any>(override val jClass: Class<T>) : KDeclaration
|
||||
}
|
||||
}
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override val constructors: Collection<KFunction<T>>
|
||||
get() = constructorDescriptors.map {
|
||||
KFunctionImpl(this, it) as KFunction<T>
|
||||
@@ -137,7 +137,7 @@ internal class KClassImpl<T : Any>(override val jClass: Class<T>) : KDeclaration
|
||||
}
|
||||
}.filterNotNull().map { KClassImpl(it) }
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override val objectInstance: T? by ReflectProperties.lazy {
|
||||
val descriptor = descriptor
|
||||
if (descriptor.kind != ClassKind.OBJECT) return@lazy null
|
||||
|
||||
@@ -158,7 +158,7 @@ internal abstract class KDeclarationContainerImpl : ClassBasedDeclarationContain
|
||||
|
||||
// TODO: check resulting method's return type
|
||||
fun findMethodBySignature(
|
||||
@suppress("UNUSED_PARAMETER") proto: ProtoBuf.Callable,
|
||||
@Suppress("UNUSED_PARAMETER") proto: ProtoBuf.Callable,
|
||||
signature: JvmProtoBuf.JvmMethodSignature,
|
||||
nameResolver: NameResolver,
|
||||
declared: Boolean
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:suppress("DEPRECATED_SYMBOL_WITH_MESSAGE")
|
||||
@file:Suppress("DEPRECATED_SYMBOL_WITH_MESSAGE")
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
|
||||
@@ -44,7 +44,7 @@ internal class KPackageImpl(override val jClass: Class<*>, val moduleName: Strin
|
||||
override val constructorDescriptors: Collection<ConstructorDescriptor>
|
||||
get() = emptyList()
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun getProperties(name: Name): Collection<PropertyDescriptor> =
|
||||
scope.getProperties(name, NoLookupLocation.FROM_REFLECTION) as Collection<PropertyDescriptor>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ internal fun <T : Any> foreignKotlinClass(jClass: Class<T>): KClassImpl<T> {
|
||||
val name = jClass.getName()
|
||||
val cached = FOREIGN_K_CLASSES[name]
|
||||
if (cached is WeakReference<*>) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val kClass = cached.get() as KClassImpl<T>?
|
||||
if (kClass?.jClass == jClass) {
|
||||
return kClass!!
|
||||
|
||||
@@ -70,7 +70,7 @@ public val KFunction<*>.javaMethod: Method?
|
||||
* Returns a Java [Constructor] instance corresponding to the given Kotlin function,
|
||||
* or `null` if this function is not a constructor or cannot be represented by a Java [Constructor].
|
||||
*/
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
public val <T> KFunction<T>.javaConstructor: Constructor<T>?
|
||||
get() = (this as? KCallableImpl<T>)?.caller?.member as? Constructor<T>
|
||||
|
||||
@@ -93,7 +93,7 @@ public val KType.javaType: Type
|
||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#package-level-functions)
|
||||
* for more information.
|
||||
*/
|
||||
@deprecated("After dropping old package facades it would be impossible to retrieve package by java class")
|
||||
@Deprecated("After dropping old package facades it would be impossible to retrieve package by java class")
|
||||
public val Class<*>.kotlinPackage: KPackage?
|
||||
get() = if (getSimpleName().endsWith("Package") &&
|
||||
getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) {
|
||||
|
||||
@@ -43,6 +43,6 @@ public fun <R> Function<R>.reflect(): KFunction<R>? {
|
||||
val context = DeserializationContext(moduleData.deserialization, nameResolver, moduleData.module,
|
||||
parentTypeDeserializer = null, typeParameters = listOf())
|
||||
val descriptor = MemberDeserializer(context).loadCallable(proto) as FunctionDescriptor
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return KFunctionImpl(EmptyContainerForLocal, descriptor) as KFunction<R>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user