Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
+1
-2
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
|
||||
abstract class AbstractDeserializedPackageFragmentProvider(
|
||||
protected val storageManager: StorageManager,
|
||||
@@ -39,7 +38,7 @@ abstract class AbstractDeserializedPackageFragmentProvider(
|
||||
|
||||
protected abstract fun findPackage(fqName: FqName): DeserializedPackageFragment?
|
||||
|
||||
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> = fragments(fqName).singletonOrEmptyList()
|
||||
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> = listOfNotNull(fragments(fqName))
|
||||
|
||||
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> = emptySet()
|
||||
}
|
||||
|
||||
+1
-2
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
|
||||
class MemberDeserializer(private val c: DeserializationContext) {
|
||||
private val annotationDeserializer = AnnotationDeserializer(c.components.moduleDescriptor, c.components.notFoundClasses)
|
||||
@@ -267,7 +266,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
proto.varargElementType(c.typeTable)?.let { c.typeDeserializer.type(it) },
|
||||
SourceElement.NO_SOURCE
|
||||
)
|
||||
}.toReadOnlyList()
|
||||
}.toList()
|
||||
}
|
||||
|
||||
private fun DeclarationDescriptor.asProtoContainer(): ProtoContainer? = when (this) {
|
||||
|
||||
+1
-1
@@ -53,5 +53,5 @@ sealed class ProtoContainer(
|
||||
|
||||
abstract fun debugFqName(): FqName
|
||||
|
||||
override fun toString() = "${javaClass.simpleName}: ${debugFqName()}"
|
||||
override fun toString() = "${this::class.java.simpleName}: ${debugFqName()}"
|
||||
}
|
||||
|
||||
+3
-5
@@ -29,8 +29,6 @@ import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedAnnotationsWithPossibleTargets
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedTypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
import java.util.*
|
||||
|
||||
class TypeDeserializer(
|
||||
@@ -60,7 +58,7 @@ class TypeDeserializer(
|
||||
}
|
||||
|
||||
val ownTypeParameters: List<TypeParameterDescriptor>
|
||||
get() = typeParameterDescriptors.values.toReadOnlyList()
|
||||
get() = typeParameterDescriptors.values.toList()
|
||||
|
||||
// TODO: don't load identical types from TypeTable more than once
|
||||
fun type(proto: ProtoBuf.Type, additionalAnnotations: Annotations = Annotations.EMPTY): KotlinType {
|
||||
@@ -99,7 +97,7 @@ class TypeDeserializer(
|
||||
|
||||
val arguments = proto.collectAllArguments().mapIndexed { index, proto ->
|
||||
typeArgument(constructor.parameters.getOrNull(index), proto)
|
||||
}.toReadOnlyList()
|
||||
}.toList()
|
||||
|
||||
val simpleType = if (Flags.SUSPEND_TYPE.get(proto.flags)) {
|
||||
createSuspendFunctionType(annotations, constructor, arguments, proto.nullable)
|
||||
@@ -148,7 +146,7 @@ class TypeDeserializer(
|
||||
val result = when (functionTypeConstructor.parameters.size - arguments.size) {
|
||||
0 -> {
|
||||
val functionType = KotlinTypeFactory.simpleType(annotations, functionTypeConstructor, arguments, nullable)
|
||||
functionType.check { it.isFunctionType }?.let(::transformRuntimeFunctionTypeToSuspendFunction)
|
||||
functionType.takeIf { it.isFunctionType }?.let(::transformRuntimeFunctionTypeToSuspendFunction)
|
||||
}
|
||||
// This case for types written by eap compiler 1.1
|
||||
1 -> {
|
||||
|
||||
+1
-2
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
|
||||
class DeserializedAnnotations(
|
||||
storageManager: StorageManager,
|
||||
@@ -36,7 +35,7 @@ open class DeserializedAnnotationsWithPossibleTargets(
|
||||
storageManager: StorageManager,
|
||||
compute: () -> List<AnnotationWithTarget>
|
||||
) : Annotations {
|
||||
private val annotations = storageManager.createLazyValue { compute().toReadOnlyList() }
|
||||
private val annotations = storageManager.createLazyValue { compute().toList() }
|
||||
|
||||
override fun isEmpty(): Boolean = annotations().isEmpty()
|
||||
|
||||
|
||||
+2
-4
@@ -38,8 +38,6 @@ import org.jetbrains.kotlin.serialization.deserialization.*
|
||||
import org.jetbrains.kotlin.types.AbstractClassTypeConstructor
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
import java.util.*
|
||||
|
||||
class DeserializedClassDescriptor(
|
||||
@@ -127,7 +125,7 @@ class DeserializedClassDescriptor(
|
||||
override fun getUnsubstitutedPrimaryConstructor(): ClassConstructorDescriptor? = primaryConstructor()
|
||||
|
||||
private fun computeConstructors(): Collection<ClassConstructorDescriptor> =
|
||||
computeSecondaryConstructors() + unsubstitutedPrimaryConstructor.singletonOrEmptyList() +
|
||||
computeSecondaryConstructors() + listOfNotNull(unsubstitutedPrimaryConstructor) +
|
||||
c.components.additionalClassPartsProvider.getConstructors(this)
|
||||
|
||||
private fun computeSecondaryConstructors(): List<ClassConstructorDescriptor> =
|
||||
@@ -192,7 +190,7 @@ class DeserializedClassDescriptor(
|
||||
)
|
||||
}
|
||||
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
override fun getParameters() = parameters()
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ abstract class DeserializedMemberScope protected constructor(
|
||||
protected abstract fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean)
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, " {")
|
||||
p.println(this::class.java.simpleName, " {")
|
||||
p.pushIndent()
|
||||
|
||||
p.println("containingDeclaration = " + c.containingDeclaration)
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ class SinceKotlinInfo(
|
||||
is ProtoBuf.Function -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.Property -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
is ProtoBuf.TypeAlias -> if (proto.hasSinceKotlinInfo()) proto.sinceKotlinInfo else return null
|
||||
else -> throw IllegalStateException("Unexpected declaration: ${proto.javaClass}")
|
||||
else -> throw IllegalStateException("Unexpected declaration: ${proto::class.java}")
|
||||
}
|
||||
|
||||
val info = table[id] ?: return null
|
||||
|
||||
Reference in New Issue
Block a user