Get rid of deprecated annotations and modifiers in project code
This commit is contained in:
+3
-3
@@ -45,7 +45,6 @@ import org.jetbrains.kotlin.types.typeUtil.createProjection
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceAnnotations
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.util.HashSet
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
private val JAVA_LANG_CLASS_FQ_NAME: FqName = FqName("java.lang.Class")
|
||||
|
||||
@@ -288,12 +287,13 @@ class LazyJavaTypeResolver(
|
||||
}
|
||||
|
||||
public object FlexibleJavaClassifierTypeCapabilities : FlexibleTypeCapabilities {
|
||||
platformStatic fun create(lowerBound: JetType, upperBound: JetType) = DelegatingFlexibleType.create(lowerBound, upperBound, this)
|
||||
@JvmStatic
|
||||
fun create(lowerBound: JetType, upperBound: JetType) = DelegatingFlexibleType.create(lowerBound, upperBound, this)
|
||||
|
||||
override val id: String get() = "kotlin.jvm.PlatformType"
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>, jetType: JetType, flexibility: Flexibility): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when (capabilityClass) {
|
||||
javaClass<CustomTypeVariable>(), javaClass<Specificity>() -> Impl(flexibility) as T
|
||||
else -> null
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public object RawTypeCapabilities : TypeCapabilities {
|
||||
}
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when(capabilityClass) {
|
||||
javaClass<CustomSubstitutionCapability>() -> RawSubstitutionCapability as T
|
||||
javaClass<CustomFlexibleRendering>() -> RawFlexibleRendering as T
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ public fun <D : CallableMemberDescriptor> D.enhanceSignature(): D {
|
||||
val enhancedReturnType = parts(isCovariant = true) { it.getReturnType()!! }.enhance()
|
||||
|
||||
if (this is JavaCallableMemberDescriptor) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return this.enhance(enhancedReceiverType, enhancedValueParametersTypes, enhancedReturnType) as D
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ private fun <D : CallableMemberDescriptor> D.parts(isCovariant: Boolean, collect
|
||||
return SignatureParts(
|
||||
collector(this),
|
||||
this.getOverriddenDescriptors().map {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
collector(it as D)
|
||||
},
|
||||
isCovariant
|
||||
|
||||
@@ -16,22 +16,24 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import kotlin.platform.platformStatic
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
// The purpose of this class is to hold a unique signature of either a method or a field, so that annotations on a member can be put
|
||||
// into a map indexed by these signatures
|
||||
data class MemberSignature private constructor(private val signature: String) {
|
||||
companion object {
|
||||
platformStatic public fun fromMethodNameAndDesc(nameAndDesc: String): MemberSignature {
|
||||
@JvmStatic
|
||||
public fun fromMethodNameAndDesc(nameAndDesc: String): MemberSignature {
|
||||
return MemberSignature(nameAndDesc)
|
||||
}
|
||||
|
||||
platformStatic public fun fromFieldNameAndDesc(name: Name, desc: String): MemberSignature {
|
||||
@JvmStatic
|
||||
public fun fromFieldNameAndDesc(name: Name, desc: String): MemberSignature {
|
||||
return MemberSignature(name.asString() + "#" + desc)
|
||||
}
|
||||
|
||||
platformStatic public fun fromMethodSignatureAndParameterIndex(signature: MemberSignature, index: Int): MemberSignature {
|
||||
@JvmStatic
|
||||
public fun fromMethodSignatureAndParameterIndex(signature: MemberSignature, index: Int): MemberSignature {
|
||||
return MemberSignature(signature.signature + "@" + index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ public class PackageParts(val packageFqName: String) {
|
||||
packageFqName.hashCode() * 31 + parts.hashCode()
|
||||
|
||||
companion object {
|
||||
@jvmStatic public fun PackageParts.serialize(builder: JvmPackageTable.PackageTable.Builder) {
|
||||
@JvmStatic
|
||||
public fun PackageParts.serialize(builder: JvmPackageTable.PackageTable.Builder) {
|
||||
if (this.parts.isNotEmpty()) {
|
||||
val packageParts = JvmPackageTable.PackageParts.newBuilder()
|
||||
packageParts.setPackageFqName(this.packageFqName)
|
||||
|
||||
+4
-5
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.serialization.jvm
|
||||
import com.google.protobuf.ExtensionRegistryLite
|
||||
import org.jetbrains.kotlin.serialization.ClassData
|
||||
import org.jetbrains.kotlin.serialization.PackageData
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object JvmProtoBufUtil {
|
||||
public val EXTENSION_REGISTRY: ExtensionRegistryLite = run {
|
||||
@@ -28,15 +27,15 @@ public object JvmProtoBufUtil {
|
||||
registry
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readClassDataFrom(encodedData: Array<String>): ClassData = readClassDataFrom(BitEncoding.decodeBytes(encodedData))
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readClassDataFrom(data: ByteArray): ClassData = ClassData.read(data, EXTENSION_REGISTRY)
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readPackageDataFrom(encodedData: Array<String>): PackageData = readPackageDataFrom(BitEncoding.decodeBytes(encodedData))
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun readPackageDataFrom(data: ByteArray): PackageData = PackageData.read(data, EXTENSION_REGISTRY)
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Method
|
||||
|
||||
suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
private val TYPES_ELIGIBLE_FOR_SIMPLE_VISIT = setOf(
|
||||
// Primitives
|
||||
javaClass<java.lang.Integer>(), javaClass<java.lang.Character>(), javaClass<java.lang.Byte>(), javaClass<java.lang.Long>(),
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.builtins
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import java.util.Collections
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object CompanionObjectMapping {
|
||||
private val classes = linkedSetOf<ClassDescriptor>()
|
||||
@@ -33,10 +32,12 @@ public object CompanionObjectMapping {
|
||||
classes.add(builtIns.getEnum())
|
||||
}
|
||||
|
||||
public platformStatic fun allClassesWithIntrinsicCompanions(): Set<ClassDescriptor> =
|
||||
@JvmStatic
|
||||
public fun allClassesWithIntrinsicCompanions(): Set<ClassDescriptor> =
|
||||
Collections.unmodifiableSet(classes)
|
||||
|
||||
public platformStatic fun hasMappingToObject(classDescriptor: ClassDescriptor): Boolean {
|
||||
@JvmStatic
|
||||
public fun hasMappingToObject(classDescriptor: ClassDescriptor): Boolean {
|
||||
return DescriptorUtils.isCompanionObject(classDescriptor) &&
|
||||
classDescriptor.getContainingDeclaration() in classes
|
||||
}
|
||||
|
||||
+2
-3
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.descriptors.annotations
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class AnnotationsImpl : Annotations {
|
||||
private val annotations: List<AnnotationDescriptor>
|
||||
@@ -33,7 +32,7 @@ public class AnnotationsImpl : Annotations {
|
||||
// List<AnnotationDescriptor> and List<AnnotationWithTarget> have the same signature
|
||||
private constructor(
|
||||
targetedAnnotations: List<AnnotationWithTarget>,
|
||||
@suppress("UNUSED_PARAMETER") i: Int
|
||||
@Suppress("UNUSED_PARAMETER") i: Int
|
||||
) {
|
||||
this.targetedAnnotations = targetedAnnotations
|
||||
this.annotations = targetedAnnotations.filter { it.target == null }.map { it.annotation }
|
||||
@@ -61,7 +60,7 @@ public class AnnotationsImpl : Annotations {
|
||||
override fun toString() = annotations.toString()
|
||||
|
||||
companion object {
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun create(annotationsWithTargets: List<AnnotationWithTarget>): AnnotationsImpl {
|
||||
return AnnotationsImpl(annotationsWithTargets, 0)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface LookupLocation {
|
||||
}
|
||||
|
||||
public enum class NoLookupLocation : LookupLocation {
|
||||
@deprecated("Use more suitable constant if possible")
|
||||
@Deprecated("Use more suitable constant if possible")
|
||||
UNSORTED,
|
||||
FROM_IDE,
|
||||
FROM_BACKEND,
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class CapturedType(
|
||||
override fun getDelegate(): JetType = delegateType
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return if (capabilityClass == javaClass<SubtypingRepresentatives>()) this as T
|
||||
else super<DelegatingType>.getCapability(capabilityClass)
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class EnumValue(
|
||||
|
||||
public abstract class ErrorValue : ConstantValue<Unit>(Unit) {
|
||||
|
||||
deprecated("Should not be called, for this is not a real value, but a indication of an error")
|
||||
@Deprecated("Should not be called, for this is not a real value, but a indication of an error")
|
||||
override val value: Unit
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public interface JetScope {
|
||||
public fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor>
|
||||
|
||||
// Temporary overloads which will be dropped when all usages will be processed
|
||||
@deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, NoLookupLocation.UNSORTED)"))
|
||||
@Deprecated("Provide `location` explicitly", replaceWith = ReplaceWith("getClassifier(name, NoLookupLocation.UNSORTED)"))
|
||||
public final fun getClassifier(name: Name): ClassifierDescriptor? = getClassifier(name, NoLookupLocation.UNSORTED)
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
|
||||
|
||||
val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) })
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return substituted as D?
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -17,14 +17,14 @@
|
||||
package org.jetbrains.kotlin.types;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public class DisjointKeysUnionTypeSubstitution private constructor(
|
||||
private val first: TypeSubstitution,
|
||||
private val second: TypeSubstitution
|
||||
) : TypeSubstitution() {
|
||||
companion object {
|
||||
platformStatic public fun create(first: TypeSubstitution, second: TypeSubstitution): TypeSubstitution {
|
||||
@JvmStatic
|
||||
public fun create(first: TypeSubstitution, second: TypeSubstitution): TypeSubstitution {
|
||||
if (first.isEmpty()) return second
|
||||
if (second.isEmpty()) return first
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.types
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public open class JetTypeImpl
|
||||
private constructor(
|
||||
@@ -32,7 +31,7 @@ private constructor(
|
||||
) : AbstractJetType() {
|
||||
|
||||
companion object {
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
public fun create(annotations: Annotations,
|
||||
constructor: TypeConstructor,
|
||||
nullable: Boolean,
|
||||
@@ -41,7 +40,7 @@ private constructor(
|
||||
|
||||
= JetTypeImpl(annotations, constructor, nullable, arguments, null, memberScope)
|
||||
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
public fun create(annotations: Annotations,
|
||||
constructor: TypeConstructor,
|
||||
nullable: Boolean,
|
||||
@@ -56,7 +55,7 @@ private constructor(
|
||||
return JetTypeImpl(annotations, constructor, nullable, arguments, substitution, memberScope)
|
||||
}
|
||||
|
||||
@platformStatic
|
||||
@JvmStatic
|
||||
public fun create(annotations: Annotations,
|
||||
descriptor: ClassDescriptor,
|
||||
nullable: Boolean,
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
package org.jetbrains.kotlin.types
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public abstract class TypeSubstitution {
|
||||
companion object {
|
||||
platformStatic public val EMPTY: TypeSubstitution = object : TypeSubstitution() {
|
||||
@JvmStatic
|
||||
public val EMPTY: TypeSubstitution = object : TypeSubstitution() {
|
||||
override fun get(key: JetType) = null
|
||||
override fun isEmpty() = true
|
||||
override fun toString() = "Empty TypeSubstitution"
|
||||
@@ -43,14 +43,14 @@ public abstract class TypeConstructorSubstitution : TypeSubstitution() {
|
||||
public abstract fun get(key: TypeConstructor): TypeProjection?
|
||||
|
||||
companion object {
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun createByConstructorsMap(map: Map<TypeConstructor, TypeProjection>): TypeConstructorSubstitution =
|
||||
object : TypeConstructorSubstitution() {
|
||||
override fun get(key: TypeConstructor) = map[key]
|
||||
override fun isEmpty() = map.isEmpty()
|
||||
}
|
||||
|
||||
platformStatic
|
||||
@JvmStatic
|
||||
public fun createByParametersMap(map: Map<TypeParameterDescriptor, TypeProjection>): TypeConstructorSubstitution =
|
||||
object : TypeConstructorSubstitution() {
|
||||
override fun get(key: TypeConstructor) = map[key.declarationDescriptor]
|
||||
|
||||
@@ -44,7 +44,7 @@ public object DynamicTypeCapabilities : FlexibleTypeCapabilities {
|
||||
override val id: String get() = "kotlin.DynamicType"
|
||||
|
||||
override fun <T : TypeCapability> getCapability(capabilityClass: Class<T>, jetType: JetType, flexibility: Flexibility): T? {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return if (capabilityClass in Impl.capabilityClasses) Impl(flexibility) as T else null
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public interface FlexibleTypeCapabilities {
|
||||
fun <T: TypeCapability> getCapability(capabilityClass: Class<T>, jetType: JetType, flexibility: Flexibility): T?
|
||||
@@ -123,7 +122,8 @@ public open class DelegatingFlexibleType protected constructor(
|
||||
javaClass<FlexibleTypeDelegation>()
|
||||
)
|
||||
|
||||
platformStatic fun create(lowerBound: JetType, upperBound: JetType, extraCapabilities: FlexibleTypeCapabilities): JetType {
|
||||
@JvmStatic
|
||||
fun create(lowerBound: JetType, upperBound: JetType, extraCapabilities: FlexibleTypeCapabilities): JetType {
|
||||
if (lowerBound == upperBound) return lowerBound
|
||||
return DelegatingFlexibleType(lowerBound, upperBound, extraCapabilities)
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public open class DelegatingFlexibleType protected constructor(
|
||||
val extra = extraCapabilities.getCapability(capabilityClass, this, this)
|
||||
if (extra != null) return extra
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
if (capabilityClass in capabilityClasses) return this as T
|
||||
|
||||
return super<DelegatingType>.getCapability(capabilityClass)
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public abstract class DeserializedPackageFragment(
|
||||
protected var components: DeserializationComponents by Delegates.notNull()
|
||||
|
||||
// component dependency cycle
|
||||
Inject
|
||||
@Inject
|
||||
public fun setDeserializationComponents(components: DeserializationComponents) {
|
||||
this.components = components
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class LocalClassResolverImpl : LocalClassResolver {
|
||||
public var components: DeserializationComponents by Delegates.notNull()
|
||||
|
||||
// component dependency cycle
|
||||
Inject
|
||||
@Inject
|
||||
public fun setDeserializationComponents(components: DeserializationComponents) {
|
||||
this.components = components
|
||||
}
|
||||
|
||||
+2
-2
@@ -204,7 +204,7 @@ public class DeserializedClassDescriptor(
|
||||
override fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection<PropertyDescriptor>) {
|
||||
val fromSupertypes = ArrayList<PropertyDescriptor>()
|
||||
for (supertype in classDescriptor.getTypeConstructor().supertypes) {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fromSupertypes.addAll(supertype.memberScope.getProperties(name, NoLookupLocation.FOR_ALREADY_TRACKED) as Collection<PropertyDescriptor>)
|
||||
}
|
||||
generateFakeOverrides(name, fromSupertypes, descriptors)
|
||||
@@ -216,7 +216,7 @@ public class DeserializedClassDescriptor(
|
||||
override fun addFakeOverride(fakeOverride: CallableMemberDescriptor) {
|
||||
// TODO: report "cannot infer visibility"
|
||||
OverridingUtil.resolveUnknownVisibilityForMember(fakeOverride, null)
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
result.add(fakeOverride as D)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public abstract class DeserializedMemberScope protected constructor(
|
||||
val memberProtos = membersProtos()[ProtoKey(name, kind, isExtension = false)].orEmpty() +
|
||||
membersProtos()[ProtoKey(name, kind, isExtension = true)].orEmpty()
|
||||
|
||||
@suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return memberProtos.mapTo(LinkedHashSet<D>()) { memberProto ->
|
||||
c.memberDeserializer.loadCallable(memberProto) as D
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ package kotlin.jvm.internal
|
||||
public abstract class Lambda(private val arity: Int) : FunctionImpl() {
|
||||
override fun getArity() = arity
|
||||
|
||||
@suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
override fun toString() = "${(this as Object).getClass().getGenericInterfaces()[0]}"
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ private abstract class PrimitiveSpreadBuilder<T : Any>(private val size: Int) {
|
||||
|
||||
protected var position: Int = 0
|
||||
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
@Suppress("CAST_NEVER_SUCCEEDS")
|
||||
private val spreads: Array<T?> = arrayOfNulls<Any>(size) as Array<T?>
|
||||
|
||||
public fun addSpread(spreadArgument: T) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.utils
|
||||
|
||||
private val IDENTITY: (Any?) -> Any? = { it }
|
||||
|
||||
suppress("UNCHECKED_CAST")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
public fun <T> identity(): (T) -> T = IDENTITY as (T) -> T
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user