Fix KotlinNativeABICompatibilityChecker.getLibrariesToNotifyAbout freeze

Get rid of O(n^2) in copyProperties
make ModuleProductionSourceInfo.stableName lazy
add checkCanceled in loops in IdeaModelInfosCache

#KT-38318 Fixed
This commit is contained in:
Vladimir Dolzhenko
2020-04-17 10:13:07 +02:00
parent 06275a201c
commit 86a02c07f6
5 changed files with 20 additions and 10 deletions
@@ -55,9 +55,11 @@ private fun <From : Any, To : Any> copyProperties(
): To {
if (from == to) return to
val toMemberProperties = to::class.memberProperties.associateBy { it.name }
for (fromProperty in propertiesToCopy) {
@Suppress("UNCHECKED_CAST")
val toProperty = to::class.memberProperties.firstOrNull { it.name == fromProperty.name } as? KMutableProperty1<To, Any?>
val toProperty = toMemberProperties[fromProperty.name] as? KMutableProperty1<To, Any?>
?: continue
val fromValue = fromProperty.get(from)
if (filter != null && !filter(fromProperty, fromValue)) continue