mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR inspection: avoid map.get with nontrivial equals/hashCode for each PSI element
This commit is contained in:
+3
-2
@@ -115,8 +115,9 @@ public class SSBasedInspection extends LocalInspectionTool {
|
||||
synchronized (LOCK) {
|
||||
if (LexicalNodesFilter.getInstance().accepts(element)) return;
|
||||
final SsrFilteringNodeIterator matchedNodes = new SsrFilteringNodeIterator(element);
|
||||
for (Configuration configuration : myConfigurations) {
|
||||
final MatchContext context = compiledOptions.get(configuration);
|
||||
for (Map.Entry<Configuration, MatchContext> entry : compiledOptions.entrySet()) {
|
||||
Configuration configuration = entry.getKey();
|
||||
MatchContext context = entry.getValue();
|
||||
|
||||
if (MatcherImpl.checkIfShouldAttemptToMatch(context, matchedNodes)) {
|
||||
final int nodeCount = context.getPattern().getNodeCount();
|
||||
|
||||
+4
-1
@@ -11,6 +11,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
@@ -28,7 +30,8 @@ public class SSBasedInspectionCompiledPatternsCache {
|
||||
matcher.precompileOptions(configurations, cache);
|
||||
project.putUserData(COMPILED_OPTIONS_KEY, cache);
|
||||
}
|
||||
return cache;
|
||||
|
||||
return configurations.stream().collect(Collectors.toMap(Function.identity(), cache::get));
|
||||
}
|
||||
|
||||
private static boolean areConfigurationsInCache(@NotNull List<Configuration> configurations,
|
||||
|
||||
Reference in New Issue
Block a user