From 66961715dddc76f12e0da68ca20845fe65006fbf Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 7 Oct 2015 15:36:03 +0300 Subject: [PATCH] Don't always write JVM method signatures to metadata When the trivial type mapping (implemented in JvmProtoBufUtil) from ProtoBuf.Type instances works fine, don't write the signature since it can be loaded by exactly the same trivial type mapping Original commit: 864926ee2e7a4b44012a5c2f9c68bd490dd7b0f6 --- .../jps/incremental/ProtoCompareGenerated.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt index da4adbf258f..fb2c9754a14 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt @@ -330,9 +330,15 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi } open fun checkEquals(old: JvmProtoBuf.JvmMethodSignature, new: JvmProtoBuf.JvmMethodSignature): Boolean { - if (!checkStringEquals(old.name, new.name)) return false + if (old.hasName() != new.hasName()) return false + if (old.hasName()) { + if (!checkStringEquals(old.name, new.name)) return false + } - if (!checkStringEquals(old.desc, new.desc)) return false + if (old.hasDesc() != new.hasDesc()) return false + if (old.hasDesc()) { + if (!checkStringEquals(old.desc, new.desc)) return false + } return true } @@ -896,9 +902,13 @@ public fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameI public fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { var hashCode = 1 - hashCode = 31 * hashCode + stringIndexes(name) + if (hasName()) { + hashCode = 31 * hashCode + stringIndexes(name) + } - hashCode = 31 * hashCode + stringIndexes(desc) + if (hasDesc()) { + hashCode = 31 * hashCode + stringIndexes(desc) + } return hashCode }