Support correct way of writing/loading version requirement table
Tests are added in subsequent commits. KT-25120 Fixed
This commit is contained in:
+3
-1
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotated
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||
import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement
|
||||
import org.jetbrains.kotlin.metadata.deserialization.isVersionRequirementTableWrittenCorrectly
|
||||
import org.jetbrains.kotlin.metadata.serialization.Interner
|
||||
import org.jetbrains.kotlin.metadata.serialization.MutableTypeTable
|
||||
import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable
|
||||
@@ -728,7 +729,8 @@ class DescriptorSerializer private constructor(
|
||||
Interner(parent.typeParameters),
|
||||
extension,
|
||||
MutableTypeTable(),
|
||||
if (container is ClassDescriptor) parent.versionRequirementTable else MutableVersionRequirementTable(),
|
||||
if (container is ClassDescriptor && !isVersionRequirementTableWrittenCorrectly(extension.metadataVersion))
|
||||
parent.versionRequirementTable else MutableVersionRequirementTable(),
|
||||
serializeTypeTableToFunction = false
|
||||
)
|
||||
for (typeParameter in descriptor.declaredTypeParameters) {
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.serialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.types.FlexibleType
|
||||
@@ -15,6 +16,8 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
abstract class SerializerExtension {
|
||||
abstract val stringTable: DescriptorAwareStringTable
|
||||
|
||||
abstract val metadataVersion: BinaryVersion
|
||||
|
||||
val annotationSerializer by lazy { AnnotationSerializer(stringTable) }
|
||||
|
||||
open fun shouldUseTypeTable(): Boolean = false
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.resolve.constants.NullValue
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
open class KotlinSerializerExtensionBase(private val protocol: SerializerExtensionProtocol) : SerializerExtension() {
|
||||
abstract class KotlinSerializerExtensionBase(private val protocol: SerializerExtensionProtocol) : SerializerExtension() {
|
||||
override val stringTable = StringTableImpl()
|
||||
|
||||
override fun serializeClass(
|
||||
|
||||
Reference in New Issue
Block a user