[IR SERIALIZATION] Replace DescriptorReference boolean fields with single flag in proto

This commit is contained in:
Roman Artemev
2019-09-12 15:08:40 +03:00
committed by romanart
parent 105fc4b0ca
commit aeafaf78f1
7 changed files with 117 additions and 760 deletions
@@ -9,20 +9,8 @@ message DescriptorReference {
repeated int32 package_fq_name = 1; repeated int32 package_fq_name = 1;
repeated int32 class_fq_name = 2; repeated int32 class_fq_name = 2;
required int32 name = 3; required int32 name = 3;
optional UniqId uniq_id = 4; required int32 flags = 4;
optional bool is_getter = 5 [default = false]; optional int64 uniq_id_index = 5;
optional bool is_setter = 6 [default = false];
optional bool is_backing_field = 7 [default = false];
optional bool is_fake_override = 8 [default = false];
optional bool is_default_constructor = 9 [default = false];
optional bool is_enum_entry = 10 [default = false];
optional bool is_enum_special = 11 [default = false];
optional bool is_type_parameter = 12 [default = false];
}
message UniqId {
required uint64 index = 1;
required bool isLocal = 2;
} }
message Coordinates { message Coordinates {
@@ -0,0 +1,21 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common.serialization
enum class DescriptorReferenceFlags {
IS_FAKE_OVERRIDE,
IS_BACKING_FIELD,
IS_GETTER,
IS_SETTER,
IS_DEFAULT_CONSTRUCTOR,
IS_ENUM_ENTRY,
IS_ENUM_SPECIAL,
IS_TYPE_PARAMETER;
fun encode(isSet: Boolean): Int = if (isSet) 1 shl ordinal else 0
fun decode(flags: Int): Boolean = (flags and (1 shl ordinal) != 0)
}
@@ -89,14 +89,8 @@ abstract class DescriptorReferenceDeserializer(
packageFqName: FqName, packageFqName: FqName,
classFqName: FqName, classFqName: FqName,
name: String, name: String,
index: Long?, flags: Int,
isEnumEntry: Boolean = false, index: Long?
isEnumSpecial: Boolean = false,
isDefaultConstructor: Boolean = false,
isFakeOverride: Boolean = false,
isGetter: Boolean = false,
isSetter: Boolean = false,
isTypeParameter: Boolean = false
): DeclarationDescriptor { ): DeclarationDescriptor {
val protoIndex = index val protoIndex = index
@@ -118,9 +112,9 @@ abstract class DescriptorReferenceDeserializer(
) )
) { ) {
if (descriptor is DeserializedClassDescriptor) { if (descriptor is DeserializedClassDescriptor) {
val uniqId = UniqId(descriptor.getUniqId()!!, false) val uniqId = UniqId(descriptor.getUniqId()!!)
val newKey = uniqId val newKey = uniqId
val oldKey = UniqId(protoIndex!!, false) val oldKey = UniqId(protoIndex!!)
resolvedForwardDeclarations.put(oldKey, newKey) resolvedForwardDeclarations.put(oldKey, newKey)
} else { } else {
@@ -130,17 +124,17 @@ abstract class DescriptorReferenceDeserializer(
return descriptor return descriptor
} }
if (isEnumEntry) { if (DescriptorReferenceFlags.IS_ENUM_ENTRY.decode(flags)) {
val memberScope = (clazz as DeserializedClassDescriptor).getUnsubstitutedMemberScope() val memberScope = (clazz as DeserializedClassDescriptor).getUnsubstitutedMemberScope()
return memberScope.getContributedClassifier(Name.identifier(name), NoLookupLocation.FROM_BACKEND)!! return memberScope.getContributedClassifier(Name.identifier(name), NoLookupLocation.FROM_BACKEND)!!
} }
if (isEnumSpecial) { if (DescriptorReferenceFlags.IS_ENUM_SPECIAL.decode(flags)) {
return clazz!!.getStaticScope() return clazz!!.getStaticScope()
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).single() .getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).single()
} }
if (isTypeParameter) { if (DescriptorReferenceFlags.IS_TYPE_PARAMETER.decode(flags)) {
for (m in (listOfNotNull(clazz) + members)) { for (m in (listOfNotNull(clazz) + members)) {
val typeParameters = when (m) { val typeParameters = when (m) {
@@ -162,14 +156,14 @@ abstract class DescriptorReferenceDeserializer(
val membersWithIndices = getMembers(members) val membersWithIndices = getMembers(members)
return when { return when {
isDefaultConstructor -> membersWithIndices.defaultConstructor DescriptorReferenceFlags.IS_DEFAULT_CONSTRUCTOR.decode(flags) -> membersWithIndices.defaultConstructor
else -> { else -> {
val map = if (isFakeOverride) membersWithIndices.realMembers else membersWithIndices.members val map = if (DescriptorReferenceFlags.IS_FAKE_OVERRIDE.decode(flags)) membersWithIndices.realMembers else membersWithIndices.members
map[protoIndex]?.let { member -> map[protoIndex]?.let { member ->
when { when {
member is PropertyDescriptor && isSetter -> member.setter!! member is PropertyDescriptor && DescriptorReferenceFlags.IS_SETTER.decode(flags) -> member.setter!!
member is PropertyDescriptor && isGetter -> member.getter!! member is PropertyDescriptor && DescriptorReferenceFlags.IS_GETTER.decode(flags) -> member.getter!!
else -> member else -> member
} }
} }
@@ -332,14 +332,8 @@ abstract class KotlinIrLinker(
deserializeFqName(proto.packageFqNameList), deserializeFqName(proto.packageFqNameList),
deserializeFqName(proto.classFqNameList), deserializeFqName(proto.classFqNameList),
deserializeString(proto.name), deserializeString(proto.name),
if (proto.hasUniqId()) proto.uniqId.index else null, proto.flags,
isEnumEntry = proto.isEnumEntry, if (proto.hasUniqIdIndex()) proto.uniqIdIndex else null
isEnumSpecial = proto.isEnumSpecial,
isDefaultConstructor = proto.isDefaultConstructor,
isFakeOverride = proto.isFakeOverride,
isGetter = proto.isGetter,
isSetter = proto.isSetter,
isTypeParameter = proto.isTypeParameter
) )
override fun deserializeIrSymbol(index: Int): IrSymbol { override fun deserializeIrSymbol(index: Int): IrSymbol {
@@ -115,32 +115,18 @@ open class DescriptorReferenceSerializer(
.addAllClassFqName(serializeFqName(classFqName)) .addAllClassFqName(serializeFqName(classFqName))
.setName(serializeString(nameString)) .setName(serializeString(nameString))
if (uniqId != null) proto.setUniqId(protoUniqId(uniqId)) val flags = DescriptorReferenceFlags.IS_FAKE_OVERRIDE.encode(isFakeOverride) or
DescriptorReferenceFlags.IS_BACKING_FIELD.encode(isBackingField) or
DescriptorReferenceFlags.IS_GETTER.encode(declaration.isGetter) or
DescriptorReferenceFlags.IS_SETTER.encode(declaration.isSetter) or
DescriptorReferenceFlags.IS_DEFAULT_CONSTRUCTOR.encode(isDefaultConstructor) or
DescriptorReferenceFlags.IS_ENUM_ENTRY.encode(isEnumEntry) or
DescriptorReferenceFlags.IS_ENUM_SPECIAL.encode(isEnumSpecial) or
DescriptorReferenceFlags.IS_TYPE_PARAMETER.encode(isTypeParameter)
if (isFakeOverride) { proto.flags = flags
proto.setIsFakeOverride(true)
}
if (isBackingField) { if (uniqId != null) proto.uniqIdIndex = uniqId.index
proto.setIsBackingField(true)
}
if (isAccessor) {
if (declaration.isGetter)
proto.setIsGetter(true)
else if (declaration.isSetter)
proto.setIsSetter(true)
else
error("A property accessor which is neither a getter, nor a setter: $descriptor")
} else if (isDefaultConstructor) {
proto.setIsDefaultConstructor(true)
} else if (isEnumEntry) {
proto.setIsEnumEntry(true)
} else if (isEnumSpecial) {
proto.setIsEnumSpecial(true)
} else if (isTypeParameter) {
proto.setIsTypeParameter(true)
}
return proto.build() return proto.build()
} }
@@ -100,57 +100,14 @@ public final class DescriptorReference extends
name_ = input.readInt32(); name_ = input.readInt32();
break; break;
} }
case 34: { case 32: {
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder subBuilder = null;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = uniqId_.toBuilder();
}
uniqId_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(uniqId_);
uniqId_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
flags_ = input.readInt32();
break; break;
} }
case 40: { case 40: {
bitField0_ |= 0x00000004; bitField0_ |= 0x00000004;
isGetter_ = input.readBool(); uniqIdIndex_ = input.readInt64();
break;
}
case 48: {
bitField0_ |= 0x00000008;
isSetter_ = input.readBool();
break;
}
case 56: {
bitField0_ |= 0x00000010;
isBackingField_ = input.readBool();
break;
}
case 64: {
bitField0_ |= 0x00000020;
isFakeOverride_ = input.readBool();
break;
}
case 72: {
bitField0_ |= 0x00000040;
isDefaultConstructor_ = input.readBool();
break;
}
case 80: {
bitField0_ |= 0x00000080;
isEnumEntry_ = input.readBool();
break;
}
case 88: {
bitField0_ |= 0x00000100;
isEnumSpecial_ = input.readBool();
break;
}
case 96: {
bitField0_ |= 0x00000200;
isTypeParameter_ = input.readBool();
break; break;
} }
} }
@@ -241,175 +198,53 @@ public final class DescriptorReference extends
private int name_; private int name_;
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
public boolean hasName() { public boolean hasName() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
public int getName() { public int getName() {
return name_; return name_;
} }
public static final int UNIQ_ID_FIELD_NUMBER = 4; public static final int FLAGS_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniqId_; private int flags_;
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
public boolean hasUniqId() { public boolean hasFlags() {
return ((bitField0_ & 0x00000002) == 0x00000002); return ((bitField0_ & 0x00000002) == 0x00000002);
} }
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getUniqId() { public int getFlags() {
return uniqId_; return flags_;
} }
public static final int IS_GETTER_FIELD_NUMBER = 5; public static final int UNIQ_ID_INDEX_FIELD_NUMBER = 5;
private boolean isGetter_; private long uniqIdIndex_;
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
public boolean hasIsGetter() { public boolean hasUniqIdIndex() {
return ((bitField0_ & 0x00000004) == 0x00000004); return ((bitField0_ & 0x00000004) == 0x00000004);
} }
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
public boolean getIsGetter() { public long getUniqIdIndex() {
return isGetter_; return uniqIdIndex_;
}
public static final int IS_SETTER_FIELD_NUMBER = 6;
private boolean isSetter_;
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
public boolean hasIsSetter() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
public boolean getIsSetter() {
return isSetter_;
}
public static final int IS_BACKING_FIELD_FIELD_NUMBER = 7;
private boolean isBackingField_;
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
public boolean hasIsBackingField() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
public boolean getIsBackingField() {
return isBackingField_;
}
public static final int IS_FAKE_OVERRIDE_FIELD_NUMBER = 8;
private boolean isFakeOverride_;
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
public boolean hasIsFakeOverride() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
public boolean getIsFakeOverride() {
return isFakeOverride_;
}
public static final int IS_DEFAULT_CONSTRUCTOR_FIELD_NUMBER = 9;
private boolean isDefaultConstructor_;
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
public boolean hasIsDefaultConstructor() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
public boolean getIsDefaultConstructor() {
return isDefaultConstructor_;
}
public static final int IS_ENUM_ENTRY_FIELD_NUMBER = 10;
private boolean isEnumEntry_;
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
public boolean hasIsEnumEntry() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
public boolean getIsEnumEntry() {
return isEnumEntry_;
}
public static final int IS_ENUM_SPECIAL_FIELD_NUMBER = 11;
private boolean isEnumSpecial_;
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
public boolean hasIsEnumSpecial() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
public boolean getIsEnumSpecial() {
return isEnumSpecial_;
}
public static final int IS_TYPE_PARAMETER_FIELD_NUMBER = 12;
private boolean isTypeParameter_;
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
public boolean hasIsTypeParameter() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
public boolean getIsTypeParameter() {
return isTypeParameter_;
} }
private void initFields() { private void initFields() {
packageFqName_ = java.util.Collections.emptyList(); packageFqName_ = java.util.Collections.emptyList();
classFqName_ = java.util.Collections.emptyList(); classFqName_ = java.util.Collections.emptyList();
name_ = 0; name_ = 0;
uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); flags_ = 0;
isGetter_ = false; uniqIdIndex_ = 0L;
isSetter_ = false;
isBackingField_ = false;
isFakeOverride_ = false;
isDefaultConstructor_ = false;
isEnumEntry_ = false;
isEnumSpecial_ = false;
isTypeParameter_ = false;
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { public final boolean isInitialized() {
@@ -421,11 +256,9 @@ public final class DescriptorReference extends
memoizedIsInitialized = 0; memoizedIsInitialized = 0;
return false; return false;
} }
if (hasUniqId()) { if (!hasFlags()) {
if (!getUniqId().isInitialized()) { memoizedIsInitialized = 0;
memoizedIsInitialized = 0; return false;
return false;
}
} }
memoizedIsInitialized = 1; memoizedIsInitialized = 1;
return true; return true;
@@ -444,31 +277,10 @@ public final class DescriptorReference extends
output.writeInt32(3, name_); output.writeInt32(3, name_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(4, uniqId_); output.writeInt32(4, flags_);
} }
if (((bitField0_ & 0x00000004) == 0x00000004)) { if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBool(5, isGetter_); output.writeInt64(5, uniqIdIndex_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBool(6, isSetter_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeBool(7, isBackingField_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBool(8, isFakeOverride_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeBool(9, isDefaultConstructor_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeBool(10, isEnumEntry_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeBool(11, isEnumSpecial_);
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
output.writeBool(12, isTypeParameter_);
} }
output.writeRawBytes(unknownFields); output.writeRawBytes(unknownFields);
} }
@@ -503,39 +315,11 @@ public final class DescriptorReference extends
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, uniqId_); .computeInt32Size(4, flags_);
} }
if (((bitField0_ & 0x00000004) == 0x00000004)) { if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(5, isGetter_); .computeInt64Size(5, uniqIdIndex_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(6, isSetter_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(7, isBackingField_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(8, isFakeOverride_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(9, isDefaultConstructor_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(10, isEnumEntry_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(11, isEnumSpecial_);
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(12, isTypeParameter_);
} }
size += unknownFields.size(); size += unknownFields.size();
memoizedSerializedSize = size; memoizedSerializedSize = size;
@@ -637,24 +421,10 @@ public final class DescriptorReference extends
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
name_ = 0; name_ = 0;
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000004);
uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); flags_ = 0;
bitField0_ = (bitField0_ & ~0x00000008); bitField0_ = (bitField0_ & ~0x00000008);
isGetter_ = false; uniqIdIndex_ = 0L;
bitField0_ = (bitField0_ & ~0x00000010); bitField0_ = (bitField0_ & ~0x00000010);
isSetter_ = false;
bitField0_ = (bitField0_ & ~0x00000020);
isBackingField_ = false;
bitField0_ = (bitField0_ & ~0x00000040);
isFakeOverride_ = false;
bitField0_ = (bitField0_ & ~0x00000080);
isDefaultConstructor_ = false;
bitField0_ = (bitField0_ & ~0x00000100);
isEnumEntry_ = false;
bitField0_ = (bitField0_ & ~0x00000200);
isEnumSpecial_ = false;
bitField0_ = (bitField0_ & ~0x00000400);
isTypeParameter_ = false;
bitField0_ = (bitField0_ & ~0x00000800);
return this; return this;
} }
@@ -695,39 +465,11 @@ public final class DescriptorReference extends
if (((from_bitField0_ & 0x00000008) == 0x00000008)) { if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000002; to_bitField0_ |= 0x00000002;
} }
result.uniqId_ = uniqId_; result.flags_ = flags_;
if (((from_bitField0_ & 0x00000010) == 0x00000010)) { if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000004; to_bitField0_ |= 0x00000004;
} }
result.isGetter_ = isGetter_; result.uniqIdIndex_ = uniqIdIndex_;
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
to_bitField0_ |= 0x00000008;
}
result.isSetter_ = isSetter_;
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000010;
}
result.isBackingField_ = isBackingField_;
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
to_bitField0_ |= 0x00000020;
}
result.isFakeOverride_ = isFakeOverride_;
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000040;
}
result.isDefaultConstructor_ = isDefaultConstructor_;
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
to_bitField0_ |= 0x00000080;
}
result.isEnumEntry_ = isEnumEntry_;
if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
to_bitField0_ |= 0x00000100;
}
result.isEnumSpecial_ = isEnumSpecial_;
if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
to_bitField0_ |= 0x00000200;
}
result.isTypeParameter_ = isTypeParameter_;
result.bitField0_ = to_bitField0_; result.bitField0_ = to_bitField0_;
return result; return result;
} }
@@ -757,32 +499,11 @@ public final class DescriptorReference extends
if (other.hasName()) { if (other.hasName()) {
setName(other.getName()); setName(other.getName());
} }
if (other.hasUniqId()) { if (other.hasFlags()) {
mergeUniqId(other.getUniqId()); setFlags(other.getFlags());
} }
if (other.hasIsGetter()) { if (other.hasUniqIdIndex()) {
setIsGetter(other.getIsGetter()); setUniqIdIndex(other.getUniqIdIndex());
}
if (other.hasIsSetter()) {
setIsSetter(other.getIsSetter());
}
if (other.hasIsBackingField()) {
setIsBackingField(other.getIsBackingField());
}
if (other.hasIsFakeOverride()) {
setIsFakeOverride(other.getIsFakeOverride());
}
if (other.hasIsDefaultConstructor()) {
setIsDefaultConstructor(other.getIsDefaultConstructor());
}
if (other.hasIsEnumEntry()) {
setIsEnumEntry(other.getIsEnumEntry());
}
if (other.hasIsEnumSpecial()) {
setIsEnumSpecial(other.getIsEnumSpecial());
}
if (other.hasIsTypeParameter()) {
setIsTypeParameter(other.getIsTypeParameter());
} }
setUnknownFields( setUnknownFields(
getUnknownFields().concat(other.unknownFields)); getUnknownFields().concat(other.unknownFields));
@@ -794,11 +515,9 @@ public final class DescriptorReference extends
return false; return false;
} }
if (hasUniqId()) { if (!hasFlags()) {
if (!getUniqId().isInitialized()) {
return false; return false;
}
} }
return true; return true;
} }
@@ -957,33 +676,18 @@ public final class DescriptorReference extends
private int name_ ; private int name_ ;
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
public boolean hasName() { public boolean hasName() {
return ((bitField0_ & 0x00000004) == 0x00000004); return ((bitField0_ & 0x00000004) == 0x00000004);
} }
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
public int getName() { public int getName() {
return name_; return name_;
} }
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
public Builder setName(int value) { public Builder setName(int value) {
bitField0_ |= 0x00000004; bitField0_ |= 0x00000004;
@@ -993,11 +697,6 @@ public final class DescriptorReference extends
} }
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
public Builder clearName() { public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000004);
@@ -1006,318 +705,66 @@ public final class DescriptorReference extends
return this; return this;
} }
private org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance(); private int flags_ ;
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
public boolean hasUniqId() { public boolean hasFlags() {
return ((bitField0_ & 0x00000008) == 0x00000008); return ((bitField0_ & 0x00000008) == 0x00000008);
} }
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
public org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getUniqId() { public int getFlags() {
return uniqId_; return flags_;
} }
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
public Builder setUniqId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) { public Builder setFlags(int value) {
if (value == null) {
throw new NullPointerException();
}
uniqId_ = value;
bitField0_ |= 0x00000008; bitField0_ |= 0x00000008;
flags_ = value;
return this; return this;
} }
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
public Builder setUniqId( public Builder clearFlags() {
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.Builder builderForValue) {
uniqId_ = builderForValue.build();
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code>
*/
public Builder mergeUniqId(org.jetbrains.kotlin.backend.common.serialization.proto.UniqId value) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
uniqId_ != org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance()) {
uniqId_ =
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.newBuilder(uniqId_).mergeFrom(value).buildPartial();
} else {
uniqId_ = value;
}
bitField0_ |= 0x00000008;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code>
*/
public Builder clearUniqId() {
uniqId_ = org.jetbrains.kotlin.backend.common.serialization.proto.UniqId.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000008); bitField0_ = (bitField0_ & ~0x00000008);
flags_ = 0;
return this; return this;
} }
private boolean isGetter_ ; private long uniqIdIndex_ ;
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
public boolean hasIsGetter() { public boolean hasUniqIdIndex() {
return ((bitField0_ & 0x00000010) == 0x00000010); return ((bitField0_ & 0x00000010) == 0x00000010);
} }
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
public boolean getIsGetter() { public long getUniqIdIndex() {
return isGetter_; return uniqIdIndex_;
} }
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
public Builder setIsGetter(boolean value) { public Builder setUniqIdIndex(long value) {
bitField0_ |= 0x00000010; bitField0_ |= 0x00000010;
isGetter_ = value; uniqIdIndex_ = value;
return this; return this;
} }
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
public Builder clearIsGetter() { public Builder clearUniqIdIndex() {
bitField0_ = (bitField0_ & ~0x00000010); bitField0_ = (bitField0_ & ~0x00000010);
isGetter_ = false; uniqIdIndex_ = 0L;
return this;
}
private boolean isSetter_ ;
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
public boolean hasIsSetter() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
public boolean getIsSetter() {
return isSetter_;
}
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
public Builder setIsSetter(boolean value) {
bitField0_ |= 0x00000020;
isSetter_ = value;
return this;
}
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
public Builder clearIsSetter() {
bitField0_ = (bitField0_ & ~0x00000020);
isSetter_ = false;
return this;
}
private boolean isBackingField_ ;
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
public boolean hasIsBackingField() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
public boolean getIsBackingField() {
return isBackingField_;
}
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
public Builder setIsBackingField(boolean value) {
bitField0_ |= 0x00000040;
isBackingField_ = value;
return this;
}
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
public Builder clearIsBackingField() {
bitField0_ = (bitField0_ & ~0x00000040);
isBackingField_ = false;
return this;
}
private boolean isFakeOverride_ ;
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
public boolean hasIsFakeOverride() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
public boolean getIsFakeOverride() {
return isFakeOverride_;
}
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
public Builder setIsFakeOverride(boolean value) {
bitField0_ |= 0x00000080;
isFakeOverride_ = value;
return this;
}
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
public Builder clearIsFakeOverride() {
bitField0_ = (bitField0_ & ~0x00000080);
isFakeOverride_ = false;
return this;
}
private boolean isDefaultConstructor_ ;
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
public boolean hasIsDefaultConstructor() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
public boolean getIsDefaultConstructor() {
return isDefaultConstructor_;
}
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
public Builder setIsDefaultConstructor(boolean value) {
bitField0_ |= 0x00000100;
isDefaultConstructor_ = value;
return this;
}
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
public Builder clearIsDefaultConstructor() {
bitField0_ = (bitField0_ & ~0x00000100);
isDefaultConstructor_ = false;
return this;
}
private boolean isEnumEntry_ ;
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
public boolean hasIsEnumEntry() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
public boolean getIsEnumEntry() {
return isEnumEntry_;
}
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
public Builder setIsEnumEntry(boolean value) {
bitField0_ |= 0x00000200;
isEnumEntry_ = value;
return this;
}
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
public Builder clearIsEnumEntry() {
bitField0_ = (bitField0_ & ~0x00000200);
isEnumEntry_ = false;
return this;
}
private boolean isEnumSpecial_ ;
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
public boolean hasIsEnumSpecial() {
return ((bitField0_ & 0x00000400) == 0x00000400);
}
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
public boolean getIsEnumSpecial() {
return isEnumSpecial_;
}
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
public Builder setIsEnumSpecial(boolean value) {
bitField0_ |= 0x00000400;
isEnumSpecial_ = value;
return this;
}
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
public Builder clearIsEnumSpecial() {
bitField0_ = (bitField0_ & ~0x00000400);
isEnumSpecial_ = false;
return this;
}
private boolean isTypeParameter_ ;
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
public boolean hasIsTypeParameter() {
return ((bitField0_ & 0x00000800) == 0x00000800);
}
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
public boolean getIsTypeParameter() {
return isTypeParameter_;
}
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
public Builder setIsTypeParameter(boolean value) {
bitField0_ |= 0x00000800;
isTypeParameter_ = value;
return this;
}
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
public Builder clearIsTypeParameter() {
bitField0_ = (bitField0_ & ~0x00000800);
isTypeParameter_ = false;
return this; return this;
} }
@@ -35,101 +35,28 @@ public interface DescriptorReferenceOrBuilder extends
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
boolean hasName(); boolean hasName();
/** /**
* <code>required int32 name = 3;</code> * <code>required int32 name = 3;</code>
*
* <pre>
* required FqName package_fq_name = 1;
* required FqName class_fq_name = 2;
* </pre>
*/ */
int getName(); int getName();
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
boolean hasUniqId(); boolean hasFlags();
/** /**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.UniqId uniq_id = 4;</code> * <code>required int32 flags = 4;</code>
*/ */
org.jetbrains.kotlin.backend.common.serialization.proto.UniqId getUniqId(); int getFlags();
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
boolean hasIsGetter(); boolean hasUniqIdIndex();
/** /**
* <code>optional bool is_getter = 5 [default = false];</code> * <code>optional int64 uniq_id_index = 5;</code>
*/ */
boolean getIsGetter(); long getUniqIdIndex();
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
boolean hasIsSetter();
/**
* <code>optional bool is_setter = 6 [default = false];</code>
*/
boolean getIsSetter();
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
boolean hasIsBackingField();
/**
* <code>optional bool is_backing_field = 7 [default = false];</code>
*/
boolean getIsBackingField();
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
boolean hasIsFakeOverride();
/**
* <code>optional bool is_fake_override = 8 [default = false];</code>
*/
boolean getIsFakeOverride();
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
boolean hasIsDefaultConstructor();
/**
* <code>optional bool is_default_constructor = 9 [default = false];</code>
*/
boolean getIsDefaultConstructor();
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
boolean hasIsEnumEntry();
/**
* <code>optional bool is_enum_entry = 10 [default = false];</code>
*/
boolean getIsEnumEntry();
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
boolean hasIsEnumSpecial();
/**
* <code>optional bool is_enum_special = 11 [default = false];</code>
*/
boolean getIsEnumSpecial();
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
boolean hasIsTypeParameter();
/**
* <code>optional bool is_type_parameter = 12 [default = false];</code>
*/
boolean getIsTypeParameter();
} }