From 98fbecdc6c0de4ae806398c6e941b151af1b054c Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 9 Aug 2024 16:42:35 +0200 Subject: [PATCH] Small simplification for Java SSR GitOrigin-RevId: d21660329312bed45f24253d71ddc0bedd4a8e24 --- .../impl/matcher/JavaCompiledPattern.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java index 02a8a570ceac..1e4746bd47a7 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaCompiledPattern.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.structuralsearch.impl.matcher; import com.intellij.psi.PsiAnnotation; @@ -26,12 +26,7 @@ public class JavaCompiledPattern extends CompiledPattern { @Override public boolean isTypedVar(@NotNull final String str) { - if (str.isEmpty()) return false; - if (str.charAt(0)=='@') { - return str.regionMatches(1,TYPED_VAR_PREFIX,0,TYPED_VAR_PREFIX.length()); - } else { - return str.startsWith(TYPED_VAR_PREFIX); - } + return str.startsWith(TYPED_VAR_PREFIX, (!str.isEmpty() && str.charAt(0) == '@') ? 1 : 0); } @Override