From db901c07f0aa76b3d9d01c730771b62fb0755f89 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 2 Mar 2023 00:08:30 +0400 Subject: [PATCH] fix: sourceplusplus/sourceplusplus#939 --- .../spp/jetbrains/marker/service/SourceGuideProvider.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/marker/src/main/kotlin/spp/jetbrains/marker/service/SourceGuideProvider.kt b/marker/src/main/kotlin/spp/jetbrains/marker/service/SourceGuideProvider.kt index 2e7c6603f..c6cce3e90 100644 --- a/marker/src/main/kotlin/spp/jetbrains/marker/service/SourceGuideProvider.kt +++ b/marker/src/main/kotlin/spp/jetbrains/marker/service/SourceGuideProvider.kt @@ -22,6 +22,7 @@ import com.intellij.openapi.diagnostic.logger import spp.jetbrains.marker.service.define.AbstractSourceGuideProvider import spp.jetbrains.marker.source.SourceFileMarker import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArrayList /** * todo: description. @@ -32,15 +33,14 @@ import java.util.concurrent.ConcurrentHashMap object SourceGuideProvider : AbstractSourceGuideProvider { private val log = logger() - private val providers = ConcurrentHashMap>() + private val providers = ConcurrentHashMap>() fun addProvider(guideProvider: AbstractSourceGuideProvider, language: String, vararg languages: String) { - providers.computeIfAbsent(language) { mutableListOf() }.add(guideProvider) - languages.forEach { providers.computeIfAbsent(it) { mutableListOf() }.add(guideProvider) } + addProvider(guideProvider, listOf(language, *languages)) } fun addProvider(guideProvider: AbstractSourceGuideProvider, languages: List) { - languages.forEach { providers.computeIfAbsent(it) { mutableListOf() }.add(guideProvider) } + languages.forEach { providers.computeIfAbsent(it) { CopyOnWriteArrayList() }.add(guideProvider) } } private fun getProvider(language: String): AbstractSourceGuideProvider? {