From 1767a3ecbf6db1a649aa04b2ca933579edbfdee9 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 22 Jan 2018 15:01:41 +0300 Subject: [PATCH] synchronize properly myIgnoredActions and lower the lock scope --- .../impl/config/IntentionManagerSettings.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionManagerSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionManagerSettings.java index 7bd2ac7c9e92..fbc1bbbbd0ff 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionManagerSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionManagerSettings.java @@ -51,19 +51,20 @@ public class IntentionManagerSettings implements PersistentStateComponent myIgnoredActions = new LinkedHashSet<>(); + private final Set myIgnoredActions = Collections.synchronizedSet(new LinkedHashSet<>()); - private final Map myMetaData = new LinkedHashMap<>(); + private final Map myMetaData = new LinkedHashMap<>(); // guarded by this @NonNls private static final String IGNORE_ACTION_TAG = "ignoreAction"; @NonNls private static final String NAME_ATT = "name"; private static final Pattern HTML_PATTERN = Pattern.compile("<[^<>]*>"); - public static IntentionManagerSettings getInstance() { return ServiceManager.getService(IntentionManagerSettings.class); } - public void registerIntentionMetaData(@NotNull IntentionAction intentionAction, @NotNull String[] category, @NotNull String descriptionDirectoryName) { + void registerIntentionMetaData(@NotNull IntentionAction intentionAction, + @NotNull String[] category, + @NotNull String descriptionDirectoryName) { registerMetaData(new IntentionActionMetaData(intentionAction, getClassLoader(intentionAction), category, descriptionDirectoryName)); } @@ -73,19 +74,19 @@ public class IntentionManagerSettings implements PersistentStateComponent(myMetaData.values()); } - public synchronized boolean isEnabled(@NotNull IntentionActionMetaData metaData) { + public boolean isEnabled(@NotNull IntentionActionMetaData metaData) { return !myIgnoredActions.contains(getFamilyName(metaData)); } @@ -121,7 +122,7 @@ public class IntentionManagerSettings implements PersistentStateComponent entry : myMetaData.entrySet()) { if (entry.getValue().getAction() == intentionAction) { myMetaData.remove(entry.getKey());