From 80f9ad7923caae4223385f9c1003555447bc59bd Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Mon, 25 Nov 2019 15:34:34 +0300 Subject: [PATCH] precompute hashcode (IDEA-225101) GitOrigin-RevId: 74d93b49bbfebab7eb375481d12062bad545ed9e --- .../textmate/language/syntax/lexer/TextMateLexerState.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/textmate/src/org/jetbrains/plugins/textmate/language/syntax/lexer/TextMateLexerState.java b/plugins/textmate/src/org/jetbrains/plugins/textmate/language/syntax/lexer/TextMateLexerState.java index f93169d0c195..da6f7e3ead90 100644 --- a/plugins/textmate/src/org/jetbrains/plugins/textmate/language/syntax/lexer/TextMateLexerState.java +++ b/plugins/textmate/src/org/jetbrains/plugins/textmate/language/syntax/lexer/TextMateLexerState.java @@ -11,6 +11,7 @@ import org.jetbrains.plugins.textmate.regex.StringWithId; import java.util.Objects; class TextMateLexerState implements LexerState { + private final int hashcode; @NotNull public final SyntaxNodeDescriptor syntaxRule; @NotNull public final MatchData matchData; @NotNull public final TextMateWeigh.Priority priorityMatch; @@ -24,6 +25,7 @@ class TextMateLexerState implements LexerState { this.matchData = matchData; this.priorityMatch = priority; string = matchData.matched() ? line : null; + hashcode = Objects.hash(syntaxRule, matchData, priorityMatch, stringId()); } public static TextMateLexerState notMatched(@NotNull SyntaxNodeDescriptor syntaxRule) { @@ -57,7 +59,7 @@ class TextMateLexerState implements LexerState { @Override public int hashCode() { - return Objects.hash(syntaxRule, matchData, priorityMatch, stringId()); + return hashcode; } @Nullable