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: 864926ee2e
This commit is contained in:
Alexander Udalov
2015-10-07 15:36:03 +03:00
parent 739cdb5c29
commit 66961715dd
@@ -330,9 +330,15 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
} }
open fun checkEquals(old: JvmProtoBuf.JvmMethodSignature, new: JvmProtoBuf.JvmMethodSignature): Boolean { 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 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 { public fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
var hashCode = 1 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 return hashCode
} }