From 105fc4b0ca4bde4e9ddd582cb11581af6d81cc9d Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Tue, 3 Sep 2019 18:23:00 +0300 Subject: [PATCH] [IR SERIALIZATION] Get rid of FqName --- .../serialization.common/src/KotlinIr.proto | 12 +- .../DeserializeDescriptorReference.kt | 4 +- .../serialization/IrFileDeserializer.kt | 6 +- .../common/serialization/IrFileSerializer.kt | 16 +- .../common/serialization/KotlinIrLinker.kt | 6 +- .../SerializeDescriptorReference.kt | 7 +- .../proto/DescriptorReference.java | 478 +++++++++++------- .../proto/DescriptorReferenceOrBuilder.java | 34 +- .../common/serialization/proto/FqName.java | 413 --------------- .../serialization/proto/FqNameOrBuilder.java | 22 - .../common/serialization/proto/IrFile.java | 215 +++++--- .../serialization/proto/IrFileOrBuilder.java | 20 +- .../serialization/proto/IrSymbolData.java | 213 +++++--- .../proto/IrSymbolDataOrBuilder.java | 20 +- .../serialization/proto/StringTable.java | 2 +- 15 files changed, 643 insertions(+), 825 deletions(-) delete mode 100644 compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqName.java delete mode 100644 compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqNameOrBuilder.java diff --git a/compiler/ir/serialization.common/src/KotlinIr.proto b/compiler/ir/serialization.common/src/KotlinIr.proto index 75e60ec7a78..8393dbcb3b7 100644 --- a/compiler/ir/serialization.common/src/KotlinIr.proto +++ b/compiler/ir/serialization.common/src/KotlinIr.proto @@ -6,8 +6,8 @@ option java_outer_classname = "KotlinIr"; option optimize_for = LITE_RUNTIME; message DescriptorReference { - required FqName package_fq_name = 1; - required FqName class_fq_name = 2; + repeated int32 package_fq_name = 1; + repeated int32 class_fq_name = 2; required int32 name = 3; optional UniqId uniq_id = 4; optional bool is_getter = 5 [default = false]; @@ -76,10 +76,6 @@ message IrDeclarationOrigin { } } -message FqName { - repeated int32 segment = 1; -} - /* ------ Top Level---------------------------------------------- */ message IrDeclarationContainer { @@ -94,7 +90,7 @@ message FileEntry { message IrFile { repeated UniqId declaration_id = 1; required FileEntry file_entry = 2; - required FqName fq_name = 3; + repeated int32 fq_name = 3; required Annotations annotations = 4; repeated int32 explicitly_exported_to_compiler = 5; } @@ -123,7 +119,7 @@ message IrSymbolData { required IrSymbolKind kind = 1; required UniqId uniq_id = 2; required UniqId top_level_uniq_id = 3; - optional FqName fqname = 4; + repeated int32 fq_name = 4; optional DescriptorReference descriptor_reference = 5; } diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DeserializeDescriptorReference.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DeserializeDescriptorReference.kt index 9b62e84a4d9..35ac4d8c9e1 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DeserializeDescriptorReference.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/DeserializeDescriptorReference.kt @@ -109,8 +109,8 @@ abstract class DescriptorReferenceDeserializer( } // TODO: This is still native specific. Eliminate. - val rootSegment = packageFqName.pathSegments().firstOrNull()?.identifier ?: "" - if (rootSegment == "cnames" || rootSegment == "objcnames") { + val fqnString = packageFqName.asString() + if (fqnString.startsWith("cnames.") || fqnString.startsWith("objcnames.")) { val descriptor = currentModule.findClassAcrossModuleDependencies(ClassId(packageFqName, FqName(name), false))!! if (!descriptor.fqNameUnsafe.asString().startsWith("cnames") && !descriptor.fqNameUnsafe.asString().startsWith( diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt index 4ba100fd87b..d5c410ff27d 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileDeserializer.kt @@ -119,7 +119,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind as P //import org.jetbrains.kotlin.backend.common.serialization.proto.IrDataIndex as ProtoStringIndex import org.jetbrains.kotlin.backend.common.serialization.proto.TypeArguments as ProtoTypeArguments import org.jetbrains.kotlin.backend.common.serialization.proto.Visibility as ProtoVisibility -import org.jetbrains.kotlin.backend.common.serialization.proto.FqName as ProtoFqName +//import org.jetbrains.kotlin.backend.common.serialization.proto.FqName as ProtoFqName // TODO: This code still has some uses of descriptors: // 1. We use descriptors as keys for symbolTable -- probably symbol table related code should be refactored out from @@ -143,8 +143,8 @@ abstract class IrFileDeserializer( private val parentsStack = mutableListOf() - fun deserializeFqName(proto: ProtoFqName): FqName { - return proto.segmentList.run { + fun deserializeFqName(fqn: List): FqName { + return fqn.run { if (isEmpty()) FqName.ROOT else FqName.fromSegments(map { deserializeString(it) }) } } diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt index 7081bbf9d0d..5733fdc3c5d 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/IrFileSerializer.kt @@ -35,7 +35,6 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.ClassKind as Prot import org.jetbrains.kotlin.backend.common.serialization.proto.Coordinates as ProtoCoordinates import org.jetbrains.kotlin.backend.common.serialization.proto.FieldAccessCommon as ProtoFieldAccessCommon import org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry as ProtoFileEntry -import org.jetbrains.kotlin.backend.common.serialization.proto.FqName as ProtoFqName import org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit as ProtoAnonymousInit import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock as ProtoBlock import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlockBody as ProtoBlockBody @@ -303,14 +302,13 @@ open class IrFileSerializer( return proto.build() } - private fun serializeFqName(fqName: FqName): ProtoFqName { - val proto = ProtoFqName.newBuilder() - fqName.pathSegments().forEach { - proto.addSegment(serializeString(it.identifier)) - } + private fun serializeFqName(fqName: FqName): List { +// val proto = ProtoFqName.newBuilder() +// fqName.pathSegments().forEach { +// proto.addSegment(serializeString(it.identifier)) +// } - return proto.build() - } + private fun serializeFqName(fqName: FqName) = fqName.pathSegments().map { serializeString(it.identifier) } private fun serializeIrTypeProjection(argument: IrTypeProjection): ProtoTypeProjection = ProtoTypeProjection.newBuilder() .setVariance(serializeIrTypeVariance(argument.variance)) @@ -1279,7 +1277,7 @@ open class IrFileSerializer( val proto = ProtoFile.newBuilder() .setFileEntry(serializeFileEntry(file.fileEntry)) - .setFqName(serializeFqName(file.fqName)) + .addAllFqName(serializeFqName(file.fqName)) .setAnnotations(serializeAnnotations(file.annotations)) file.declarations.forEach { diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinIrLinker.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinIrLinker.kt index c927c76d9dd..9392eb0a10f 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinIrLinker.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/KotlinIrLinker.kt @@ -329,8 +329,8 @@ abstract class KotlinIrLinker( override fun deserializeDescriptorReference(proto: ProtoDescriptorReference) = descriptorReferenceDeserializer.deserializeDescriptorReference( - deserializeFqName(proto.packageFqName), - deserializeFqName(proto.classFqName), + deserializeFqName(proto.packageFqNameList), + deserializeFqName(proto.classFqNameList), deserializeString(proto.name), if (proto.hasUniqId()) proto.uniqId.index else null, isEnumEntry = proto.isEnumEntry, @@ -404,7 +404,7 @@ abstract class KotlinIrLinker( val fileDeserializer = IrDeserializerForFile(fileProto.annotations, fileIndex, !deserializationStrategy.needBodies) - val fqName = fileDeserializer.deserializeFqName(fileProto.fqName) + val fqName = fileDeserializer.deserializeFqName(fileProto.fqNameList) val packageFragmentDescriptor = EmptyPackageFragmentDescriptor(moduleDescriptor, fqName) diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/SerializeDescriptorReference.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/SerializeDescriptorReference.kt index 2312a8358d1..423dbdd1f35 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/SerializeDescriptorReference.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/SerializeDescriptorReference.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.backend.common.serialization import org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference as ProtoDescriptorReference -import org.jetbrains.kotlin.backend.common.serialization.proto.FqName as ProtoFqName import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.declarations.* @@ -21,7 +20,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.classId open class DescriptorReferenceSerializer( val declarationTable: DeclarationTable, val serializeString: (String) -> Int, - val serializeFqName: (FqName) -> ProtoFqName + val serializeFqName: (FqName) -> List ) { private fun isEnumSpecialMember(descriptor: DeclarationDescriptor): Boolean { @@ -112,8 +111,8 @@ open class DescriptorReferenceSerializer( val uniqId = discoverableDescriptorsDeclaration?.let { declarationTable.uniqIdByDeclaration(it) } val proto = ProtoDescriptorReference.newBuilder() - .setPackageFqName(serializeFqName(packageFqName)) - .setClassFqName(serializeFqName(classFqName)) + .addAllPackageFqName(serializeFqName(packageFqName)) + .addAllClassFqName(serializeFqName(classFqName)) .setName(serializeString(nameString)) if (uniqId != null) proto.setUniqId(protoUniqId(uniqId)) diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReference.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReference.java index b58d816a5d0..cbfd5510e18 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReference.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReference.java @@ -53,40 +53,56 @@ public final class DescriptorReference extends } break; } + case 8: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + packageFqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + packageFqName_.add(input.readInt32()); + break; + } case 10: { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - subBuilder = packageFqName_.toBuilder(); + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) { + packageFqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; } - packageFqName_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.FqName.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(packageFqName_); - packageFqName_ = subBuilder.buildPartial(); + while (input.getBytesUntilLimit() > 0) { + packageFqName_.add(input.readInt32()); } - bitField0_ |= 0x00000001; + input.popLimit(limit); + break; + } + case 16: { + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + classFqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + classFqName_.add(input.readInt32()); break; } case 18: { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = classFqName_.toBuilder(); + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { + classFqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; } - classFqName_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.FqName.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(classFqName_); - classFqName_ = subBuilder.buildPartial(); + while (input.getBytesUntilLimit() > 0) { + classFqName_.add(input.readInt32()); } - bitField0_ |= 0x00000002; + input.popLimit(limit); break; } case 24: { - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000001; name_ = input.readInt32(); break; } case 34: { org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder subBuilder = null; - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = uniqId_.toBuilder(); } uniqId_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.PARSER, extensionRegistry); @@ -94,46 +110,46 @@ public final class DescriptorReference extends subBuilder.mergeFrom(uniqId_); uniqId_ = subBuilder.buildPartial(); } - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000002; break; } case 40: { - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000004; isGetter_ = input.readBool(); break; } case 48: { - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000008; isSetter_ = input.readBool(); break; } case 56: { - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000010; isBackingField_ = input.readBool(); break; } case 64: { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000020; isFakeOverride_ = input.readBool(); break; } case 72: { - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000040; isDefaultConstructor_ = input.readBool(); break; } case 80: { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000080; isEnumEntry_ = input.readBool(); break; } case 88: { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000100; isEnumSpecial_ = input.readBool(); break; } case 96: { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000200; isTypeParameter_ = input.readBool(); break; } @@ -145,6 +161,12 @@ public final class DescriptorReference extends throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + packageFqName_ = java.util.Collections.unmodifiableList(packageFqName_); + } + if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { + classFqName_ = java.util.Collections.unmodifiableList(classFqName_); + } try { unknownFieldsCodedOutput.flush(); } catch (java.io.IOException e) { @@ -172,45 +194,69 @@ public final class DescriptorReference extends private int bitField0_; public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 1; - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName packageFqName_; + private java.util.List packageFqName_; /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - public boolean hasPackageFqName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + public java.util.List + getPackageFqNameList() { + return packageFqName_; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getPackageFqName() { - return packageFqName_; + public int getPackageFqNameCount() { + return packageFqName_.size(); + } + /** + * repeated int32 package_fq_name = 1; + */ + public int getPackageFqName(int index) { + return packageFqName_.get(index); } public static final int CLASS_FQ_NAME_FIELD_NUMBER = 2; - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName classFqName_; + private java.util.List classFqName_; /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - public boolean hasClassFqName() { - return ((bitField0_ & 0x00000002) == 0x00000002); + public java.util.List + getClassFqNameList() { + return classFqName_; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getClassFqName() { - return classFqName_; + public int getClassFqNameCount() { + return classFqName_.size(); + } + /** + * repeated int32 class_fq_name = 2; + */ + public int getClassFqName(int index) { + return classFqName_.get(index); } public static final int NAME_FIELD_NUMBER = 3; private int name_; /** * required int32 name = 3; + * + *
+   *  required FqName package_fq_name = 1;
+   *  required FqName class_fq_name = 2;
+   * 
*/ public boolean hasName() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 name = 3; + * + *
+   *  required FqName package_fq_name = 1;
+   *  required FqName class_fq_name = 2;
+   * 
*/ public int getName() { return name_; @@ -222,7 +268,7 @@ public final class DescriptorReference extends * optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4; */ public boolean hasUniqId() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4; @@ -237,7 +283,7 @@ public final class DescriptorReference extends * optional bool is_getter = 5 [default = false]; */ public boolean hasIsGetter() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional bool is_getter = 5 [default = false]; @@ -252,7 +298,7 @@ public final class DescriptorReference extends * optional bool is_setter = 6 [default = false]; */ public boolean hasIsSetter() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional bool is_setter = 6 [default = false]; @@ -267,7 +313,7 @@ public final class DescriptorReference extends * optional bool is_backing_field = 7 [default = false]; */ public boolean hasIsBackingField() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional bool is_backing_field = 7 [default = false]; @@ -282,7 +328,7 @@ public final class DescriptorReference extends * optional bool is_fake_override = 8 [default = false]; */ public boolean hasIsFakeOverride() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional bool is_fake_override = 8 [default = false]; @@ -297,7 +343,7 @@ public final class DescriptorReference extends * optional bool is_default_constructor = 9 [default = false]; */ public boolean hasIsDefaultConstructor() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional bool is_default_constructor = 9 [default = false]; @@ -312,7 +358,7 @@ public final class DescriptorReference extends * optional bool is_enum_entry = 10 [default = false]; */ public boolean hasIsEnumEntry() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional bool is_enum_entry = 10 [default = false]; @@ -327,7 +373,7 @@ public final class DescriptorReference extends * optional bool is_enum_special = 11 [default = false]; */ public boolean hasIsEnumSpecial() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional bool is_enum_special = 11 [default = false]; @@ -342,7 +388,7 @@ public final class DescriptorReference extends * optional bool is_type_parameter = 12 [default = false]; */ public boolean hasIsTypeParameter() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional bool is_type_parameter = 12 [default = false]; @@ -352,8 +398,8 @@ public final class DescriptorReference extends } private void initFields() { - packageFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - classFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + packageFqName_ = java.util.Collections.emptyList(); + classFqName_ = java.util.Collections.emptyList(); name_ = 0; uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); isGetter_ = false; @@ -371,14 +417,6 @@ public final class DescriptorReference extends if (isInitialized == 1) return true; if (isInitialized == 0) return false; - if (!hasPackageFqName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasClassFqName()) { - memoizedIsInitialized = 0; - return false; - } if (!hasName()) { memoizedIsInitialized = 0; return false; @@ -396,40 +434,40 @@ public final class DescriptorReference extends public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); + for (int i = 0; i < packageFqName_.size(); i++) { + output.writeInt32(1, packageFqName_.get(i)); + } + for (int i = 0; i < classFqName_.size(); i++) { + output.writeInt32(2, classFqName_.get(i)); + } if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, packageFqName_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, classFqName_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, name_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(4, uniqId_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBool(5, isGetter_); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBool(6, isSetter_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBool(7, isBackingField_); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBool(8, isFakeOverride_); } - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBool(9, isDefaultConstructor_); } - if (((bitField0_ & 0x00000200) == 0x00000200)) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBool(10, isEnumEntry_); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBool(11, isEnumSpecial_); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeBool(12, isTypeParameter_); } output.writeRawBytes(unknownFields); @@ -441,51 +479,61 @@ public final class DescriptorReference extends if (size != -1) return size; size = 0; + { + int dataSize = 0; + for (int i = 0; i < packageFqName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(packageFqName_.get(i)); + } + size += dataSize; + size += 1 * getPackageFqNameList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < classFqName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(classFqName_.get(i)); + } + size += dataSize; + size += 1 * getClassFqNameList().size(); + } if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeMessageSize(1, packageFqName_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeMessageSize(2, classFqName_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeInt32Size(3, name_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(4, uniqId_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(5, isGetter_); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(6, isSetter_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(7, isBackingField_); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(8, isFakeOverride_); } - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(9, isDefaultConstructor_); } - if (((bitField0_ & 0x00000200) == 0x00000200)) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(10, isEnumEntry_); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000100) == 0x00000100)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(11, isEnumSpecial_); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000200) == 0x00000200)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeBoolSize(12, isTypeParameter_); } @@ -583,9 +631,9 @@ public final class DescriptorReference extends public Builder clear() { super.clear(); - packageFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + packageFqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); - classFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + classFqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); name_ = 0; bitField0_ = (bitField0_ & ~0x00000004); @@ -630,52 +678,54 @@ public final class DescriptorReference extends org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference result = new org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + packageFqName_ = java.util.Collections.unmodifiableList(packageFqName_); + bitField0_ = (bitField0_ & ~0x00000001); } result.packageFqName_ = packageFqName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + classFqName_ = java.util.Collections.unmodifiableList(classFqName_); + bitField0_ = (bitField0_ & ~0x00000002); } result.classFqName_ = classFqName_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; + to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; + to_bitField0_ |= 0x00000002; } result.uniqId_ = uniqId_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; + to_bitField0_ |= 0x00000004; } result.isGetter_ = isGetter_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; + to_bitField0_ |= 0x00000008; } result.isSetter_ = isSetter_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; + to_bitField0_ |= 0x00000010; } result.isBackingField_ = isBackingField_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000080; + to_bitField0_ |= 0x00000020; } result.isFakeOverride_ = isFakeOverride_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { - to_bitField0_ |= 0x00000100; + to_bitField0_ |= 0x00000040; } result.isDefaultConstructor_ = isDefaultConstructor_; if (((from_bitField0_ & 0x00000200) == 0x00000200)) { - to_bitField0_ |= 0x00000200; + to_bitField0_ |= 0x00000080; } result.isEnumEntry_ = isEnumEntry_; if (((from_bitField0_ & 0x00000400) == 0x00000400)) { - to_bitField0_ |= 0x00000400; + to_bitField0_ |= 0x00000100; } result.isEnumSpecial_ = isEnumSpecial_; if (((from_bitField0_ & 0x00000800) == 0x00000800)) { - to_bitField0_ |= 0x00000800; + to_bitField0_ |= 0x00000200; } result.isTypeParameter_ = isTypeParameter_; result.bitField0_ = to_bitField0_; @@ -684,11 +734,25 @@ public final class DescriptorReference extends public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference other) { if (other == org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance()) return this; - if (other.hasPackageFqName()) { - mergePackageFqName(other.getPackageFqName()); + if (!other.packageFqName_.isEmpty()) { + if (packageFqName_.isEmpty()) { + packageFqName_ = other.packageFqName_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePackageFqNameIsMutable(); + packageFqName_.addAll(other.packageFqName_); + } + } - if (other.hasClassFqName()) { - mergeClassFqName(other.getClassFqName()); + if (!other.classFqName_.isEmpty()) { + if (classFqName_.isEmpty()) { + classFqName_ = other.classFqName_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureClassFqNameIsMutable(); + classFqName_.addAll(other.classFqName_); + } + } if (other.hasName()) { setName(other.getName()); @@ -726,14 +790,6 @@ public final class DescriptorReference extends } public final boolean isInitialized() { - if (!hasPackageFqName()) { - - return false; - } - if (!hasClassFqName()) { - - return false; - } if (!hasName()) { return false; @@ -766,141 +822,168 @@ public final class DescriptorReference extends } private int bitField0_; - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName packageFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; - */ - public boolean hasPackageFqName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + private java.util.List packageFqName_ = java.util.Collections.emptyList(); + private void ensurePackageFqNameIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + packageFqName_ = new java.util.ArrayList(packageFqName_); + bitField0_ |= 0x00000001; + } } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getPackageFqName() { - return packageFqName_; + public java.util.List + getPackageFqNameList() { + return java.util.Collections.unmodifiableList(packageFqName_); } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - public Builder setPackageFqName(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (value == null) { - throw new NullPointerException(); - } - packageFqName_ = value; - - bitField0_ |= 0x00000001; - return this; + public int getPackageFqNameCount() { + return packageFqName_.size(); } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; + */ + public int getPackageFqName(int index) { + return packageFqName_.get(index); + } + /** + * repeated int32 package_fq_name = 1; */ public Builder setPackageFqName( - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder builderForValue) { - packageFqName_ = builderForValue.build(); - - bitField0_ |= 0x00000001; + int index, int value) { + ensurePackageFqNameIsMutable(); + packageFqName_.set(index, value); + return this; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - public Builder mergePackageFqName(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - packageFqName_ != org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance()) { - packageFqName_ = - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.newBuilder(packageFqName_).mergeFrom(value).buildPartial(); - } else { - packageFqName_ = value; - } - - bitField0_ |= 0x00000001; + public Builder addPackageFqName(int value) { + ensurePackageFqNameIsMutable(); + packageFqName_.add(value); + return this; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; + */ + public Builder addAllPackageFqName( + java.lang.Iterable values) { + ensurePackageFqNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, packageFqName_); + + return this; + } + /** + * repeated int32 package_fq_name = 1; */ public Builder clearPackageFqName() { - packageFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - + packageFqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); + return this; } - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName classFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; - */ - public boolean hasClassFqName() { - return ((bitField0_ & 0x00000002) == 0x00000002); + private java.util.List classFqName_ = java.util.Collections.emptyList(); + private void ensureClassFqNameIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + classFqName_ = new java.util.ArrayList(classFqName_); + bitField0_ |= 0x00000002; + } } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getClassFqName() { - return classFqName_; + public java.util.List + getClassFqNameList() { + return java.util.Collections.unmodifiableList(classFqName_); } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - public Builder setClassFqName(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (value == null) { - throw new NullPointerException(); - } - classFqName_ = value; - - bitField0_ |= 0x00000002; - return this; + public int getClassFqNameCount() { + return classFqName_.size(); } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; + */ + public int getClassFqName(int index) { + return classFqName_.get(index); + } + /** + * repeated int32 class_fq_name = 2; */ public Builder setClassFqName( - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder builderForValue) { - classFqName_ = builderForValue.build(); - - bitField0_ |= 0x00000002; + int index, int value) { + ensureClassFqNameIsMutable(); + classFqName_.set(index, value); + return this; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - public Builder mergeClassFqName(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - classFqName_ != org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance()) { - classFqName_ = - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.newBuilder(classFqName_).mergeFrom(value).buildPartial(); - } else { - classFqName_ = value; - } - - bitField0_ |= 0x00000002; + public Builder addClassFqName(int value) { + ensureClassFqNameIsMutable(); + classFqName_.add(value); + return this; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; + */ + public Builder addAllClassFqName( + java.lang.Iterable values) { + ensureClassFqNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classFqName_); + + return this; + } + /** + * repeated int32 class_fq_name = 2; */ public Builder clearClassFqName() { - classFqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - + classFqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); + return this; } private int name_ ; /** * required int32 name = 3; + * + *
+     *  required FqName package_fq_name = 1;
+     *  required FqName class_fq_name = 2;
+     * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 name = 3; + * + *
+     *  required FqName package_fq_name = 1;
+     *  required FqName class_fq_name = 2;
+     * 
*/ public int getName() { return name_; } /** * required int32 name = 3; + * + *
+     *  required FqName package_fq_name = 1;
+     *  required FqName class_fq_name = 2;
+     * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000004; @@ -910,6 +993,11 @@ public final class DescriptorReference extends } /** * required int32 name = 3; + * + *
+     *  required FqName package_fq_name = 1;
+     *  required FqName class_fq_name = 2;
+     * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000004); diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReferenceOrBuilder.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReferenceOrBuilder.java index d9a21a5d3d6..1de3073eefd 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReferenceOrBuilder.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/DescriptorReferenceOrBuilder.java @@ -8,29 +8,47 @@ public interface DescriptorReferenceOrBuilder extends org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder { /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - boolean hasPackageFqName(); + java.util.List getPackageFqNameList(); /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName package_fq_name = 1; + * repeated int32 package_fq_name = 1; */ - org.jetbrains.kotlin.backend.common.serialization.proto.FqName getPackageFqName(); + int getPackageFqNameCount(); + /** + * repeated int32 package_fq_name = 1; + */ + int getPackageFqName(int index); /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - boolean hasClassFqName(); + java.util.List getClassFqNameList(); /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName class_fq_name = 2; + * repeated int32 class_fq_name = 2; */ - org.jetbrains.kotlin.backend.common.serialization.proto.FqName getClassFqName(); + int getClassFqNameCount(); + /** + * repeated int32 class_fq_name = 2; + */ + int getClassFqName(int index); /** * required int32 name = 3; + * + *
+   *  required FqName package_fq_name = 1;
+   *  required FqName class_fq_name = 2;
+   * 
*/ boolean hasName(); /** * required int32 name = 3; + * + *
+   *  required FqName package_fq_name = 1;
+   *  required FqName class_fq_name = 2;
+   * 
*/ int getName(); diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqName.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqName.java deleted file mode 100644 index 7ab4d674725..00000000000 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqName.java +++ /dev/null @@ -1,413 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: compiler/ir/serialization.common/src/KotlinIr.proto - -package org.jetbrains.kotlin.backend.common.serialization.proto; - -/** - * Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.FqName} - */ -public final class FqName extends - org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements - // @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.FqName) - FqNameOrBuilder { - // Use FqName.newBuilder() to construct. - private FqName(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private FqName(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;} - - private static final FqName defaultInstance; - public static FqName getDefaultInstance() { - return defaultInstance; - } - - public FqName getDefaultInstanceForType() { - return defaultInstance; - } - - private final org.jetbrains.kotlin.protobuf.ByteString unknownFields; - private FqName( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput = - org.jetbrains.kotlin.protobuf.ByteString.newOutput(); - org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput = - org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance( - unknownFieldsOutput); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFieldsCodedOutput, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - segment_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - segment_.add(input.readInt32()); - break; - } - case 10: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) { - segment_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - while (input.getBytesUntilLimit() > 0) { - segment_.add(input.readInt32()); - } - input.popLimit(limit); - break; - } - } - } - } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - segment_ = java.util.Collections.unmodifiableList(segment_); - } - try { - unknownFieldsCodedOutput.flush(); - } catch (java.io.IOException e) { - // Should not happen - } finally { - unknownFields = unknownFieldsOutput.toByteString(); - } - makeExtensionsImmutable(); - } - } - public static org.jetbrains.kotlin.protobuf.Parser PARSER = - new org.jetbrains.kotlin.protobuf.AbstractParser() { - public FqName parsePartialFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return new FqName(input, extensionRegistry); - } - }; - - @java.lang.Override - public org.jetbrains.kotlin.protobuf.Parser getParserForType() { - return PARSER; - } - - public static final int SEGMENT_FIELD_NUMBER = 1; - private java.util.List segment_; - /** - * repeated int32 segment = 1; - */ - public java.util.List - getSegmentList() { - return segment_; - } - /** - * repeated int32 segment = 1; - */ - public int getSegmentCount() { - return segment_.size(); - } - /** - * repeated int32 segment = 1; - */ - public int getSegment(int index) { - return segment_.get(index); - } - - private void initFields() { - segment_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < segment_.size(); i++) { - output.writeInt32(1, segment_.get(i)); - } - output.writeRawBytes(unknownFields); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (int i = 0; i < segment_.size(); i++) { - dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeInt32SizeNoTag(segment_.get(i)); - } - size += dataSize; - size += 1 * getSegmentList().size(); - } - size += unknownFields.size(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom( - org.jetbrains.kotlin.protobuf.ByteString data) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom( - org.jetbrains.kotlin.protobuf.ByteString data, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom(byte[] data) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom( - byte[] data, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom( - java.io.InputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseDelimitedFrom( - java.io.InputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.jetbrains.kotlin.backend.common.serialization.proto.FqName parseFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.FqName prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - /** - * Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.FqName} - */ - public static final class Builder extends - org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder< - org.jetbrains.kotlin.backend.common.serialization.proto.FqName, Builder> - implements - // @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.FqName) - org.jetbrains.kotlin.backend.common.serialization.proto.FqNameOrBuilder { - // Construct using org.jetbrains.kotlin.backend.common.serialization.proto.FqName.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - segment_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getDefaultInstanceForType() { - return org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - } - - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName build() { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName buildPartial() { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName result = new org.jetbrains.kotlin.backend.common.serialization.proto.FqName(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - segment_ = java.util.Collections.unmodifiableList(segment_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.segment_ = segment_; - return result; - } - - public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.FqName other) { - if (other == org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance()) return this; - if (!other.segment_.isEmpty()) { - if (segment_.isEmpty()) { - segment_ = other.segment_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureSegmentIsMutable(); - segment_.addAll(other.segment_); - } - - } - setUnknownFields( - getUnknownFields().concat(other.unknownFields)); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - org.jetbrains.kotlin.protobuf.CodedInputStream input, - org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.FqName) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List segment_ = java.util.Collections.emptyList(); - private void ensureSegmentIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - segment_ = new java.util.ArrayList(segment_); - bitField0_ |= 0x00000001; - } - } - /** - * repeated int32 segment = 1; - */ - public java.util.List - getSegmentList() { - return java.util.Collections.unmodifiableList(segment_); - } - /** - * repeated int32 segment = 1; - */ - public int getSegmentCount() { - return segment_.size(); - } - /** - * repeated int32 segment = 1; - */ - public int getSegment(int index) { - return segment_.get(index); - } - /** - * repeated int32 segment = 1; - */ - public Builder setSegment( - int index, int value) { - ensureSegmentIsMutable(); - segment_.set(index, value); - - return this; - } - /** - * repeated int32 segment = 1; - */ - public Builder addSegment(int value) { - ensureSegmentIsMutable(); - segment_.add(value); - - return this; - } - /** - * repeated int32 segment = 1; - */ - public Builder addAllSegment( - java.lang.Iterable values) { - ensureSegmentIsMutable(); - org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, segment_); - - return this; - } - /** - * repeated int32 segment = 1; - */ - public Builder clearSegment() { - segment_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - - return this; - } - - // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.FqName) - } - - static { - defaultInstance = new FqName(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.FqName) -} diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqNameOrBuilder.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqNameOrBuilder.java deleted file mode 100644 index 859008eb48a..00000000000 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/FqNameOrBuilder.java +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: compiler/ir/serialization.common/src/KotlinIr.proto - -package org.jetbrains.kotlin.backend.common.serialization.proto; - -public interface FqNameOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.FqName) - org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder { - - /** - * repeated int32 segment = 1; - */ - java.util.List getSegmentList(); - /** - * repeated int32 segment = 1; - */ - int getSegmentCount(); - /** - * repeated int32 segment = 1; - */ - int getSegment(int index); -} \ No newline at end of file diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java index 0a42cc31e16..8e4f7ae6d96 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFile.java @@ -74,22 +74,30 @@ public final class IrFile extends bitField0_ |= 0x00000001; break; } + case 24: { + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + fqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + fqName_.add(input.readInt32()); + break; + } case 26: { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = fqName_.toBuilder(); + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { + fqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; } - fqName_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.FqName.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(fqName_); - fqName_ = subBuilder.buildPartial(); + while (input.getBytesUntilLimit() > 0) { + fqName_.add(input.readInt32()); } - bitField0_ |= 0x00000002; + input.popLimit(limit); break; } case 34: { org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.Builder subBuilder = null; - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = annotations_.toBuilder(); } annotations_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.PARSER, extensionRegistry); @@ -97,7 +105,7 @@ public final class IrFile extends subBuilder.mergeFrom(annotations_); annotations_ = subBuilder.buildPartial(); } - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000002; break; } case 40: { @@ -132,6 +140,9 @@ public final class IrFile extends if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { declarationId_ = java.util.Collections.unmodifiableList(declarationId_); } + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + fqName_ = java.util.Collections.unmodifiableList(fqName_); + } if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { explicitlyExportedToCompiler_ = java.util.Collections.unmodifiableList(explicitlyExportedToCompiler_); } @@ -212,30 +223,45 @@ public final class IrFile extends } public static final int FQ_NAME_FIELD_NUMBER = 3; - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqName_; + private java.util.List fqName_; /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - public boolean hasFqName() { - return ((bitField0_ & 0x00000002) == 0x00000002); + public java.util.List + getFqNameList() { + return fqName_; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getFqName() { - return fqName_; + public int getFqNameCount() { + return fqName_.size(); + } + /** + * repeated int32 fq_name = 3; + */ + public int getFqName(int index) { + return fqName_.get(index); } public static final int ANNOTATIONS_FIELD_NUMBER = 4; private org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations_; /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+   *  required FqName fq_name = 3;
+   * 
*/ public boolean hasAnnotations() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+   *  required FqName fq_name = 3;
+   * 
*/ public org.jetbrains.kotlin.backend.common.serialization.proto.Annotations getAnnotations() { return annotations_; @@ -266,7 +292,7 @@ public final class IrFile extends private void initFields() { declarationId_ = java.util.Collections.emptyList(); fileEntry_ = org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry.getDefaultInstance(); - fqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + fqName_ = java.util.Collections.emptyList(); annotations_ = org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.getDefaultInstance(); explicitlyExportedToCompiler_ = java.util.Collections.emptyList(); } @@ -280,10 +306,6 @@ public final class IrFile extends memoizedIsInitialized = 0; return false; } - if (!hasFqName()) { - memoizedIsInitialized = 0; - return false; - } if (!hasAnnotations()) { memoizedIsInitialized = 0; return false; @@ -315,10 +337,10 @@ public final class IrFile extends if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(2, fileEntry_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(3, fqName_); + for (int i = 0; i < fqName_.size(); i++) { + output.writeInt32(3, fqName_.get(i)); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(4, annotations_); } for (int i = 0; i < explicitlyExportedToCompiler_.size(); i++) { @@ -341,11 +363,16 @@ public final class IrFile extends size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(2, fileEntry_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeMessageSize(3, fqName_); + { + int dataSize = 0; + for (int i = 0; i < fqName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(fqName_.get(i)); + } + size += dataSize; + size += 1 * getFqNameList().size(); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(4, annotations_); } @@ -456,7 +483,7 @@ public final class IrFile extends bitField0_ = (bitField0_ & ~0x00000001); fileEntry_ = org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000002); - fqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + fqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); annotations_ = org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000008); @@ -494,12 +521,13 @@ public final class IrFile extends to_bitField0_ |= 0x00000001; } result.fileEntry_ = fileEntry_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000002; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + fqName_ = java.util.Collections.unmodifiableList(fqName_); + bitField0_ = (bitField0_ & ~0x00000004); } result.fqName_ = fqName_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000004; + to_bitField0_ |= 0x00000002; } result.annotations_ = annotations_; if (((bitField0_ & 0x00000010) == 0x00000010)) { @@ -526,8 +554,15 @@ public final class IrFile extends if (other.hasFileEntry()) { mergeFileEntry(other.getFileEntry()); } - if (other.hasFqName()) { - mergeFqName(other.getFqName()); + if (!other.fqName_.isEmpty()) { + if (fqName_.isEmpty()) { + fqName_ = other.fqName_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureFqNameIsMutable(); + fqName_.addAll(other.fqName_); + } + } if (other.hasAnnotations()) { mergeAnnotations(other.getAnnotations()); @@ -552,10 +587,6 @@ public final class IrFile extends return false; } - if (!hasFqName()) { - - return false; - } if (!hasAnnotations()) { return false; @@ -781,81 +812,99 @@ public final class IrFile extends return this; } - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; - */ - public boolean hasFqName() { - return ((bitField0_ & 0x00000004) == 0x00000004); + private java.util.List fqName_ = java.util.Collections.emptyList(); + private void ensureFqNameIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + fqName_ = new java.util.ArrayList(fqName_); + bitField0_ |= 0x00000004; + } } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getFqName() { - return fqName_; + public java.util.List + getFqNameList() { + return java.util.Collections.unmodifiableList(fqName_); } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - public Builder setFqName(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (value == null) { - throw new NullPointerException(); - } - fqName_ = value; - - bitField0_ |= 0x00000004; - return this; + public int getFqNameCount() { + return fqName_.size(); } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; + */ + public int getFqName(int index) { + return fqName_.get(index); + } + /** + * repeated int32 fq_name = 3; */ public Builder setFqName( - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder builderForValue) { - fqName_ = builderForValue.build(); - - bitField0_ |= 0x00000004; + int index, int value) { + ensureFqNameIsMutable(); + fqName_.set(index, value); + return this; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - public Builder mergeFqName(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - fqName_ != org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance()) { - fqName_ = - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.newBuilder(fqName_).mergeFrom(value).buildPartial(); - } else { - fqName_ = value; - } - - bitField0_ |= 0x00000004; + public Builder addFqName(int value) { + ensureFqNameIsMutable(); + fqName_.add(value); + return this; } /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; + */ + public Builder addAllFqName( + java.lang.Iterable values) { + ensureFqNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, fqName_); + + return this; + } + /** + * repeated int32 fq_name = 3; */ public Builder clearFqName() { - fqName_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - + fqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); + return this; } private org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations_ = org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.getDefaultInstance(); /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+     *  required FqName fq_name = 3;
+     * 
*/ public boolean hasAnnotations() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+     *  required FqName fq_name = 3;
+     * 
*/ public org.jetbrains.kotlin.backend.common.serialization.proto.Annotations getAnnotations() { return annotations_; } /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+     *  required FqName fq_name = 3;
+     * 
*/ public Builder setAnnotations(org.jetbrains.kotlin.backend.common.serialization.proto.Annotations value) { if (value == null) { @@ -868,6 +917,10 @@ public final class IrFile extends } /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+     *  required FqName fq_name = 3;
+     * 
*/ public Builder setAnnotations( org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.Builder builderForValue) { @@ -878,6 +931,10 @@ public final class IrFile extends } /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+     *  required FqName fq_name = 3;
+     * 
*/ public Builder mergeAnnotations(org.jetbrains.kotlin.backend.common.serialization.proto.Annotations value) { if (((bitField0_ & 0x00000008) == 0x00000008) && @@ -893,6 +950,10 @@ public final class IrFile extends } /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+     *  required FqName fq_name = 3;
+     * 
*/ public Builder clearAnnotations() { annotations_ = org.jetbrains.kotlin.backend.common.serialization.proto.Annotations.getDefaultInstance(); diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java index 94158e75c9b..3a4759b91de 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrFileOrBuilder.java @@ -31,20 +31,32 @@ public interface IrFileOrBuilder extends org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry getFileEntry(); /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - boolean hasFqName(); + java.util.List getFqNameList(); /** - * required .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fq_name = 3; + * repeated int32 fq_name = 3; */ - org.jetbrains.kotlin.backend.common.serialization.proto.FqName getFqName(); + int getFqNameCount(); + /** + * repeated int32 fq_name = 3; + */ + int getFqName(int index); /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+   *  required FqName fq_name = 3;
+   * 
*/ boolean hasAnnotations(); /** * required .org.jetbrains.kotlin.backend.common.serialization.proto.Annotations annotations = 4; + * + *
+   *  required FqName fq_name = 3;
+   * 
*/ org.jetbrains.kotlin.backend.common.serialization.proto.Annotations getAnnotations(); diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolData.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolData.java index 0f34c44b006..8a9cd078fab 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolData.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolData.java @@ -91,22 +91,30 @@ public final class IrSymbolData extends bitField0_ |= 0x00000004; break; } + case 32: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + fqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + fqName_.add(input.readInt32()); + break; + } case 34: { - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder subBuilder = null; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - subBuilder = fqname_.toBuilder(); + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { + fqName_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; } - fqname_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.FqName.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(fqname_); - fqname_ = subBuilder.buildPartial(); + while (input.getBytesUntilLimit() > 0) { + fqName_.add(input.readInt32()); } - bitField0_ |= 0x00000008; + input.popLimit(limit); break; } case 42: { org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.Builder subBuilder = null; - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { subBuilder = descriptorReference_.toBuilder(); } descriptorReference_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.PARSER, extensionRegistry); @@ -114,7 +122,7 @@ public final class IrSymbolData extends subBuilder.mergeFrom(descriptorReference_); descriptorReference_ = subBuilder.buildPartial(); } - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000008; break; } } @@ -125,6 +133,9 @@ public final class IrSymbolData extends throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + fqName_ = java.util.Collections.unmodifiableList(fqName_); + } try { unknownFieldsCodedOutput.flush(); } catch (java.io.IOException e) { @@ -196,31 +207,46 @@ public final class IrSymbolData extends return topLevelUniqId_; } - public static final int FQNAME_FIELD_NUMBER = 4; - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname_; + public static final int FQ_NAME_FIELD_NUMBER = 4; + private java.util.List fqName_; /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public boolean hasFqname() { - return ((bitField0_ & 0x00000008) == 0x00000008); + public java.util.List + getFqNameList() { + return fqName_; } /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getFqname() { - return fqname_; + public int getFqNameCount() { + return fqName_.size(); + } + /** + * repeated int32 fq_name = 4; + */ + public int getFqName(int index) { + return fqName_.get(index); } public static final int DESCRIPTOR_REFERENCE_FIELD_NUMBER = 5; private org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptorReference_; /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+   *  optional FqName fqname = 4;
+   * 
*/ public boolean hasDescriptorReference() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+   *  optional FqName fqname = 4;
+   * 
*/ public org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference getDescriptorReference() { return descriptorReference_; @@ -230,7 +256,7 @@ public final class IrSymbolData extends kind_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrSymbolKind.FUNCTION_SYMBOL; uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); topLevelUniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); - fqname_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + fqName_ = java.util.Collections.emptyList(); descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -281,10 +307,10 @@ public final class IrSymbolData extends if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(3, topLevelUniqId_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(4, fqname_); + for (int i = 0; i < fqName_.size(); i++) { + output.writeInt32(4, fqName_.get(i)); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeMessage(5, descriptorReference_); } output.writeRawBytes(unknownFields); @@ -308,11 +334,16 @@ public final class IrSymbolData extends size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(3, topLevelUniqId_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeMessageSize(4, fqname_); + { + int dataSize = 0; + for (int i = 0; i < fqName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(fqName_.get(i)); + } + size += dataSize; + size += 1 * getFqNameList().size(); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(5, descriptorReference_); } @@ -416,7 +447,7 @@ public final class IrSymbolData extends bitField0_ = (bitField0_ & ~0x00000002); topLevelUniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000004); - fqname_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); + fqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000010); @@ -455,12 +486,13 @@ public final class IrSymbolData extends to_bitField0_ |= 0x00000004; } result.topLevelUniqId_ = topLevelUniqId_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + fqName_ = java.util.Collections.unmodifiableList(fqName_); + bitField0_ = (bitField0_ & ~0x00000008); } - result.fqname_ = fqname_; + result.fqName_ = fqName_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; + to_bitField0_ |= 0x00000008; } result.descriptorReference_ = descriptorReference_; result.bitField0_ = to_bitField0_; @@ -478,8 +510,15 @@ public final class IrSymbolData extends if (other.hasTopLevelUniqId()) { mergeTopLevelUniqId(other.getTopLevelUniqId()); } - if (other.hasFqname()) { - mergeFqname(other.getFqname()); + if (!other.fqName_.isEmpty()) { + if (fqName_.isEmpty()) { + fqName_ = other.fqName_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureFqNameIsMutable(); + fqName_.addAll(other.fqName_); + } + } if (other.hasDescriptorReference()) { mergeDescriptorReference(other.getDescriptorReference()); @@ -693,81 +732,99 @@ public final class IrSymbolData extends return this; } - private org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; - */ - public boolean hasFqname() { - return ((bitField0_ & 0x00000008) == 0x00000008); + private java.util.List fqName_ = java.util.Collections.emptyList(); + private void ensureFqNameIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + fqName_ = new java.util.ArrayList(fqName_); + bitField0_ |= 0x00000008; + } } /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public org.jetbrains.kotlin.backend.common.serialization.proto.FqName getFqname() { - return fqname_; + public java.util.List + getFqNameList() { + return java.util.Collections.unmodifiableList(fqName_); } /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public Builder setFqname(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (value == null) { - throw new NullPointerException(); - } - fqname_ = value; - - bitField0_ |= 0x00000008; + public int getFqNameCount() { + return fqName_.size(); + } + /** + * repeated int32 fq_name = 4; + */ + public int getFqName(int index) { + return fqName_.get(index); + } + /** + * repeated int32 fq_name = 4; + */ + public Builder setFqName( + int index, int value) { + ensureFqNameIsMutable(); + fqName_.set(index, value); + return this; } /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public Builder setFqname( - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.Builder builderForValue) { - fqname_ = builderForValue.build(); - - bitField0_ |= 0x00000008; + public Builder addFqName(int value) { + ensureFqNameIsMutable(); + fqName_.add(value); + return this; } /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public Builder mergeFqname(org.jetbrains.kotlin.backend.common.serialization.proto.FqName value) { - if (((bitField0_ & 0x00000008) == 0x00000008) && - fqname_ != org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance()) { - fqname_ = - org.jetbrains.kotlin.backend.common.serialization.proto.FqName.newBuilder(fqname_).mergeFrom(value).buildPartial(); - } else { - fqname_ = value; - } - - bitField0_ |= 0x00000008; + public Builder addAllFqName( + java.lang.Iterable values) { + ensureFqNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, fqName_); + return this; } /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - public Builder clearFqname() { - fqname_ = org.jetbrains.kotlin.backend.common.serialization.proto.FqName.getDefaultInstance(); - + public Builder clearFqName() { + fqName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); + return this; } private org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance(); /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+     *  optional FqName fqname = 4;
+     * 
*/ public boolean hasDescriptorReference() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+     *  optional FqName fqname = 4;
+     * 
*/ public org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference getDescriptorReference() { return descriptorReference_; } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+     *  optional FqName fqname = 4;
+     * 
*/ public Builder setDescriptorReference(org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference value) { if (value == null) { @@ -780,6 +837,10 @@ public final class IrSymbolData extends } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+     *  optional FqName fqname = 4;
+     * 
*/ public Builder setDescriptorReference( org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.Builder builderForValue) { @@ -790,6 +851,10 @@ public final class IrSymbolData extends } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+     *  optional FqName fqname = 4;
+     * 
*/ public Builder mergeDescriptorReference(org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference value) { if (((bitField0_ & 0x00000010) == 0x00000010) && @@ -805,6 +870,10 @@ public final class IrSymbolData extends } /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+     *  optional FqName fqname = 4;
+     * 
*/ public Builder clearDescriptorReference() { descriptorReference_ = org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference.getDefaultInstance(); diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolDataOrBuilder.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolDataOrBuilder.java index 58e66d14d04..42fda4b16d1 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolDataOrBuilder.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/IrSymbolDataOrBuilder.java @@ -35,20 +35,32 @@ public interface IrSymbolDataOrBuilder extends org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getTopLevelUniqId(); /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - boolean hasFqname(); + java.util.List getFqNameList(); /** - * optional .org.jetbrains.kotlin.backend.common.serialization.proto.FqName fqname = 4; + * repeated int32 fq_name = 4; */ - org.jetbrains.kotlin.backend.common.serialization.proto.FqName getFqname(); + int getFqNameCount(); + /** + * repeated int32 fq_name = 4; + */ + int getFqName(int index); /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+   *  optional FqName fqname = 4;
+   * 
*/ boolean hasDescriptorReference(); /** * optional .org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference descriptor_reference = 5; + * + *
+   *  optional FqName fqname = 4;
+   * 
*/ org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference getDescriptorReference(); } \ No newline at end of file diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/StringTable.java b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/StringTable.java index db8f6a0c7e9..d4f65c1f9ca 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/StringTable.java +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/proto/StringTable.java @@ -432,4 +432,4 @@ public final class StringTable extends } // @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.StringTable) -} +} \ No newline at end of file