diff --git a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt index 845701ff8e47..7661d42f9bc6 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt @@ -517,14 +517,26 @@ class IdeaPluginDescriptorImpl( nameToPoint: Map>, listenerCallbacks: MutableList?): Int { var registeredCount = 0 - for (entry in map) { - val point = nameToPoint.get(entry.key) ?: continue - point.registerExtensions(descriptors = entry.value, pluginDescriptor = this, listenerCallbacks = listenerCallbacks) + for ((descriptors, point) in intersectMaps(map, nameToPoint)) { + point.registerExtensions(descriptors = descriptors, pluginDescriptor = this, listenerCallbacks = listenerCallbacks) registeredCount++ } return registeredCount } + private fun intersectMaps(first: Map, second: Map): List> { + // Make sure we iterate the smaller map + if (first.size < second.size) { + return first.mapNotNull { (key, firstValue) -> + second[key]?.let { secondValue -> firstValue to secondValue } + } + } else { + return second.mapNotNull { (key, secondValue) -> + first[key]?.let { firstValue -> firstValue to secondValue } + } + } + } + @Suppress("HardCodedStringLiteral") override fun getDescription(): String? { var result = description