From 697228eae0c7de10f1dcc5b27400cca07b8d8dfd Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 25 Dec 2015 19:31:45 +0300 Subject: [PATCH] Mark enum entry names as name ids for incremental compilation purposes --- .../kotlin/serialization/DebugProtoBuf.java | 19 ++++++++++--------- core/deserialization/src/descriptors.proto | 2 +- .../jps/incremental/ProtoCompareGenerated.kt | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java b/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java index 72dcd27da66..6cc9bece8e3 100644 --- a/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java +++ b/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java @@ -21667,15 +21667,15 @@ public final class DebugProtoBuf { "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" + "\026vararg_element_type_id\030\006 \001(\005*\005\010d\020\310\001\"&\n\t" + + "EnumEntry\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001*9\n\010" + + "Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRAC" + + "T\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNA" + + "L\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLI" + + "C\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nM" + + "emberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERR" + + "IDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\022", + "B\rDebugProtoBuf\210\001\000" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -21801,6 +21801,7 @@ 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/deserialization/src/descriptors.proto b/core/deserialization/src/descriptors.proto index 6d15fc09be1..6a8d7665bdc 100644 --- a/core/deserialization/src/descriptors.proto +++ b/core/deserialization/src/descriptors.proto @@ -321,7 +321,7 @@ message ValueParameter { } message EnumEntry { - optional int32 name = 1; + optional int32 name = 1 [(name_id_in_table) = true]; extensions 100 to 199; } 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 9dd6ea9ef24..b35449f5e86 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt @@ -388,7 +388,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi open fun checkEquals(old: ProtoBuf.EnumEntry, new: ProtoBuf.EnumEntry): Boolean { if (old.hasName() != new.hasName()) return false if (old.hasName()) { - if (old.name != new.name) return false + if (!checkStringEquals(old.name, new.name)) return false } return true @@ -1075,7 +1075,7 @@ public fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexe var hashCode = 1 if (hasName()) { - hashCode = 31 * hashCode + name + hashCode = 31 * hashCode + stringIndexes(name) } return hashCode