From 124c3ffe0c4fee712ca67708594b56161cee40b8 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Mon, 29 Jul 2019 20:38:08 +0300 Subject: [PATCH] don't check string content when comparing states (IDEA-219169) states are used as keys only in state loop prevention, it should be enough to check whether they use same string or not GitOrigin-RevId: 86c19587537e12c77ff5eac55bedce0ba344ec83 --- .../language/syntax/lexer/TextMateLexerState.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 419e91269112..f93169d0c195 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 @@ -52,11 +52,16 @@ class TextMateLexerState implements LexerState { return syntaxRule.equals(state.syntaxRule) && matchData.equals(state.matchData) && priorityMatch == state.priorityMatch && - Objects.equals(string, state.string); + stringId() == state.stringId(); } @Override public int hashCode() { - return Objects.hash(syntaxRule, matchData, priorityMatch, string); + return Objects.hash(syntaxRule, matchData, priorityMatch, stringId()); + } + + @Nullable + private Object stringId() { + return string != null ? string.id : null; } }