diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java index 61bf8a6af2f..30c870146b2 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java @@ -174,7 +174,6 @@ public class DescriptorSerializer { for (DeclarationDescriptor descriptor : sort(DescriptorUtils.getAllDescriptors(classDescriptor.getUnsubstitutedInnerClassesScope()))) { int name = getSimpleNameIndex(descriptor.getName()); if (isEnumEntry(descriptor)) { - builder.addEnumEntryName(name); builder.addEnumEntry(enumEntryProto((ClassDescriptor) descriptor)); } else { diff --git a/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java b/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java index a7c47973864..72dcd27da66 100644 --- a/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java +++ b/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java @@ -9492,20 +9492,6 @@ public final class DebugProtoBuf { org.jetbrains.kotlin.serialization.DebugProtoBuf.PropertyOrBuilder getPropertyOrBuilder( int index); - // repeated int32 enum_entry_name = 12 [packed = true]; - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - java.util.List getEnumEntryNameList(); - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - int getEnumEntryNameCount(); - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - int getEnumEntryName(int index); - // repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; /** * repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; @@ -9693,31 +9679,10 @@ public final class DebugProtoBuf { property_.add(input.readMessage(org.jetbrains.kotlin.serialization.DebugProtoBuf.Property.PARSER, extensionRegistry)); break; } - case 96: { - if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000400; - } - enumEntryName_.add(input.readInt32()); - break; - } - case 98: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000400) == 0x00000400) && input.getBytesUntilLimit() > 0) { - enumEntryName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000400; - } - while (input.getBytesUntilLimit() > 0) { - enumEntryName_.add(input.readInt32()); - } - input.popLimit(limit); - break; - } case 106: { - if (!((mutable_bitField0_ & 0x00000800) == 0x00000800)) { + if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) { enumEntry_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000800; + mutable_bitField0_ |= 0x00000400; } enumEntry_.add(input.readMessage(org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntry.PARSER, extensionRegistry)); break; @@ -9765,9 +9730,6 @@ public final class DebugProtoBuf { property_ = java.util.Collections.unmodifiableList(property_); } if (((mutable_bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = java.util.Collections.unmodifiableList(enumEntryName_); - } - if (((mutable_bitField0_ & 0x00000800) == 0x00000800)) { enumEntry_ = java.util.Collections.unmodifiableList(enumEntry_); } this.unknownFields = unknownFields.build(); @@ -10233,30 +10195,6 @@ public final class DebugProtoBuf { return property_.get(index); } - // repeated int32 enum_entry_name = 12 [packed = true]; - public static final int ENUM_ENTRY_NAME_FIELD_NUMBER = 12; - private java.util.List enumEntryName_; - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public java.util.List - getEnumEntryNameList() { - return enumEntryName_; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryNameCount() { - return enumEntryName_.size(); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryName(int index) { - return enumEntryName_.get(index); - } - private int enumEntryNameMemoizedSerializedSize = -1; - // repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; public static final int ENUM_ENTRY_FIELD_NUMBER = 13; private java.util.List enumEntry_; @@ -10326,7 +10264,6 @@ public final class DebugProtoBuf { constructor_ = java.util.Collections.emptyList(); function_ = java.util.Collections.emptyList(); property_ = java.util.Collections.emptyList(); - enumEntryName_ = java.util.Collections.emptyList(); enumEntry_ = java.util.Collections.emptyList(); typeTable_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeTable.getDefaultInstance(); } @@ -10433,13 +10370,6 @@ public final class DebugProtoBuf { for (int i = 0; i < property_.size(); i++) { output.writeMessage(10, property_.get(i)); } - if (getEnumEntryNameList().size() > 0) { - output.writeRawVarint32(98); - output.writeRawVarint32(enumEntryNameMemoizedSerializedSize); - } - for (int i = 0; i < enumEntryName_.size(); i++) { - output.writeInt32NoTag(enumEntryName_.get(i)); - } for (int i = 0; i < enumEntry_.size(); i++) { output.writeMessage(13, enumEntry_.get(i)); } @@ -10516,20 +10446,6 @@ public final class DebugProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(10, property_.get(i)); } - { - int dataSize = 0; - for (int i = 0; i < enumEntryName_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(enumEntryName_.get(i)); - } - size += dataSize; - if (!getEnumEntryNameList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - enumEntryNameMemoizedSerializedSize = dataSize; - } for (int i = 0; i < enumEntry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(13, enumEntry_.get(i)); @@ -10702,11 +10618,9 @@ public final class DebugProtoBuf { } else { propertyBuilder_.clear(); } - enumEntryName_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000400); if (enumEntryBuilder_ == null) { enumEntry_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); } else { enumEntryBuilder_.clear(); } @@ -10715,7 +10629,7 @@ public final class DebugProtoBuf { } else { typeTableBuilder_.clear(); } - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00000800); return this; } @@ -10811,21 +10725,16 @@ public final class DebugProtoBuf { } else { result.property_ = propertyBuilder_.build(); } - if (((bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = java.util.Collections.unmodifiableList(enumEntryName_); - bitField0_ = (bitField0_ & ~0x00000400); - } - result.enumEntryName_ = enumEntryName_; if (enumEntryBuilder_ == null) { - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000400) == 0x00000400)) { enumEntry_ = java.util.Collections.unmodifiableList(enumEntry_); - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); } result.enumEntry_ = enumEntry_; } else { result.enumEntry_ = enumEntryBuilder_.build(); } - if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + if (((from_bitField0_ & 0x00000800) == 0x00000800)) { to_bitField0_ |= 0x00000008; } if (typeTableBuilder_ == null) { @@ -11008,21 +10917,11 @@ public final class DebugProtoBuf { } } } - if (!other.enumEntryName_.isEmpty()) { - if (enumEntryName_.isEmpty()) { - enumEntryName_ = other.enumEntryName_; - bitField0_ = (bitField0_ & ~0x00000400); - } else { - ensureEnumEntryNameIsMutable(); - enumEntryName_.addAll(other.enumEntryName_); - } - onChanged(); - } if (enumEntryBuilder_ == null) { if (!other.enumEntry_.isEmpty()) { if (enumEntry_.isEmpty()) { enumEntry_ = other.enumEntry_; - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); } else { ensureEnumEntryIsMutable(); enumEntry_.addAll(other.enumEntry_); @@ -11035,7 +10934,7 @@ public final class DebugProtoBuf { enumEntryBuilder_.dispose(); enumEntryBuilder_ = null; enumEntry_ = other.enumEntry_; - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); enumEntryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEnumEntryFieldBuilder() : null; @@ -12596,79 +12495,13 @@ public final class DebugProtoBuf { return propertyBuilder_; } - // repeated int32 enum_entry_name = 12 [packed = true]; - private java.util.List enumEntryName_ = java.util.Collections.emptyList(); - private void ensureEnumEntryNameIsMutable() { - if (!((bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = new java.util.ArrayList(enumEntryName_); - bitField0_ |= 0x00000400; - } - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public java.util.List - getEnumEntryNameList() { - return java.util.Collections.unmodifiableList(enumEntryName_); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryNameCount() { - return enumEntryName_.size(); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryName(int index) { - return enumEntryName_.get(index); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder setEnumEntryName( - int index, int value) { - ensureEnumEntryNameIsMutable(); - enumEntryName_.set(index, value); - onChanged(); - return this; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder addEnumEntryName(int value) { - ensureEnumEntryNameIsMutable(); - enumEntryName_.add(value); - onChanged(); - return this; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder addAllEnumEntryName( - java.lang.Iterable values) { - ensureEnumEntryNameIsMutable(); - super.addAll(values, enumEntryName_); - onChanged(); - return this; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder clearEnumEntryName() { - enumEntryName_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000400); - onChanged(); - return this; - } - // repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; private java.util.List enumEntry_ = java.util.Collections.emptyList(); private void ensureEnumEntryIsMutable() { - if (!((bitField0_ & 0x00000800) == 0x00000800)) { + if (!((bitField0_ & 0x00000400) == 0x00000400)) { enumEntry_ = new java.util.ArrayList(enumEntry_); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000400; } } @@ -12817,7 +12650,7 @@ public final class DebugProtoBuf { public Builder clearEnumEntry() { if (enumEntryBuilder_ == null) { enumEntry_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); onChanged(); } else { enumEntryBuilder_.clear(); @@ -12894,7 +12727,7 @@ public final class DebugProtoBuf { enumEntryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntry, org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntry.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntryOrBuilder>( enumEntry_, - ((bitField0_ & 0x00000800) == 0x00000800), + ((bitField0_ & 0x00000400) == 0x00000400), getParentForChildren(), isClean()); enumEntry_ = null; @@ -12910,7 +12743,7 @@ public final class DebugProtoBuf { * optional .org.jetbrains.kotlin.serialization.TypeTable type_table = 30; */ public boolean hasTypeTable() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional .org.jetbrains.kotlin.serialization.TypeTable type_table = 30; @@ -12935,7 +12768,7 @@ public final class DebugProtoBuf { } else { typeTableBuilder_.setMessage(value); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; return this; } /** @@ -12949,7 +12782,7 @@ public final class DebugProtoBuf { } else { typeTableBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; return this; } /** @@ -12957,7 +12790,7 @@ public final class DebugProtoBuf { */ public Builder mergeTypeTable(org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeTable value) { if (typeTableBuilder_ == null) { - if (((bitField0_ & 0x00001000) == 0x00001000) && + if (((bitField0_ & 0x00000800) == 0x00000800) && typeTable_ != org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeTable.getDefaultInstance()) { typeTable_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial(); @@ -12968,7 +12801,7 @@ public final class DebugProtoBuf { } else { typeTableBuilder_.mergeFrom(value); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; return this; } /** @@ -12981,14 +12814,14 @@ public final class DebugProtoBuf { } else { typeTableBuilder_.clear(); } - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00000800); return this; } /** * optional .org.jetbrains.kotlin.serialization.TypeTable type_table = 30; */ public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; onChanged(); return getTypeTableFieldBuilder().getBuilder(); } @@ -21777,7 +21610,7 @@ public final class DebugProtoBuf { "per_bound\030\005 \003(\0132(.org.jetbrains.kotlin.s" + "erialization.Type\022\026\n\016upper_bound_id\030\006 \003(" + "\005\"$\n\010Variance\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*" + - "\005\010d\020\350\007\"\210\006\n\005Class\022\020\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq" + + "\005\010d\020\350\007\"\347\005\n\005Class\022\020\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq" + "_name\030\003 \002(\005B\004\220\265\030\001\022#\n\025companion_object_na" + "me\030\004 \001(\005B\004\210\265\030\001\022I\n\016type_parameter\030\005 \003(\01321" + ".org.jetbrains.kotlin.serialization.Type" + @@ -21789,61 +21622,60 @@ public final class DebugProtoBuf { "r\022>\n\010function\030\t \003(\0132,.org.jetbrains.kotl" + "in.serialization.Function\022>\n\010property\030\n " + "\003(\0132,.org.jetbrains.kotlin.serialization" + - ".Property\022\037\n\017enum_entry_name\030\014 \003(\005B\006\020\001\210\265" + - "\030\001\022A\n\nenum_entry\030\r \003(\0132-.org.jetbrains.k" + - "otlin.serialization.EnumEntry\022A\n\ntype_ta", - "ble\030\036 \001(\0132-.org.jetbrains.kotlin.seriali" + - "zation.TypeTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tI" + - "NTERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY" + - "\020\003\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020" + - "COMPANION_OBJECT\020\006*\005\010d\020\310\001\"\323\001\n\007Package\022>\n" + - "\010function\030\003 \003(\0132,.org.jetbrains.kotlin.s" + - "erialization.Function\022>\n\010property\030\004 \003(\0132" + - ",.org.jetbrains.kotlin.serialization.Pro" + - "perty\022A\n\ntype_table\030\036 \001(\0132-.org.jetbrain" + - "s.kotlin.serialization.TypeTable*\005\010d\020\310\001\"", - "_\n\tTypeTable\0226\n\004type\030\001 \003(\0132(.org.jetbrai" + - "ns.kotlin.serialization.Type\022\032\n\016first_nu" + - "llable\030\002 \001(\005:\002-1\"s\n\013Constructor\022\020\n\005flags" + - "\030\001 \001(\005:\0016\022K\n\017value_parameter\030\002 \003(\01322.org" + - ".jetbrains.kotlin.serialization.ValuePar" + - "ameter*\005\010d\020\310\001\"\304\003\n\010Function\022\020\n\005flags\030\001 \001(" + - "\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_type\030" + - "\003 \001(\0132(.org.jetbrains.kotlin.serializati" + - "on.Type\022\026\n\016return_type_id\030\007 \001(\005\022I\n\016type_" + - "parameter\030\004 \003(\01321.org.jetbrains.kotlin.s", - "erialization.TypeParameter\022?\n\rreceiver_t" + - "ype\030\005 \001(\0132(.org.jetbrains.kotlin.seriali" + - "zation.Type\022\030\n\020receiver_type_id\030\010 \001(\005\022K\n" + - "\017value_parameter\030\006 \003(\01322.org.jetbrains.k" + - "otlin.serialization.ValueParameter\022A\n\nty" + - "pe_table\030\036 \001(\0132-.org.jetbrains.kotlin.se" + - "rialization.TypeTable*\005\010d\020\310\001\"\266\003\n\010Propert" + - "y\022\022\n\005flags\030\001 \001(\005:\003262\022\022\n\004name\030\002 \002(\005B\004\210\265\030" + - "\001\022=\n\013return_type\030\003 \001(\0132(.org.jetbrains.k" + - "otlin.serialization.Type\022\026\n\016return_type_", - "id\030\t \001(\005\022I\n\016type_parameter\030\004 \003(\01321.org.j" + - "etbrains.kotlin.serialization.TypeParame" + - "ter\022?\n\rreceiver_type\030\005 \001(\0132(.org.jetbrai" + - "ns.kotlin.serialization.Type\022\030\n\020receiver" + - "_type_id\030\n \001(\005\022R\n\026setter_value_parameter" + - "\030\006 \001(\01322.org.jetbrains.kotlin.serializat" + - "ion.ValueParameter\022\024\n\014getter_flags\030\007 \001(\005" + - "\022\024\n\014setter_flags\030\010 \001(\005*\005\010d\020\310\001\"\355\001\n\016ValueP" + - "arameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005" + - "B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org.jetbrains.kot", - "lin.serialization.Type\022\017\n\007type_id\030\005 \001(\005\022" + - "E\n\023vararg_element_type\030\004 \001(\0132(.org.jetbr" + - "ains.kotlin.serialization.Type\022\036\n\026vararg" + - "_element_type_id\030\006 \001(\005*\005\010d\020\310\001\" \n\tEnumEnt" + - "ry\022\014\n\004name\030\001 \001(\005*\005\010d\020\310\001*9\n\010Modality\022\t\n\005F" + - "INAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED" + - "\020\003*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVAT" + - "E\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVAT" + - "E_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013" + - "DECLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELE", - "GATION\020\002\022\017\n\013SYNTHESIZED\020\003B\022B\rDebugProtoB" + - "uf\210\001\000" + ".Property\022A\n\nenum_entry\030\r \003(\0132-.org.jetb" + + "rains.kotlin.serialization.EnumEntry\022A\n\n" + + "type_table\030\036 \001(\0132-.org.jetbrains.kotlin.", + "serialization.TypeTable\"x\n\004Kind\022\t\n\005CLASS" + + "\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENU" + + "M_ENTRY\020\003\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJEC" + + "T\020\005\022\024\n\020COMPANION_OBJECT\020\006*\005\010d\020\310\001\"\323\001\n\007Pac" + + "kage\022>\n\010function\030\003 \003(\0132,.org.jetbrains.k" + + "otlin.serialization.Function\022>\n\010property" + + "\030\004 \003(\0132,.org.jetbrains.kotlin.serializat" + + "ion.Property\022A\n\ntype_table\030\036 \001(\0132-.org.j" + + "etbrains.kotlin.serialization.TypeTable*" + + "\005\010d\020\310\001\"_\n\tTypeTable\0226\n\004type\030\001 \003(\0132(.org.", + "jetbrains.kotlin.serialization.Type\022\032\n\016f" + + "irst_nullable\030\002 \001(\005:\002-1\"s\n\013Constructor\022\020" + + "\n\005flags\030\001 \001(\005:\0016\022K\n\017value_parameter\030\002 \003(" + + "\01322.org.jetbrains.kotlin.serialization.V" + + "alueParameter*\005\010d\020\310\001\"\304\003\n\010Function\022\020\n\005fla" + + "gs\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022=\n\013retur" + + "n_type\030\003 \001(\0132(.org.jetbrains.kotlin.seri" + + "alization.Type\022\026\n\016return_type_id\030\007 \001(\005\022I" + + "\n\016type_parameter\030\004 \003(\01321.org.jetbrains.k" + + "otlin.serialization.TypeParameter\022?\n\rrec", + "eiver_type\030\005 \001(\0132(.org.jetbrains.kotlin." + + "serialization.Type\022\030\n\020receiver_type_id\030\010" + + " \001(\005\022K\n\017value_parameter\030\006 \003(\01322.org.jetb" + + "rains.kotlin.serialization.ValueParamete" + + "r\022A\n\ntype_table\030\036 \001(\0132-.org.jetbrains.ko" + + "tlin.serialization.TypeTable*\005\010d\020\310\001\"\266\003\n\010" + + "Property\022\022\n\005flags\030\001 \001(\005:\003262\022\022\n\004name\030\002 \002" + + "(\005B\004\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.org.jetb" + + "rains.kotlin.serialization.Type\022\026\n\016retur" + + "n_type_id\030\t \001(\005\022I\n\016type_parameter\030\004 \003(\0132", + "1.org.jetbrains.kotlin.serialization.Typ" + + "eParameter\022?\n\rreceiver_type\030\005 \001(\0132(.org." + + "jetbrains.kotlin.serialization.Type\022\030\n\020r" + + "eceiver_type_id\030\n \001(\005\022R\n\026setter_value_pa" + + "rameter\030\006 \001(\01322.org.jetbrains.kotlin.ser" + + "ialization.ValueParameter\022\024\n\014getter_flag" + + "s\030\007 \001(\005\022\024\n\014setter_flags\030\010 \001(\005*\005\010d\020\310\001\"\355\001\n" + + "\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004nam" + + "e\030\002 \002(\005B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org.jetbra" + + "ins.kotlin.serialization.Type\022\017\n\007type_id", + "\030\005 \001(\005\022E\n\023vararg_element_type\030\004 \001(\0132(.or" + + "g.jetbrains.kotlin.serialization.Type\022\036\n" + + "\026vararg_element_type_id\030\006 \001(\005*\005\010d\020\310\001\" \n\t" + + "EnumEntry\022\014\n\004name\030\001 \001(\005*\005\010d\020\310\001*9\n\010Modali" + + "ty\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n" + + "\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n" + + "\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n" + + "\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberK" + + "ind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022" + + "\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\022B\rDebu", + "gProtoBuf\210\001\000" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -21909,7 +21741,7 @@ public final class DebugProtoBuf { internal_static_org_jetbrains_kotlin_serialization_Class_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_jetbrains_kotlin_serialization_Class_descriptor, - new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "EnumEntryName", "EnumEntry", "TypeTable", }); + new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "EnumEntry", "TypeTable", }); internal_static_org_jetbrains_kotlin_serialization_Package_descriptor = getDescriptor().getMessageTypes().get(6); internal_static_org_jetbrains_kotlin_serialization_Package_fieldAccessorTable = new @@ -21969,7 +21801,6 @@ public final class DebugProtoBuf { registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable); - registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable); return registry; } }; diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/JvmAbi.java b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/JvmAbi.java index 054ab267d1f..ffbd084386c 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/JvmAbi.java +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/JvmAbi.java @@ -35,7 +35,7 @@ public final class JvmAbi { * - Patch version can be increased freely and is only supposed to be used for debugging. Increase the patch version when you * make a change to the metadata format or the bytecode which is both forward- and backward compatible. */ - public static final BinaryVersion VERSION = BinaryVersion.create(1, 0, 1); + public static final BinaryVersion VERSION = BinaryVersion.create(1, 0, 2); public static final String DEFAULT_IMPLS_CLASS_NAME = "DefaultImpls"; public static final String DEFAULT_IMPLS_SUFFIX = "$" + DEFAULT_IMPLS_CLASS_NAME; diff --git a/core/deserialization/src/descriptors.proto b/core/deserialization/src/descriptors.proto index 194e2225b5e..6d15fc09be1 100644 --- a/core/deserialization/src/descriptors.proto +++ b/core/deserialization/src/descriptors.proto @@ -192,8 +192,6 @@ message Class { repeated Function function = 9; repeated Property property = 10; - repeated int32 enum_entry_name = 12 [packed = true, (name_id_in_table) = true]; - repeated EnumEntry enum_entry = 13; optional TypeTable type_table = 30; diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java b/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java index fc5d912c954..3c988071ca6 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java @@ -7538,20 +7538,6 @@ public final class ProtoBuf { */ int getPropertyCount(); - // repeated int32 enum_entry_name = 12 [packed = true]; - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - java.util.List getEnumEntryNameList(); - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - int getEnumEntryNameCount(); - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - int getEnumEntryName(int index); - // repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; /** * repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; @@ -7717,31 +7703,10 @@ public final class ProtoBuf { property_.add(input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.Property.PARSER, extensionRegistry)); break; } - case 96: { - if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000400; - } - enumEntryName_.add(input.readInt32()); - break; - } - case 98: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000400) == 0x00000400) && input.getBytesUntilLimit() > 0) { - enumEntryName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000400; - } - while (input.getBytesUntilLimit() > 0) { - enumEntryName_.add(input.readInt32()); - } - input.popLimit(limit); - break; - } case 106: { - if (!((mutable_bitField0_ & 0x00000800) == 0x00000800)) { + if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) { enumEntry_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000800; + mutable_bitField0_ |= 0x00000400; } enumEntry_.add(input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.EnumEntry.PARSER, extensionRegistry)); break; @@ -7789,9 +7754,6 @@ public final class ProtoBuf { property_ = java.util.Collections.unmodifiableList(property_); } if (((mutable_bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = java.util.Collections.unmodifiableList(enumEntryName_); - } - if (((mutable_bitField0_ & 0x00000800) == 0x00000800)) { enumEntry_ = java.util.Collections.unmodifiableList(enumEntry_); } makeExtensionsImmutable(); @@ -8218,30 +8180,6 @@ public final class ProtoBuf { return property_.get(index); } - // repeated int32 enum_entry_name = 12 [packed = true]; - public static final int ENUM_ENTRY_NAME_FIELD_NUMBER = 12; - private java.util.List enumEntryName_; - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public java.util.List - getEnumEntryNameList() { - return enumEntryName_; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryNameCount() { - return enumEntryName_.size(); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryName(int index) { - return enumEntryName_.get(index); - } - private int enumEntryNameMemoizedSerializedSize = -1; - // repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; public static final int ENUM_ENTRY_FIELD_NUMBER = 13; private java.util.List enumEntry_; @@ -8305,7 +8243,6 @@ public final class ProtoBuf { constructor_ = java.util.Collections.emptyList(); function_ = java.util.Collections.emptyList(); property_ = java.util.Collections.emptyList(); - enumEntryName_ = java.util.Collections.emptyList(); enumEntry_ = java.util.Collections.emptyList(); typeTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable.getDefaultInstance(); } @@ -8412,13 +8349,6 @@ public final class ProtoBuf { for (int i = 0; i < property_.size(); i++) { output.writeMessage(10, property_.get(i)); } - if (getEnumEntryNameList().size() > 0) { - output.writeRawVarint32(98); - output.writeRawVarint32(enumEntryNameMemoizedSerializedSize); - } - for (int i = 0; i < enumEntryName_.size(); i++) { - output.writeInt32NoTag(enumEntryName_.get(i)); - } for (int i = 0; i < enumEntry_.size(); i++) { output.writeMessage(13, enumEntry_.get(i)); } @@ -8494,20 +8424,6 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(10, property_.get(i)); } - { - int dataSize = 0; - for (int i = 0; i < enumEntryName_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(enumEntryName_.get(i)); - } - size += dataSize; - if (!getEnumEntryNameList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - enumEntryNameMemoizedSerializedSize = dataSize; - } for (int i = 0; i < enumEntry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(13, enumEntry_.get(i)); @@ -8627,12 +8543,10 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000100); property_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000200); - enumEntryName_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000400); enumEntry_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); typeTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00000800); return this; } @@ -8704,16 +8618,11 @@ public final class ProtoBuf { } result.property_ = property_; if (((bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = java.util.Collections.unmodifiableList(enumEntryName_); + enumEntry_ = java.util.Collections.unmodifiableList(enumEntry_); bitField0_ = (bitField0_ & ~0x00000400); } - result.enumEntryName_ = enumEntryName_; - if (((bitField0_ & 0x00000800) == 0x00000800)) { - enumEntry_ = java.util.Collections.unmodifiableList(enumEntry_); - bitField0_ = (bitField0_ & ~0x00000800); - } result.enumEntry_ = enumEntry_; - if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + if (((from_bitField0_ & 0x00000800) == 0x00000800)) { to_bitField0_ |= 0x00000008; } result.typeTable_ = typeTable_; @@ -8801,21 +8710,11 @@ public final class ProtoBuf { property_.addAll(other.property_); } - } - if (!other.enumEntryName_.isEmpty()) { - if (enumEntryName_.isEmpty()) { - enumEntryName_ = other.enumEntryName_; - bitField0_ = (bitField0_ & ~0x00000400); - } else { - ensureEnumEntryNameIsMutable(); - enumEntryName_.addAll(other.enumEntryName_); - } - } if (!other.enumEntry_.isEmpty()) { if (enumEntry_.isEmpty()) { enumEntry_ = other.enumEntry_; - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); } else { ensureEnumEntryIsMutable(); enumEntry_.addAll(other.enumEntry_); @@ -9798,79 +9697,13 @@ public final class ProtoBuf { return this; } - // repeated int32 enum_entry_name = 12 [packed = true]; - private java.util.List enumEntryName_ = java.util.Collections.emptyList(); - private void ensureEnumEntryNameIsMutable() { - if (!((bitField0_ & 0x00000400) == 0x00000400)) { - enumEntryName_ = new java.util.ArrayList(enumEntryName_); - bitField0_ |= 0x00000400; - } - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public java.util.List - getEnumEntryNameList() { - return java.util.Collections.unmodifiableList(enumEntryName_); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryNameCount() { - return enumEntryName_.size(); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public int getEnumEntryName(int index) { - return enumEntryName_.get(index); - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder setEnumEntryName( - int index, int value) { - ensureEnumEntryNameIsMutable(); - enumEntryName_.set(index, value); - - return this; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder addEnumEntryName(int value) { - ensureEnumEntryNameIsMutable(); - enumEntryName_.add(value); - - return this; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder addAllEnumEntryName( - java.lang.Iterable values) { - ensureEnumEntryNameIsMutable(); - super.addAll(values, enumEntryName_); - - return this; - } - /** - * repeated int32 enum_entry_name = 12 [packed = true]; - */ - public Builder clearEnumEntryName() { - enumEntryName_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000400); - - return this; - } - // repeated .org.jetbrains.kotlin.serialization.EnumEntry enum_entry = 13; private java.util.List enumEntry_ = java.util.Collections.emptyList(); private void ensureEnumEntryIsMutable() { - if (!((bitField0_ & 0x00000800) == 0x00000800)) { + if (!((bitField0_ & 0x00000400) == 0x00000400)) { enumEntry_ = new java.util.ArrayList(enumEntry_); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000400; } } @@ -9975,7 +9808,7 @@ public final class ProtoBuf { */ public Builder clearEnumEntry() { enumEntry_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); return this; } @@ -9995,7 +9828,7 @@ public final class ProtoBuf { * optional .org.jetbrains.kotlin.serialization.TypeTable type_table = 30; */ public boolean hasTypeTable() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional .org.jetbrains.kotlin.serialization.TypeTable type_table = 30; @@ -10012,7 +9845,7 @@ public final class ProtoBuf { } typeTable_ = value; - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; return this; } /** @@ -10022,14 +9855,14 @@ public final class ProtoBuf { org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable.Builder builderForValue) { typeTable_ = builderForValue.build(); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; return this; } /** * optional .org.jetbrains.kotlin.serialization.TypeTable type_table = 30; */ public Builder mergeTypeTable(org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable value) { - if (((bitField0_ & 0x00001000) == 0x00001000) && + if (((bitField0_ & 0x00000800) == 0x00000800) && typeTable_ != org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable.getDefaultInstance()) { typeTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial(); @@ -10037,7 +9870,7 @@ public final class ProtoBuf { typeTable_ = value; } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; return this; } /** @@ -10046,7 +9879,7 @@ public final class ProtoBuf { public Builder clearTypeTable() { typeTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.TypeTable.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00000800); return this; } diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt index 775a81e1531..d69f1c61a5d 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt @@ -287,23 +287,18 @@ public class DeserializedClassDescriptor( } private inner class EnumEntryClassDescriptors { - private val oldEnumEntryNames = classProto.enumEntryNameList.mapTo(LinkedHashSet()) { c.nameResolver.getName(it) } private val enumEntryProtos = classProto.enumEntryList.toMapBy { c.nameResolver.getName(it.name) } val enumEntryByName = c.storageManager.createMemoizedFunctionWithNullableValues { name -> - val annotations = enumEntryProtos[name]?.let { proto -> - DeserializedAnnotations(c.storageManager) { + enumEntryProtos[name]?.let { proto -> + val annotations = DeserializedAnnotations(c.storageManager) { c.components.annotationAndConstantLoader.loadEnumEntryAnnotations( ProtoContainer.Class(classProto, c.nameResolver, c.typeTable, isCompanionOfClass = false, isInterface = false), proto ) } - } ?: if (name in oldEnumEntryNames) Annotations.EMPTY - else null - - annotations?.let { annotations -> EnumEntrySyntheticClassDescriptor.create( c.storageManager, this@DeserializedClassDescriptor, name, enumMemberNames, annotations, SourceElement.NO_SOURCE ) @@ -332,7 +327,6 @@ public class DeserializedClassDescriptor( } fun all(): Collection = - (if (oldEnumEntryNames.isEmpty()) enumEntryProtos.keys else oldEnumEntryNames) - .mapNotNull { name -> findEnumEntry(name) } + enumEntryProtos.keys.mapNotNull { name -> findEnumEntry(name) } } } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt index 827195c926b..f8f52b8f7ea 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClassClsStubBuilder.kt @@ -39,7 +39,6 @@ import org.jetbrains.kotlin.serialization.deserialization.NameResolver import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer import org.jetbrains.kotlin.serialization.deserialization.TypeTable import org.jetbrains.kotlin.serialization.deserialization.supertypes -import org.jetbrains.kotlin.utils.sure fun createClassStub( parent: StubElement, @@ -72,12 +71,17 @@ private class ClassClsStubBuilder( supertypeIds } } - private val companionObjectName = if (classProto.hasCompanionObjectName()) c.nameResolver.getName(classProto.getCompanionObjectName()) else null - private val isCompanionOfClass: Boolean get() { - return classKind == ProtoBuf.Class.Kind.COMPANION_OBJECT && - (outerContext.classKind?.let { it == ProtoBuf.Class.Kind.CLASS || it == ProtoBuf.Class.Kind.ENUM_CLASS } ?: false) - } - private val isInterface: Boolean get() = classKind == ProtoBuf.Class.Kind.INTERFACE + + private val companionObjectName = + if (classProto.hasCompanionObjectName()) c.nameResolver.getName(classProto.companionObjectName) else null + + private val thisAsProtoContainer = + ProtoContainer.Class( + classProto, c.nameResolver, c.typeTable, + classKind == ProtoBuf.Class.Kind.COMPANION_OBJECT && + (outerContext.classKind?.let { it == ProtoBuf.Class.Kind.CLASS || it == ProtoBuf.Class.Kind.ENUM_CLASS } ?: false), + classKind == ProtoBuf.Class.Kind.INTERFACE + ) private val classOrObjectStub = createClassOrObjectStubAndModifierListStub() @@ -151,8 +155,7 @@ private class ClassClsStubBuilder( val primaryConstructorProto = classProto.constructorList.find { !Flags.IS_SECONDARY.get(it.flags) } ?: return - createConstructorStub(classOrObjectStub, primaryConstructorProto, c, - ProtoContainer.Class(classProto, c.nameResolver, c.typeTable, isCompanionOfClass, isInterface)) + createConstructorStub(classOrObjectStub, primaryConstructorProto, c, thisAsProtoContainer) } private fun createDelegationSpecifierList() { @@ -190,19 +193,9 @@ private class ClassClsStubBuilder( private fun createEnumEntryStubs(classBody: KotlinPlaceHolderStubImpl) { if (classKind != ProtoBuf.Class.Kind.ENUM_CLASS) return - val container = ProtoContainer.Class(classProto, c.nameResolver, c.typeTable, isCompanionOfClass, isInterface) - val enumEntries: List>> = - if (classProto.enumEntryList.isNotEmpty()) - classProto.enumEntryList.map { enumEntryProto -> - enumEntryProto.name to c.components.annotationLoader.loadEnumEntryAnnotations(container, enumEntryProto) - } - else classProto.enumEntryNameList.map { enumEntryName -> - enumEntryName to listOf() - } - - enumEntries.forEach { entry -> - val name = c.nameResolver.getName(entry.first) - val annotations = entry.second + classProto.enumEntryList.forEach { entry -> + val name = c.nameResolver.getName(entry.name) + val annotations = c.components.annotationLoader.loadEnumEntryAnnotations(thisAsProtoContainer, entry) val enumEntryStub = KotlinClassStubImpl( KtStubElementTypes.ENUM_ENTRY, classBody, @@ -221,15 +214,13 @@ private class ClassClsStubBuilder( } private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl) { - val container = ProtoContainer.Class(classProto, c.nameResolver, c.typeTable, isCompanionOfClass, isInterface) - for (secondaryConstructorProto in classProto.constructorList) { if (Flags.IS_SECONDARY.get(secondaryConstructorProto.flags)) { - createConstructorStub(classBody, secondaryConstructorProto, c, container) + createConstructorStub(classBody, secondaryConstructorProto, c, thisAsProtoContainer) } } - createCallableStubs(classBody, c, container, classProto.functionList, classProto.propertyList) + createCallableStubs(classBody, c, thisAsProtoContainer, classProto.functionList, classProto.propertyList) } private fun isClass(): Boolean { diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt index 653f7494278..ebcd3394391 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/IncrementalCacheImpl.kt @@ -218,7 +218,7 @@ public class IncrementalCacheImpl( public fun clearCacheForRemovedClasses(): CompilationResult { - fun T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List) = + fun T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List): Set = members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet() fun createChangeInfo(className: JvmClassName): ChangeInfo? { @@ -248,8 +248,7 @@ public class IncrementalCacheImpl( ProtoBuf.Class::getConstructorList, ProtoBuf.Class::getFunctionList, ProtoBuf.Class::getPropertyList - ) + - classData.classProto.enumEntryNameList.map { classData.nameResolver.getString(it) }.toSet() + ) + classData.classProto.enumEntryList.map { classData.nameResolver.getString(it.name) } ChangeInfo.Removed(className.fqNameForClassNameWithoutDollars, memberNames) } diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt index 1ab985461c7..ac285dc6624 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt @@ -94,8 +94,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi if (!checkEqualsClassProperty(old, new)) return false - if (!checkEqualsClassEnumEntryName(old, new)) return false - if (!checkEqualsClassEnumEntry(old, new)) return false if (old.hasTypeTable() != new.hasTypeTable()) return false @@ -122,7 +120,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi CONSTRUCTOR_LIST, FUNCTION_LIST, PROPERTY_LIST, - ENUM_ENTRY_NAME_LIST, ENUM_ENTRY_LIST, TYPE_TABLE, CLASS_ANNOTATION_LIST @@ -157,8 +154,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi if (!checkEqualsClassProperty(old, new)) result.add(ProtoBufClassKind.PROPERTY_LIST) - if (!checkEqualsClassEnumEntryName(old, new)) result.add(ProtoBufClassKind.ENUM_ENTRY_NAME_LIST) - if (!checkEqualsClassEnumEntry(old, new)) result.add(ProtoBufClassKind.ENUM_ENTRY_LIST) if (old.hasTypeTable() != new.hasTypeTable()) result.add(ProtoBufClassKind.TYPE_TABLE) @@ -673,16 +668,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi return true } - open fun checkEqualsClassEnumEntryName(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean { - if (old.enumEntryNameCount != new.enumEntryNameCount) return false - - for(i in 0..old.enumEntryNameCount - 1) { - if (!checkStringEquals(old.getEnumEntryName(i), new.getEnumEntryName(i))) return false - } - - return true - } - open fun checkEqualsClassEnumEntry(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean { if (old.enumEntryCount != new.enumEntryCount) return false @@ -883,10 +868,6 @@ public fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: ( hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes) } - for(i in 0..enumEntryNameCount - 1) { - hashCode = 31 * hashCode + stringIndexes(getEnumEntryName(i)) - } - for(i in 0..enumEntryCount - 1) { hashCode = 31 * hashCode + getEnumEntry(i).hashCode(stringIndexes, fqNameIndexes) } diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt index 6581f60fadb..32e59dc71ed 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/protoDifferenceUtils.kt @@ -206,8 +206,6 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getFunctionList)) ProtoBufClassKind.PROPERTY_LIST -> names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getPropertyList)) - ProtoBufClassKind.ENUM_ENTRY_NAME_LIST -> - names.addAll(calcDifferenceForNames(oldProto.enumEntryNameList, newProto.enumEntryNameList)) ProtoBufClassKind.ENUM_ENTRY_LIST -> names.addAll(calcDifferenceForNames(oldProto.enumEntryList.map { it.name }, newProto.enumEntryList.map { it.name })) ProtoBufClassKind.TYPE_TABLE -> {