[FIR] Try to load properties in order according to kotlinx.serialization metadata extension
Move metadata extension with property order from kotlinx.serialization to core After fix of KT-54792 properties will be deserialized in declaration order if corresponding class was compiled with modern compiler. But this order is needed for kotlinx.serialization for binaries compiled with any kotlin compiler >= 1.4. Since we don't plan to add any extension points into (de)serialization into FIR, we need to take into account existing metadata extension from kotlinx.serialization in compiler itself ^KT-57769 Fixed
This commit is contained in:
committed by
Space Team
parent
7685284cb7
commit
94f77add49
+33
@@ -0,0 +1,33 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: core/metadata/src/properties_order_extension.proto
|
||||
|
||||
package org.jetbrains.kotlin.metadata;
|
||||
|
||||
public final class SerializationPluginMetadataExtensions {
|
||||
private SerializationPluginMetadataExtensions() {}
|
||||
public static void registerAllExtensions(
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite registry) {
|
||||
registry.add(org.jetbrains.kotlin.metadata.SerializationPluginMetadataExtensions.propertiesNamesInProgramOrder);
|
||||
}
|
||||
public static final int PROPERTIES_NAMES_IN_PROGRAM_ORDER_FIELD_NUMBER = 18000;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.ProtoBuf.Class,
|
||||
java.util.List<java.lang.Integer>> propertiesNamesInProgramOrder = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
|
||||
.newRepeatedGeneratedExtension(
|
||||
org.jetbrains.kotlin.metadata.ProtoBuf.Class.getDefaultInstance(),
|
||||
null,
|
||||
null,
|
||||
18000,
|
||||
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.INT32,
|
||||
false,
|
||||
java.lang.Integer.class);
|
||||
|
||||
static {
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.metadata.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder
|
||||
|
||||
class VersionRequirementTable private constructor(private val infos: List<ProtoBuf.VersionRequirement>) {
|
||||
operator fun get(id: Int): ProtoBuf.VersionRequirement? = infos.getOrNull(id)
|
||||
@@ -81,7 +81,7 @@ class VersionRequirement(
|
||||
"since $version $level" + (if (errorCode != null) " error $errorCode" else "") + (if (message != null) ": $message" else "")
|
||||
|
||||
companion object {
|
||||
fun create(proto: MessageLite, nameResolver: NameResolver, table: VersionRequirementTable): List<VersionRequirement> {
|
||||
fun create(proto: MessageLiteOrBuilder, nameResolver: NameResolver, table: VersionRequirementTable): List<VersionRequirement> {
|
||||
val ids = when (proto) {
|
||||
is ProtoBuf.Class -> proto.versionRequirementList
|
||||
is ProtoBuf.Constructor -> proto.versionRequirementList
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jetbrains.kotlin.metadata;
|
||||
|
||||
import "core/metadata/src/metadata.proto";
|
||||
import "core/metadata/src/ext_options.proto";
|
||||
|
||||
option java_outer_classname = "SerializationPluginMetadataExtensions";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
extend org.jetbrains.kotlin.metadata.Class {
|
||||
repeated int32 properties_names_in_program_order = 18000;
|
||||
}
|
||||
Reference in New Issue
Block a user