### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java,v retrieving revision 1.32 diff -u -r1.32 UtilTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java 11 Apr 2006 06:20:57 -0000 1.32 +++ src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java 18 Apr 2006 14:45:41 -0000 @@ -44,7 +44,8 @@ if (!match) line.append(" NOT"); line.append(" match pattern '"); line.append(pattern); - line.append("'"); + line.append("', but it DOES"); + if (!camelCase) line.append(" NOT"); if (this.camelCaseErrors.length() == 0) { System.out.println("Invalid results in test "+getName()+":"); } @@ -513,7 +514,6 @@ /** * Bug 130390: CamelCase algorithm cleanup and improvement * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130390" - * */ public void test66() { String[][] MATCHES = { @@ -562,6 +562,52 @@ // Verify that there were no unexpected results assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); } + +/** + * Bug 137087: Open Type - missing matches when using mixed case pattern + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087" + */ +public void test67() { + assertCamelCase("runtimeEx", "RuntimeException", false/* should not match */); + assertCamelCase("Runtimeex", "RuntimeException", false/* should not match */); + assertCamelCase("runtimeexception", "RuntimeException", false/* should not match */); + assertCamelCase("Runtimexception", "RuntimeException", false/* should not match */); + assertCamelCase("illegalMSException", "IllegalMonitorStateException", false/* should not match */); + assertCamelCase("illegalMsException", "IllegalMonitorStateException", false /* should not match */); + assertCamelCase("IllegalMSException", "IllegalMonitorStateException", true/* should match */); + assertCamelCase("IllegalMsException", "IllegalMonitorStateException", false /* should not match */); + assertCamelCase("clonenotsupportedex", "CloneNotSupportedException", false/* should not match */); + assertCamelCase("CloneNotSupportedEx", "CloneNotSupportedException", true/* should match */); + assertCamelCase("cloneNotsupportedEx", "CloneNotSupportedException", false/* should not match */); + assertCamelCase("ClonenotSupportedexc", "CloneNotSupportedException", false/* should not match */); + assertCamelCase("cloneNotSupportedExcep", "CloneNotSupportedException", false/* should not match */); + assertCamelCase("Clonenotsupportedexception", "CloneNotSupportedException", false/* should not match */); + assertCamelCase("CloneNotSupportedException", "CloneNotSupportedException", true /* should match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +// lower CamelCase +public void test68() { + assertCamelCase("aMe", "aMethod", true/* should match */); + assertCamelCase("ame", "aMethod", false/* should not match */); + assertCamelCase("longNOM", "longNameOfMethod", true/* should match */); + assertCamelCase("longNOMeth", "longNameOfMethod", true/* should match */); + assertCamelCase("longNOMethod", "longNameOfMethod", true/* should match */); + assertCamelCase("longNoMethod", "longNameOfMethod", false/* should not match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +// search tests +public void test69() { + assertCamelCase("aa", "AxxAyy", false /* should not match */); + assertCamelCase("Aa", "AxxAyy", false /* should not match */); + assertCamelCase("aA", "AxxAyy", false /* should not match */); + assertCamelCase("AA", "AxxAyy", true /* should match */); + assertCamelCase("aa", "AbcdAbcdefAbcAbcdefghAbAAzzzzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnAbcAbcdefghijklm", false /* should not match */); + assertCamelCase("AA", "AbcdAbcdefAbcAbcdefghAbAAzzzzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnAbcAbcdefghijklm", true /* should match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} public static Class testClass() { return UtilTest.class; } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/SearchTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SearchTests.java,v retrieving revision 1.34 diff -u -r1.34 SearchTests.java --- src/org/eclipse/jdt/core/tests/model/SearchTests.java 12 Apr 2006 15:36:43 -0000 1.34 +++ src/org/eclipse/jdt/core/tests/model/SearchTests.java 18 Apr 2006 14:45:48 -0000 @@ -1022,4 +1022,8 @@ SearchPattern.R_CAMELCASE_MATCH|SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PREFIX_MATCH); } +public void testSearchPatternValidMatchRule05() { + assertValidMatchRule("hashMap", SearchPattern.R_CAMELCASE_MATCH); + assertValidMatchRule("Hashmap", SearchPattern.R_CAMELCASE_MATCH); +} } Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v retrieving revision 1.74 diff -u -r1.74 JavaSearchBugsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 12 Apr 2006 15:56:11 -0000 1.74 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 18 Apr 2006 14:45:46 -0000 @@ -4574,7 +4574,10 @@ assertEquals("Invalid number of working copies kept between tests!", 5, workingCopies.length); search("AxXA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); this.discard = false; - assertSearchResults(""); + assertSearchResults( + "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + ); } public void testBug110060_AllTypeNames01() throws CoreException { @@ -4755,7 +4758,8 @@ this.discard = false; assertSearchResults( "Unexpected all type names", - "", + "b110060.AA\n" + + "b110060.AAxx", requestor); } @@ -5994,7 +5998,6 @@ ); } - /** * To get these tests search matches in a workspace, do NOT forget to modify files * to set them as working copies. @@ -6036,6 +6039,7 @@ search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); this.discard = false; assertSearchResults( + "src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH\n" + "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" ); } @@ -6094,4 +6098,254 @@ "src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH" ); } +/** + * To get these tests search matches in a workspace, do NOT forget to modify files + * to set them as working copies. + * + * @test Bug 137087: Open Type - missing matches when using mixed case pattern + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087" + */ +public void testBug137087() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "runtimeEx"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH" + ); +} +public void testBug137087b() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "Runtimeex"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH" + ); +} +public void testBug137087c() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "runtimeexception"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + "" // no match expected as this is not a valid camel case + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH" + ); +} +public void testBug137087d() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "Runtimexception"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + "" // no match expected as pattern is missing a 'e' + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + "" // no match expected as pattern is missing a 'e' + ); +} +public void testBug137087e() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "IllegalMSException"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH" + ); +} +public void testBug137087f() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "illegalMsExceptionSException"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + "" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + "" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types + ); +} +public void testBug137087g() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "clonenotsupportedex"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + "" // no match expected as this is not a valid camel case + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} +public void testBug137087h() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "CloneNotSupportedEx"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} +public void testBug137087i() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "cloneNotsupportedEx"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} +public void testBug137087j() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "ClonenotSupportedexc"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} +public void testBug137087k() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "cloneNotSupportedExcep"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} +public void testBug137087l() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "Clonenotsupportedexception"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} +public void testBug137087m() throws CoreException { + // Search CamelCase + int matchRule = SearchPattern.R_CAMELCASE_MATCH; + String pattern = "CloneNotSupportedException"; + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); + // Search like UI does (ie. replace it with prefix if it's not a valid CamelCase) + int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule); + if (validatedRule != matchRule) { + matchRule = SearchPattern.R_PREFIX_MATCH; + } + search(pattern, TYPE, DECLARATIONS, matchRule); + assertSearchResults( + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" + + ""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH" + ); +} } Index: src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java,v retrieving revision 1.151 diff -u -r1.151 JavaSearchTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java 12 Apr 2006 08:51:37 -0000 1.151 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java 18 Apr 2006 14:45:47 -0000 @@ -3574,6 +3574,7 @@ public void testCamelCaseTypePattern01() throws CoreException { search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); assertSearchResults( + "src/a3/References.java a3.References [References]\n" + ""+ getExternalJCLPathString() + " java.lang.RuntimeException" ); } @@ -3594,7 +3595,9 @@ public void testCamelCaseTypePattern04() throws CoreException { search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); - assertSearchResults(""); + assertSearchResults( + ""+ getExternalJCLPathString() + " java.lang.RuntimeException" + ); } public void testCamelCaseTypePattern05() throws CoreException { @@ -3659,7 +3662,10 @@ ); assertSearchResults( "Unexpected all type names", - "", + "AA\n" + + "d8.AA\n" + + "p6.AA\n" + + "q1.AA", requestor); } #P org.eclipse.jdt.core Index: search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java,v retrieving revision 1.33 diff -u -r1.33 BasicSearchEngine.java --- search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 12 Apr 2006 15:36:28 -0000 1.33 +++ search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 18 Apr 2006 14:45:51 -0000 @@ -471,8 +471,10 @@ } switch(matchMode) { case SearchPattern.R_EXACT_MATCH : - if (isCamelCase) return false; - return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive); + if (!isCamelCase) { + return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive); + } + // fall through next case to match as prefix if camel case failed case SearchPattern.R_PREFIX_MATCH : return matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, isCaseSensitive); case SearchPattern.R_PATTERN_MATCH : Index: search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java,v retrieving revision 1.57 diff -u -r1.57 PatternLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 11 Apr 2006 06:21:28 -0000 1.57 +++ search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 18 Apr 2006 14:45:52 -0000 @@ -276,10 +276,13 @@ } switch (this.matchMode) { case SearchPattern.R_EXACT_MATCH: - if (!this.isCamelCase && sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) { - return POSSIBLE_FULL_MATCH; + if (!this.isCamelCase) { + if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) { + return POSSIBLE_FULL_MATCH; + } + break; } - break; + // fall through next case to match as prefix if camel case failed case SearchPattern.R_PREFIX_MATCH: if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) { return POSSIBLE_PREFIX_MATCH; @@ -692,7 +695,8 @@ } } if (this.matchMode == SearchPattern.R_EXACT_MATCH) { - return IMPOSSIBLE_MATCH; + boolean matchPattern = CharOperation.prefixEquals(qualifiedPattern, sourceName, this.isCaseSensitive); + return matchPattern ? ACCURATE_MATCH : IMPOSSIBLE_MATCH; } } boolean matchPattern = CharOperation.match(qualifiedPattern, sourceName, this.isCaseSensitive); Index: search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java,v retrieving revision 1.33 diff -u -r1.33 PackageReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 11 Apr 2006 17:06:43 -0000 1.33 +++ search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 18 Apr 2006 14:45:51 -0000 @@ -104,7 +104,6 @@ } switch (this.matchMode) { case SearchPattern.R_EXACT_MATCH: - if (this.isCamelCase) break; case SearchPattern.R_PREFIX_MATCH: if (packageName==null) packageName = CharOperation.concatWith(tokens, '.'); if (CharOperation.prefixEquals(this.pattern.pkgName, packageName, this.isCaseSensitive)) { Index: search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java,v retrieving revision 1.49 diff -u -r1.49 TypeReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 29 Mar 2006 03:14:00 -0000 1.49 +++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 18 Apr 2006 14:45:52 -0000 @@ -117,7 +117,6 @@ } switch (this.matchMode) { case SearchPattern.R_EXACT_MATCH: - if (this.isCamelCase) break; case SearchPattern.R_PREFIX_MATCH: if (CharOperation.prefixEquals(qualifiedPattern, qualifiedTypeName, this.isCaseSensitive)) { return POSSIBLE_PREFIX_MATCH; Index: search/org/eclipse/jdt/core/search/SearchPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java,v retrieving revision 1.58 diff -u -r1.58 SearchPattern.java --- search/org/eclipse/jdt/core/search/SearchPattern.java 12 Apr 2006 15:36:27 -0000 1.58 +++ search/org/eclipse/jdt/core/search/SearchPattern.java 18 Apr 2006 14:45:51 -0000 @@ -1786,11 +1786,13 @@ switch (matchMode) { case R_EXACT_MATCH : case R_FULL_MATCH : - if (!isCamelCase && sameLength && matchFirstChar) { - return CharOperation.equals(pattern, name, isCaseSensitive); + if (!isCamelCase) { + if (sameLength && matchFirstChar) { + return CharOperation.equals(pattern, name, isCaseSensitive); + } + break; } - break; - + // fall through next case to match as prefix if camel case failed case R_PREFIX_MATCH : if (canBePrefix && matchFirstChar) { return CharOperation.prefixEquals(pattern, name, isCaseSensitive); Index: search/org/eclipse/jdt/internal/core/index/Index.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java,v retrieving revision 1.21 diff -u -r1.21 Index.java --- search/org/eclipse/jdt/internal/core/index/Index.java 29 Mar 2006 03:13:59 -0000 1.21 +++ search/org/eclipse/jdt/internal/core/index/Index.java 18 Apr 2006 14:45:51 -0000 @@ -47,12 +47,14 @@ public static boolean isMatch(char[] pattern, char[] word, int matchRule) { if (pattern == null) return true; - if (pattern.length == 0) return matchRule != SearchPattern.R_EXACT_MATCH; - if (word.length == 0) return (matchRule & SearchPattern.R_PATTERN_MATCH) != 0 && pattern.length == 1 && pattern[0] == '*'; + int patternLength = pattern.length; + int wordLength = word.length; + if (patternLength == 0) return matchRule != SearchPattern.R_EXACT_MATCH; + if (wordLength == 0) return (matchRule & SearchPattern.R_PATTERN_MATCH) != 0 && patternLength == 1 && pattern[0] == '*'; // First test camel case if necessary boolean isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0; - if (isCamelCase && pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word)) { + if (isCamelCase && pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word)) { return true; } @@ -60,17 +62,21 @@ matchRule &= ~SearchPattern.R_CAMELCASE_MATCH; switch(matchRule & MATCH_RULE_INDEX_MASK) { case SearchPattern.R_EXACT_MATCH : - if (isCamelCase) return false; - return CharOperation.equals(pattern, word, false); + if (!isCamelCase) { + return patternLength == wordLength && CharOperation.equals(pattern, word, false); + } + // fall through prefix match if camel case failed case SearchPattern.R_PREFIX_MATCH : - return CharOperation.prefixEquals(pattern, word, false); + return patternLength <= wordLength && CharOperation.prefixEquals(pattern, word, false); case SearchPattern.R_PATTERN_MATCH : return CharOperation.match(pattern, word, false); case SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE : - if (isCamelCase) return false; - return pattern[0] == word[0] && CharOperation.equals(pattern, word); + if (!isCamelCase) { + return pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word); + } + // fall through prefix match if camel case failed case SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE : - return pattern[0] == word[0] && CharOperation.prefixEquals(pattern, word); + return pattern[0] == word[0] && patternLength <= wordLength && CharOperation.prefixEquals(pattern, word); case SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE : return CharOperation.match(pattern, word, true); }