From 8e326b4df65b8fa495a845437f81019598535de0 Mon Sep 17 00:00:00 2001 From: sebthom Date: Tue, 9 Apr 2024 20:14:38 +0200 Subject: [PATCH] fix: ConcurrentModificationException in BasicScopeAttributesProvider Addresses https://github.com/eclipse/tm4e/issues/743 --- .../core/internal/grammar/BasicScopeAttributesProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/BasicScopeAttributesProvider.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/BasicScopeAttributesProvider.java index 5304fb686..0e17aee9b 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/BasicScopeAttributesProvider.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/BasicScopeAttributesProvider.java @@ -20,6 +20,8 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.regex.Pattern; import org.eclipse.jdt.annotation.Nullable; @@ -37,7 +39,7 @@ final class BasicScopeAttributesProvider { private final BasicScopeAttributes _defaultAttributes; private final ScopeMatcher _embeddedLanguagesMatcher; - private final Map cache = new HashMap<>(); + private final ConcurrentMap cache = new ConcurrentHashMap<>(); BasicScopeAttributesProvider(final int initialLanguage, @Nullable final Map embeddedLanguages) { this._defaultAttributes = new BasicScopeAttributes(initialLanguage, OptionalStandardTokenType.NotSet);