From a524c37c2c5a2ab8978098257f79fa979eda252c Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 20 Jul 2015 15:59:31 +0200 Subject: [PATCH] IDEA-142783 "*LRUMap" goto class pattern can not find SLRUMap but should --- .../com/intellij/psi/util/NameUtilMatchingTest.groovy | 4 ++++ .../src/com/intellij/psi/codeStyle/MinusculeMatcher.java | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy b/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy index 57aff69321a6..d17957dc8b3e 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/psi/util/NameUtilMatchingTest.groovy @@ -334,6 +334,10 @@ public class NameUtilMatchingTest extends UsefulTestCase { assertFalse(firstLetterMatcher("*I").matches("id")); } + public void "test asterisk ending inside uppercase word"() { + assertMatches("*LRUMap", "SLRUMap"); + } + public void testMiddleMatchingFirstLetterSensitive() { assertTrue(firstLetterMatcher(" cl").matches("getClass")); assertFalse(firstLetterMatcher(" EUC-").matches("x-EUC-TW")); diff --git a/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java index 6a1a46effe68..f7579332bca5 100644 --- a/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java +++ b/platform/util/src/com/intellij/psi/codeStyle/MinusculeMatcher.java @@ -365,7 +365,7 @@ public class MinusculeMatcher implements Matcher { return null; } - // middle matches have to be at least of length 3, to prevent too many irrelevant matches + // exact middle matches have to be at least of length 3, to prevent too many irrelevant matches int minFragment = isPatternChar(patternIndex - 1, '*') && !isWildcard(patternIndex + 1) && Character.isLetterOrDigit(name.charAt(nameIndex)) && !isWordStart(name, nameIndex) ? 3 : 1; @@ -375,11 +375,11 @@ public class MinusculeMatcher implements Matcher { patternIndex + i < myPattern.length && charEquals(myPattern[patternIndex+i], patternIndex+i, name.charAt(nameIndex + i), ignoreCase)) { if (isUpperCase[patternIndex + i] && myHasHumps) { - if (i < minFragment) { - return null; - } // when an uppercase pattern letter matches lowercase name letter, try to find an uppercase (better) match further in the name if (myPattern[patternIndex + i] != name.charAt(nameIndex + i)) { + if (i < minFragment) { + return null; + } int nextWordStart = indexOfWordStart(name, patternIndex + i, nameIndex + i); FList ranges = matchWildcards(name, patternIndex + i, nextWordStart, matchingState); if (ranges != null) {