From 646d7feb4c224d281950560f98c108d70d6555ca Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 9 Oct 2015 04:47:16 +0300 Subject: [PATCH] Store type parameter names sometimes instead of ids This helps to reuse instances of types when TypeTable is enabled in cases when a file or a class contains a lot of functions with type parameters with the same name (like Maps.kt in the stdlib with "Map") Original commit: 4c211426485d19feb550d40366a5e408dc27b417 --- .../kotlin/jps/incremental/ProtoCompareGenerated.kt | 9 +++++++++ 1 file changed, 9 insertions(+) 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 4401a64b791..12338aa078e 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 @@ -344,6 +344,11 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi if (old.typeParameter != new.typeParameter) return false } + if (old.hasTypeParameterName() != new.hasTypeParameterName()) return false + if (old.hasTypeParameterName()) { + if (!checkStringEquals(old.typeParameterName, new.typeParameterName)) return false + } + if (old.getExtensionCount(JvmProtoBuf.typeAnnotation) != new.getExtensionCount(JvmProtoBuf.typeAnnotation)) return false for(i in 0..old.getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) { @@ -1024,6 +1029,10 @@ public fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I hashCode = 31 * hashCode + typeParameter } + if (hasTypeParameterName()) { + hashCode = 31 * hashCode + stringIndexes(typeParameterName) + } + for(i in 0..getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) { hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes) }