### 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.33 diff -u -r1.33 UtilTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java 18 Apr 2006 16:27:43 -0000 1.33 +++ src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java 23 Aug 2007 09:26:29 -0000 @@ -13,6 +13,7 @@ import java.io.File; //import org.apache.tools.ant.types.selectors.SelectorUtils; +import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.compiler.CharOperation; //import junit.framework.AssertionFailedError; @@ -36,7 +37,14 @@ * If result is invalid then store warning in buffer and display it. */ void assertCamelCase(String pattern, String name, boolean match) { - boolean camelCase = CharOperation.camelCaseMatch(pattern==null?null:pattern.toCharArray(), name==null?null:name.toCharArray()); + assertCamelCase(pattern, name, true /*prefix match*/, match); +} +/** + * Assert that a pattern and a name matches or not. + * If result is invalid then store warning in buffer and display it. + */ +void assertCamelCase(String pattern, String name, boolean prefixMatch, boolean match) { + boolean camelCase = CharOperation.camelCaseMatch(pattern==null?null:pattern.toCharArray(), name==null?null:name.toCharArray(), prefixMatch); if (match != camelCase) { StringBuffer line = new StringBuffer("'"); line.append(name); @@ -608,6 +616,128 @@ // Verify that there were no unexpected results assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); } + +// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=109695 +public void test70() throws CoreException { + assertCamelCase("IDE3", "IDocumentExtension", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IDE3", "IDocumentExtension2", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IDE3", "IDocumentExtension3", false /*no prefix match*/, true /* should match */); + assertCamelCase("IDE3", "IDocumentExtension135", false /*no prefix match*/, true /* should match */); + assertCamelCase("IDE3", "IDocumentExtension315", false /*no prefix match*/, true /* should match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension2", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension4", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension3", false /*no prefix match*/, true /* should match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension5", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension54321", false /*no prefix match*/, true /* should match */); + assertCamelCase("IDPE3", "IDocumentProviderExtension12345", false /*no prefix match*/, true /* should match */); + assertCamelCase("IPL3", "IPerspectiveListener", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IPL3", "IPerspectiveListener2", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IPL3", "IPerspectiveListener3", false /*no prefix match*/, true /* should match */); + assertCamelCase("IPS2", "IPropertySource", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IPS2", "IPropertySource2", false /*no prefix match*/, true /* should match */); + assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate", false /*no prefix match*/, false /* should not match */); + assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate2", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTF16DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTF16DSS", "UTF1DocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTF16DSS", "UTF6DocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTF16DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTF1DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTF1DSS", "UTF1DocScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTF1DSS", "UTF6DocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTF1DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTF6DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTF6DSS", "UTF1DocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTF6DSS", "UTF6DocScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTF6DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */); + assertCamelCase("UTFDSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTFDSS", "UTF1DocScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTFDSS", "UTF6DocScannerSupport", false /*no prefix match*/, true /* should match */); + assertCamelCase("UTFDSS", "UTFDocScannerSupport", false /*no prefix match*/, true /* should match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624 +public void test71() { + assertCamelCase("HM", "HashMap", false /*no prefix match*/, true /*should match*/); + assertCamelCase("HM", "HtmlMapper", false /*no prefix match*/, true /*should match*/); + assertCamelCase("HM", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaM", "HashMap", false /*no prefix match*/, true /* should match */); + assertCamelCase("HaM", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaM", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashM", "HashMap", false /*no prefix match*/, true /* should match */); + assertCamelCase("HashM", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashM", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +public void test71b() { // previous test cases but with 3.3 behavior + assertCamelCase("HM", "HashMap", true /*should match*/); + assertCamelCase("HM", "HtmlMapper", true /*should match*/); + assertCamelCase("HM", "HashMapEntry", true /*should match*/); + assertCamelCase("HaM", "HashMap", true /* should match */); + assertCamelCase("HaM", "HtmlMapper", false /*should not match*/); + assertCamelCase("HaM", "HashMapEntry", true /*should match*/); + assertCamelCase("HashM", "HashMap", true /* should match */); + assertCamelCase("HashM", "HtmlMapper", false /*should not match*/); + assertCamelCase("HashM", "HashMapEntry", true /*should match*/); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624 +public void test72() { + assertCamelCase("HMa", "HashMap", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaMa", "HashMap", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashMa", "HashMap", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +public void test72b() { // previous test cases but with 3.3 behavior + assertCamelCase("HMa", "HashMap", true /*should match*/); + assertCamelCase("HMa", "HtmlMapper", true /*should match*/); + assertCamelCase("HMa", "HashMapEntry", true /*should match*/); + assertCamelCase("HaMa", "HashMap", true /* should match */); + assertCamelCase("HaMa", "HtmlMapper", false /*should not match*/); + assertCamelCase("HaMa", "HashMapEntry", true /*should match*/); + assertCamelCase("HashMa", "HashMap", true /* should match */); + assertCamelCase("HashMa", "HtmlMapper", false /*should not match*/); + assertCamelCase("HashMa", "HashMapEntry", true /*should match*/); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624 +public void test73() { + assertCamelCase("HMap", "HashMap", false /*no prefix match*/, true /*should match*/); + assertCamelCase("HMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaMap", "HashMap", false /*no prefix match*/, true /* should match */); + assertCamelCase("HaMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HaMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashMap", "HashMap", false /*no prefix match*/, true /* should match */); + assertCamelCase("HashMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */); + assertCamelCase("HashMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */); + // Verify that there were no unexpected results + assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); +} +public void test73b() { // previous test cases but with 3.3 behavior + assertCamelCase("HMap", "HashMap", true /*should match*/); + assertCamelCase("HMap", "HtmlMapper", true /*should match*/); + assertCamelCase("HMap", "HashMapEntry", true /*should match*/); + assertCamelCase("HaMap", "HashMap", true /* should match */); + assertCamelCase("HaMap", "HtmlMapper", false /*should not match*/); + assertCamelCase("HaMap", "HashMapEntry", true /*should match*/); + assertCamelCase("HashMap", "HashMap", true /* should match */); + assertCamelCase("HashMap", "HtmlMapper", false /*should not match*/); + assertCamelCase("HashMap", "HashMapEntry", 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/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.165 diff -u -r1.165 JavaSearchTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java 19 Jul 2007 15:08:25 -0000 1.165 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java 23 Aug 2007 09:26:38 -0000 @@ -3715,44 +3715,53 @@ * * These tests are not really duplicates of {@link JavaSearchBugsTests} ones * as they also test camel case in indexes... + * @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern01() throws CoreException { - search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); + search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( "src/a3/References.java a3.References [References]\n" + ""+ getExternalJCLPathString() + " java.lang.RuntimeException" ); } - +public void testCamelCaseTypePattern01b() throws CoreException { + search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + ""+ getExternalJCLPathString() + " java.lang.RuntimeException" + ); +} +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern02() throws CoreException { - search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); + search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( ""+ getExternalJCLPathString() + " java.lang.RuntimeException" ); } - +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern03() throws CoreException { - search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); + search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( ""+ getExternalJCLPathString() + " java.lang.RuntimeException" ); } - +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern04() throws CoreException { - search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); + search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( ""+ getExternalJCLPathString() + " java.lang.RuntimeException" ); } - +/** + * @deprecated As using a depreciated constant + */ public void testCamelCaseTypePattern05() throws CoreException { - search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope()); + search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( "src/a3/References.java a3.References [References]\n" + ""+ getExternalJCLPathString() + " java.lang.RuntimeException" ); } - +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern06() throws CoreException { TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); new SearchEngine().searchAllTypeNames( @@ -3771,7 +3780,7 @@ "java.lang.CloneNotSupportedException", requestor); } - +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern07() throws CoreException { TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); new SearchEngine().searchAllTypeNames( @@ -3794,7 +3803,7 @@ "q1.AA", requestor); } - +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern08() throws CoreException { TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); new SearchEngine().searchAllTypeNames( @@ -3816,7 +3825,7 @@ "q1.AA", requestor); } - +/** @deprecated As using a depreciated constant */ public void testCamelCaseTypePattern09() throws CoreException { TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); new SearchEngine().searchAllTypeNames( @@ -3838,6 +3847,148 @@ "q1.AA", requestor); } +/** @deprecated As using a depreciated constant */ +public void testCamelCaseTypePattern10() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java Null [Null]\n" + + "src/Test.java NULL [NULL]\n" + + "src/Test.java NullPointerException [NullPointerException]\n" + + "src/Test.java NULLPointerException [NULLPointerException]\n" + + "src/Test.java NULLPOINTERException [NULLPOINTERException]\n" + + "src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]" + ); +} +/** @deprecated As using a depreciated constant */ +public void testCamelCaseTypePattern11() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH); + assertSearchResults( + "src/Test.java Null [Null]\n" + + "src/Test.java NULL [NULL]\n" + + "src/Test.java NullPointerException [NullPointerException]\n" + + "src/Test.java NULLPointerException [NULLPointerException]\n" + + "src/Test.java NULLPOINTERException [NULLPOINTERException]\n" + + "src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]" + ); +} +/** @deprecated As using a depreciated constant */ +public void testCamelCaseTypePattern12() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "src/Test.java Null [Null]" + ); +} +/** @deprecated As using a depreciated constant */ +public void testCamelCaseTypePattern13() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "src/Test.java Null [Null]\n" + + "src/Test.java NullPointerException [NullPointerException]" + ); +} +public void testCamelCaseTypePattern14() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java Null [Null]\n" + + "src/Test.java NULL [NULL]" + ); +} +public void testCamelCaseTypePattern15() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); + assertSearchResults( + "src/Test.java Null [Null]\n" + + "src/Test.java NULL [NULL]\n" + + "src/Test.java NullPointerException [NullPointerException]\n" + + "src/Test.java NULLPointerException [NULLPointerException]\n" + + "src/Test.java NULLPOINTERException [NULLPOINTERException]\n" + + "src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]" + ); +} +public void testCamelCaseTypePattern16() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "src/Test.java Null [Null]" + ); +} +public void testCamelCaseTypePattern17() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java", + "class Null {}\n" + + "class NULL {}\n" + + "class NullPointerException {}\n" + + "class NULLPointerException {}\n" + + "class NULLPOINTERException {}\n" + + "class NULLPOINTEREXCEPTION {}\n" + ); + search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "src/Test.java Null [Null]\n" + + "src/Test.java NullPointerException [NullPointerException]" + ); +} /** * @bug 160323: [search] TypeNameMatch: support hashCode/equals 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.41 diff -u -r1.41 SearchTests.java --- src/org/eclipse/jdt/core/tests/model/SearchTests.java 15 Aug 2007 11:14:56 -0000 1.41 +++ src/org/eclipse/jdt/core/tests/model/SearchTests.java 23 Aug 2007 09:26:39 -0000 @@ -185,6 +185,7 @@ } protected void assertValidMatchRule(String pattern, int rule, int expected) { int validated = SearchPattern.validateMatchRule(pattern, rule); + String givenRule = BasicSearchEngine.getMatchRuleString(rule); String validatedRule = BasicSearchEngine.getMatchRuleString(validated); String expectedRule = BasicSearchEngine.getMatchRuleString(expected); if (!validatedRule.equals(expectedRule)) { @@ -192,6 +193,8 @@ System.out.print(" assertValidMatchRule(\""); System.out.print(pattern); System.out.print("\", "); + System.out.print(givenRule); + System.out.print("\", "); System.out.print(validatedRule); System.out.println(");"); assertEquals(pattern+"' does not match expected match rule!", expectedRule, validatedRule); @@ -993,43 +996,171 @@ "TypeReferencePattern: qualification, type, exact match, case sensitive, erasure only", searchPattern); } + /** - * Test CamelCase validation + * Test pattern validation */ public void testSearchPatternValidMatchRule01() { - assertValidMatchRule("foo", SearchPattern.R_EXACT_MATCH, SearchPattern.R_EXACT_MATCH); - assertValidMatchRule("foo", SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PREFIX_MATCH); - assertValidMatchRule("foo", SearchPattern.R_PATTERN_MATCH, SearchPattern.R_EXACT_MATCH); - assertValidMatchRule("foo", SearchPattern.R_PATTERN_MATCH|SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PREFIX_MATCH); - assertValidMatchRule("foo", SearchPattern.R_CAMELCASE_MATCH, SearchPattern.R_PREFIX_MATCH|SearchPattern.R_CASE_SENSITIVE); + assertValidMatchRule("foo", + SearchPattern.R_EXACT_MATCH, + SearchPattern.R_EXACT_MATCH); } public void testSearchPatternValidMatchRule02() { - assertValidMatchRule("CP*P", SearchPattern.R_EXACT_MATCH, SearchPattern.R_PATTERN_MATCH); - assertValidMatchRule("CP*P", SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PATTERN_MATCH); - assertValidMatchRule("CP*P", SearchPattern.R_PATTERN_MATCH, SearchPattern.R_PATTERN_MATCH); - assertValidMatchRule("CP*P", SearchPattern.R_PATTERN_MATCH|SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PATTERN_MATCH); - assertValidMatchRule("CP*P", SearchPattern.R_CAMELCASE_MATCH, SearchPattern.R_PATTERN_MATCH); + assertValidMatchRule("foo", + SearchPattern.R_PREFIX_MATCH, + SearchPattern.R_PREFIX_MATCH); } public void testSearchPatternValidMatchRule03() { - assertValidMatchRule("NPE", SearchPattern.R_CAMELCASE_MATCH); - assertValidMatchRule("NPE", - SearchPattern.R_CAMELCASE_MATCH|SearchPattern.R_PREFIX_MATCH|SearchPattern.R_CASE_SENSITIVE, - SearchPattern.R_CAMELCASE_MATCH); - assertValidMatchRule("nPE", SearchPattern.R_CAMELCASE_MATCH); - assertValidMatchRule("NuPoEx", SearchPattern.R_CAMELCASE_MATCH); - assertValidMatchRule("oF", SearchPattern.R_CAMELCASE_MATCH); + assertValidMatchRule("foo", + SearchPattern.R_PATTERN_MATCH, + SearchPattern.R_EXACT_MATCH); } public void testSearchPatternValidMatchRule04() { + assertValidMatchRule("foo", + SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH, + SearchPattern.R_PREFIX_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule05() { + assertValidMatchRule("foo", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule06() { + assertValidMatchRule("foo", + SearchPattern.R_CAMEL_CASE_MATCH, + SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule10() { + assertValidMatchRule("CP*P", + SearchPattern.R_EXACT_MATCH, + SearchPattern.R_PATTERN_MATCH); +} +public void testSearchPatternValidMatchRule11() { + assertValidMatchRule("CP*P", + SearchPattern.R_PREFIX_MATCH, + SearchPattern.R_PATTERN_MATCH); +} +public void testSearchPatternValidMatchRule12() { + assertValidMatchRule("CP*P", + SearchPattern.R_PATTERN_MATCH, + SearchPattern.R_PATTERN_MATCH); +} +public void testSearchPatternValidMatchRule13() { + assertValidMatchRule("CP*P", + SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH, + SearchPattern.R_PATTERN_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule14() { + assertValidMatchRule("CP*P", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_PATTERN_MATCH); +} +public void testSearchPatternValidMatchRule15() { + assertValidMatchRule("CP*P", + SearchPattern.R_CAMEL_CASE_MATCH, + SearchPattern.R_PATTERN_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule20() { + assertValidMatchRule("NPE", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule21() { + assertValidMatchRule("NPE", + SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule22() { + assertValidMatchRule("nPE", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule23() { + assertValidMatchRule("NuPoEx", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule24() { + assertValidMatchRule("oF", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule30() { + assertValidMatchRule("NPE", + SearchPattern.R_CAMEL_CASE_MATCH); +} +public void testSearchPatternValidMatchRule31() { + assertValidMatchRule("NPE", + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule32() { + assertValidMatchRule("NPE", + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); +} +public void testSearchPatternValidMatchRule33() { + assertValidMatchRule("NPE", + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE); +} +public void testSearchPatternValidMatchRule34() { + assertValidMatchRule("nPE", + SearchPattern.R_CAMEL_CASE_MATCH); +} +public void testSearchPatternValidMatchRule35() { + assertValidMatchRule("NuPoEx", + SearchPattern.R_CAMEL_CASE_MATCH); +} +public void testSearchPatternValidMatchRule36() { + assertValidMatchRule("oF", + SearchPattern.R_CAMEL_CASE_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule40() { assertValidMatchRule("Nu/Po/Ex", SearchPattern.R_CAMELCASE_MATCH, - SearchPattern.R_PREFIX_MATCH|SearchPattern.R_CASE_SENSITIVE); + SearchPattern.R_PREFIX_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule41() { assertValidMatchRule("Nu.Po.Ex", - SearchPattern.R_CAMELCASE_MATCH|SearchPattern.R_PREFIX_MATCH, + 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); +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule42() { + assertValidMatchRule("hashMap", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +/** @deprecated As using a depreciated constant */ +public void testSearchPatternValidMatchRule43() { + assertValidMatchRule("Hashmap", + SearchPattern.R_CAMELCASE_MATCH, + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule44() { + assertValidMatchRule("Nu/Po/Ex", + SearchPattern.R_CAMEL_CASE_MATCH, + SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule45() { + assertValidMatchRule("Nu.Po.Ex", + SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, + SearchPattern.R_PREFIX_MATCH); +} +public void testSearchPatternValidMatchRule46() { + assertValidMatchRule("hashMap", + SearchPattern.R_CAMEL_CASE_MATCH); +} +public void testSearchPatternValidMatchRule47() { + assertValidMatchRule("Hashmap", + SearchPattern.R_CAMEL_CASE_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.118 diff -u -r1.118 JavaSearchBugsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 17 Aug 2007 06:14:44 -0000 1.118 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 23 Aug 2007 09:26:37 -0000 @@ -103,18 +103,6 @@ } return getWorkingCopy(path, source, this.wcOwner); } -protected void search(IJavaElement element, int limitTo) throws CoreException { - search(element, limitTo, EXACT_RULE, getJavaSearchScope(), resultCollector); -} -protected void search(IJavaElement element, int limitTo, int matchRule) throws CoreException { - search(element, limitTo, matchRule, getJavaSearchScope(), resultCollector); -} -protected void search(String patternString, int searchFor, int limitTo) throws CoreException { - search(patternString, searchFor, limitTo, EXACT_RULE, getJavaSearchScope(), resultCollector); -} -protected void search(String patternString, int searchFor, int limitTo, int matchRule) throws CoreException { - search(patternString, searchFor, limitTo, matchRule, getJavaSearchScope(), resultCollector); -} /* (non-Javadoc) * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#setUpSuite() */ @@ -4731,7 +4719,7 @@ "interface IDocumentExtension315 {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("IDE3", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("IDE3", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("IDE3", validatedRule, requestor); assertSearchResults( "IDocumentExtension135\n" + @@ -4752,7 +4740,7 @@ "interface IDocumentProviderExtension54321 {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("IDPE3", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("IDPE3", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("IDPE3", validatedRule, requestor); assertSearchResults( "IDocumentProviderExtension12345\n" + @@ -4769,7 +4757,7 @@ "interface IPerspectiveListener3 {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("IPL3", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("IPL3", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("IPL3", validatedRule, requestor); assertSearchResults( "IPerspectiveListener3", @@ -4783,7 +4771,7 @@ "interface IPropertySource2 {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("IPS2", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("IPS2", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("IPS2", validatedRule, requestor); assertSearchResults( "IPropertySource2", @@ -4800,7 +4788,7 @@ "interface IWorkbenchWindowPulldownDelegate4 {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("IWWPD2", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("IWWPD2", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("IWWPD2", validatedRule, requestor); assertSearchResults( "IWorkbenchWindowPulldownDelegate2", @@ -4816,7 +4804,7 @@ "class UTFDocScannerSupport {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("UTF16DSS", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("UTF16DSS", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("UTF16DSS", validatedRule, requestor); assertSearchResults( "UTF16DocumentScannerSupport", @@ -4832,7 +4820,7 @@ "class UTFDocScannerSupport {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("UTF1DSS", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("UTF1DSS", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("UTF1DSS", validatedRule, requestor); assertSearchResults( "UTF16DocumentScannerSupport\n" + @@ -4849,7 +4837,7 @@ "class UTFDocScannerSupport {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("UTF6DSS", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("UTF6DSS", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("UTF6DSS", validatedRule, requestor); assertSearchResults( "UTF16DocumentScannerSupport\n" + @@ -4866,7 +4854,7 @@ "class UTFDocScannerSupport {}\n" ); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - int validatedRule = SearchPattern.validateMatchRule("UTFDSS", SearchPattern.R_CAMELCASE_MATCH); + int validatedRule = SearchPattern.validateMatchRule("UTFDSS", SearchPattern.R_CAMEL_CASE_MATCH); searchAllTypeNames("UTFDSS", validatedRule, requestor); assertSearchResults( "UTF16DocumentScannerSupport\n" + @@ -4886,455 +4874,406 @@ */ // Types search private void setUpBug110060_TypePattern() throws CoreException { - workingCopies = new ICompilationUnit[5]; - workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java", - "package b110060;\n" + - "public class AA {\n" + - "}\n" - ); - workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b110060/AAxx.java", - "package b110060;\n" + - "public class AAxx {\n" + - "}\n" - ); - workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/b110060/AxxAyy.java", - "package b110060;\n" + - "public class AxxAyy {\n" + - "}\n" - ); - workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/b110060/AxA.java", - "package b110060;\n" + - "public class AxA {\n" + - "}\n" - ); - workingCopies[4] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java", + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java", "package b110060;\n" + "public class Test {\n" + - " AA aa;\n" + - " AAxx aaxx;\n" + - " AxA axa;\n" + - " AxxAyy axxayy;\n" + - "}\n" + " Aaa a1;\n" + + " AAa a2;\n" + + " AaAaAa a3;\n" + + " AAxx a4;\n" + + " AxA a5;\n" + + " AxxAyy a6;\n" + + "}\n" + + "class AAa {}\n" + + "class Aaa {}\n" + + "class AaAaAa {}\n" + + "class AAxx {}\n" + + "class AxA {}\n" + + "class AxxAyy {}\n" ); } +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern01() throws CoreException { setUpBug110060_TypePattern(); search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } - +public void testBug110060_TypePattern01new() throws CoreException { + setUpBug110060_TypePattern(); + search("AA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern02() throws CoreException { setUpBug110060_TypePattern(); search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + - "src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + - "src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" + - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AAa [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Aaa [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AaAaAa [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AAxx [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AxA [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH" ); } - +public void testBug110060_TypePattern02new() throws CoreException { + setUpBug110060_TypePattern(); + search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AAa [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AAxx [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AxA [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern03() throws CoreException { setUpBug110060_TypePattern(); - search("AAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH" ); } - +public void testBug110060_TypePattern03new() throws CoreException { + setUpBug110060_TypePattern(); + search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as camel case does not allow prefix match + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern04() throws CoreException { setUpBug110060_TypePattern(); - search("Axx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } - +public void testBug110060_TypePattern04new() throws CoreException { + setUpBug110060_TypePattern(); + search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as camel case does not allow prefix match + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern05() throws CoreException { setUpBug110060_TypePattern(); - search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("Ax", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" + - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } - +public void testBug110060_TypePattern05new() throws CoreException { + setUpBug110060_TypePattern(); + search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as camel case does not allow prefix match + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern06() throws CoreException { setUpBug110060_TypePattern(); - search("A*A*", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + - "src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + - "src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" + - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH\n" + - ""+ getExternalJCLPathString("1.5") + " java.lang.annotation.Annotation EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } - +public void testBug110060_TypePattern06new() throws CoreException { + setUpBug110060_TypePattern(); + search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern07() throws CoreException { setUpBug110060_TypePattern(); - search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); - assertSearchResults(""); + search("aa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH" + ); +} +public void testBug110060_TypePattern07new() throws CoreException { + setUpBug110060_TypePattern(); + search("aa", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + // Not a valid camel case pattern => changed to prefix + assertSearchResults( + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH" + ); } - public void testBug110060_TypePattern08() throws CoreException { setUpBug110060_TypePattern(); - search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH); + search("aa", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH); assertSearchResults( - "src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + - "src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH" ); } - public void testBug110060_TypePattern09() throws CoreException { setUpBug110060_TypePattern(); - search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + search("AA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); assertSearchResults( - "src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" + - "src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" + - "src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" + - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } - +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern10() throws CoreException { setUpBug110060_TypePattern(); - search("AxAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults(""); } - +public void testBug110060_TypePattern10new() throws CoreException { + setUpBug110060_TypePattern(); + search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern11() throws CoreException { setUpBug110060_TypePattern(); - search("AxxA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } - +public void testBug110060_TypePattern11new() throws CoreException { + setUpBug110060_TypePattern(); + search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_TypePattern12() throws CoreException { setUpBug110060_TypePattern(); - search("AxXA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults( - "src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH" + "src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH" ); } +public void testBug110060_TypePattern12new() throws CoreException { + setUpBug110060_TypePattern(); + search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +// Search all type names requests +/** @deprecated As using a depreciated constant */ public void testBug110060_AllTypeNames01() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_MATCH, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx\n" + - "b110060.AxA\n" + + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.Aaa\n" + + "b110060.AxA\n" + + "b110060.AxxAyy", + requestor); +} +public void testBug110060_AllTypeNames01new() throws CoreException { + setUpBug110060_TypePattern(); + TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); + searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH, requestor); + assertSearchResults( + "Unexpected all type names", + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AxA\n" + "b110060.AxxAyy", requestor); } - public void testBug110060_AllTypeNames02() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx\n" + - "b110060.AxA\n" + + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.Aaa\n" + + "b110060.AxA\n" + "b110060.AxxAyy", requestor); } - public void testBug110060_AllTypeNames03() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AAA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx\n" + - "b110060.AxA\n" + - "b110060.AxxAyy", + "b110060.AaAaAa", requestor); } - public void testBug110060_AllTypeNames04() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx\n" + - "b110060.AxA\n" + + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.AxA\n" + "b110060.AxxAyy", requestor); } - public void testBug110060_AllTypeNames05() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_PREFIX_MATCH, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx", + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.Aaa", requestor); } - public void testBug110060_AllTypeNames06() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AAA", SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA", + "", requestor); } - public void testBug110060_AllTypeNames07() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "AA".toCharArray(), - SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + + "b110060.AAa\n" + "b110060.AAxx", requestor); } - +/** @deprecated As using a depreciated constant */ public void testBug110060_AllTypeNames08() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_MATCH, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx", + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.Aaa", + requestor); +} +public void testBug110060_AllTypeNames08new() throws CoreException { + setUpBug110060_TypePattern(); + TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); + searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH, requestor); + assertSearchResults( + "Unexpected all type names", + "", // no match as pattern is not a valid camel case requestor); } - public void testBug110060_AllTypeNames09() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx", + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.Aaa", requestor); } - public void testBug110060_AllTypeNames10() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", - "", + "", // no match as pattern is not a valid camel case requestor); } - public void testBug110060_AllTypeNames11() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", "", requestor); } - public void testBug110060_AllTypeNames12() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_PREFIX_MATCH, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_PREFIX_MATCH, requestor); assertSearchResults( "Unexpected all type names", - "b110060.AA\n" + - "b110060.AAxx", + "b110060.AAa\n" + + "b110060.AAxx\n" + + "b110060.AaAaAa\n" + + "b110060.Aaa", requestor); } - public void testBug110060_AllTypeNames13() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", "", requestor); } - public void testBug110060_AllTypeNames14() throws CoreException { setUpBug110060_TypePattern(); TypeNameRequestor requestor = new SearchTests.SearchTypeNameRequestor(); - new SearchEngine(this.workingCopies).searchAllTypeNames( - null, - SearchPattern.R_EXACT_MATCH, - "aa".toCharArray(), - SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, - TYPE, - getJavaSearchScope(), - requestor, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, - null - ); + searchAllTypeNames("aa", SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor); assertSearchResults( "Unexpected all type names", "", @@ -5380,7 +5319,7 @@ } public void testBug110060_ConstructorPattern01() throws CoreException { setUpBug110060_ConstructorPattern(); - search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH); assertSearchResults( "src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" + "src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" + @@ -5388,10 +5327,9 @@ "src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH" ); } - public void testBug110060_ConstructorPattern02() throws CoreException { setUpBug110060_ConstructorPattern(); - search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); assertSearchResults( "src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" + "src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + @@ -5403,39 +5341,30 @@ "src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH" ); } - public void testBug110060_ConstructorPattern03() throws CoreException { setUpBug110060_ConstructorPattern(); - search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); assertSearchResults( - "src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH" + "" // no match as prefix is not set ); } - public void testBug110060_ConstructorPattern04() throws CoreException { setUpBug110060_ConstructorPattern(); - search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); assertSearchResults( - "src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH" + "" // no match as prefix is not set ); } - public void testBug110060_ConstructorPattern05() throws CoreException { setUpBug110060_ConstructorPattern(); - search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); assertSearchResults( - "src/b110060/AxA.java b110060.AxA() [AxA] EXACT_MATCH\n" + - "src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axa [new AxA()] EXACT_MATCH\n" + - "src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH" + "" // no match as prefix is not set ); } - public void testBug110060_ConstructorPattern06() throws CoreException { setUpBug110060_ConstructorPattern(); - search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); + search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); assertSearchResults( "src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" + "src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + @@ -5469,18 +5398,29 @@ "}\n" ); } +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern01() throws CoreException { setUpBug110060_MethodPattern(); search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults(""); } - -public void testBug110060_MethodPattern02() throws CoreException { +public void testBug110060_MethodPattern01new() throws CoreException { + setUpBug110060_MethodPattern(); + search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ +public void testBug110060_MethodPattern02() throws CoreException { setUpBug110060_MethodPattern(); search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults(""); } - +public void testBug110060_MethodPattern02new() throws CoreException { + setUpBug110060_MethodPattern(); + search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern03() throws CoreException { setUpBug110060_MethodPattern(); search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5491,7 +5431,15 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH" ); } - +public void testBug110060_MethodPattern03new() throws CoreException { + setUpBug110060_MethodPattern(); + search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern04() throws CoreException { setUpBug110060_MethodPattern(); search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5506,7 +5454,14 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH" ); } - +public void testBug110060_MethodPattern04new() throws CoreException { + setUpBug110060_MethodPattern(); + search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as prefix match is not set + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern05() throws CoreException { setUpBug110060_MethodPattern(); search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5521,7 +5476,14 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH" ); } - +public void testBug110060_MethodPattern05new() throws CoreException { + setUpBug110060_MethodPattern(); + search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as prefix match is not set + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern06() throws CoreException { setUpBug110060_MethodPattern(); search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5534,7 +5496,14 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH" ); } - +public void testBug110060_MethodPattern06new() throws CoreException { + setUpBug110060_MethodPattern(); + search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as prefix match is not set + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern07() throws CoreException { setUpBug110060_MethodPattern(); search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5549,7 +5518,21 @@ "src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH" ); } - +public void testBug110060_MethodPattern07new() throws CoreException { + setUpBug110060_MethodPattern(); + search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.otherMethodWhichStartsWithAnotherLetter() [otherMethodWhichStartsWithAnotherLetter] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern08() throws CoreException { setUpBug110060_MethodPattern(); search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5560,7 +5543,15 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH" ); } - +public void testBug110060_MethodPattern08new() throws CoreException { + setUpBug110060_MethodPattern(); + search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_MethodPattern09() throws CoreException { setUpBug110060_MethodPattern(); search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5569,6 +5560,14 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH" ); } +public void testBug110060_MethodPattern09new() throws CoreException { + setUpBug110060_MethodPattern(); + search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java void b110060.Test.aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH" + ); +} // Fields search private void setUpBug110060_FieldPattern() throws CoreException { @@ -5591,6 +5590,7 @@ "}\n" ); } +/** @deprecated As using a depreciated constant */ public void testBug110060_FieldPattern01() throws CoreException { setUpBug110060_FieldPattern(); search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5601,13 +5601,26 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH" ); } - +public void testBug110060_FieldPattern01new() throws CoreException { + setUpBug110060_FieldPattern(); + search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_FieldPattern02() throws CoreException { setUpBug110060_FieldPattern(); search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); assertSearchResults(""); } - +public void testBug110060_FieldPattern02new() throws CoreException { + setUpBug110060_FieldPattern(); + search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_FieldPattern03() throws CoreException { setUpBug110060_FieldPattern(); search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5616,7 +5629,14 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH" ); } - +public void testBug110060_FieldPattern03new() throws CoreException { + setUpBug110060_FieldPattern(); + search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as prefix match is not set + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_FieldPattern04() throws CoreException { setUpBug110060_FieldPattern(); search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5625,7 +5645,15 @@ "src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH" ); } - +public void testBug110060_FieldPattern04new() throws CoreException { + setUpBug110060_FieldPattern(); + search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH\n" + + "src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug110060_FieldPattern05() throws CoreException { setUpBug110060_FieldPattern(); search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -5635,6 +5663,13 @@ "src/b110060/Test.java b110060.Test.oF [otherFieldWhichStartsWithAnotherLetter] EXACT_MATCH" ); } +public void testBug110060_FieldPattern05new() throws CoreException { + setUpBug110060_FieldPattern(); + search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b110060/Test.java b110060.Test.oF [oF] EXACT_MATCH" + ); +} /** * @test Bug 110291: [search] BasicSearchEngine return constructor declarations that doesn't exist in source @@ -6418,6 +6453,269 @@ } /** + * @bug 124624: [search] Camel case matching routines should support end character + * @test Ensure that camel case pattern may use end character + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624" + */ +public void testBug124624_HM_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HM_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +public void testBug124624_HaM_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HaM_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +public void testBug124624_HashM_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HashM_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH" + ); +} +public void testBug124624_HMa_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HMa_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +public void testBug124624_HaMa_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HaMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HaMa_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH" + ); +} +public void testBug124624_HashMa_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults(""); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HashMa_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH" + ); +} +public void testBug124624_HMap_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HMap_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +public void testBug124624_HaMap_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HaMap_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + + "src/Test.java HatMappage [HatMappage] EXACT_MATCH" + ); +} +public void testBug124624_HashMap_new() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ +public void testBug124624_HashMap_old() throws CoreException { + workingCopies = new ICompilationUnit[1]; + workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "class HashMap {}\n" + + "class HtmlMapper {}\n" + + "class HashMapEntry {}\n" + + "class HatMappage {}\n" + ); + search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); + assertSearchResults( + "src/Test.java HashMap [HashMap] EXACT_MATCH\n" + + "src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH" + ); +} + +/** * @test Bug 124645: [search] for implementors does not find subclasses of binary classes * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124645" */ @@ -6610,6 +6908,7 @@ "}\n" ); } +/** @deprecated As using a depreciated constant */ public void testBug130390() throws CoreException { setUpBug130390(); search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); @@ -6617,6 +6916,14 @@ "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" ); } +public void testBug130390_new() throws CoreException { + setUpBug130390(); + search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "" // no result as prefix match is not set + ); +} +/** @deprecated As using a depreciated constant */ public void testBug130390b() throws CoreException { setUpBug130390(); search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH); @@ -6625,6 +6932,15 @@ "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" ); } +public void testBug130390b_new() throws CoreException { + setUpBug130390(); + search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH\n" + + "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug130390c() throws CoreException { setUpBug130390(); search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE); @@ -6632,6 +6948,14 @@ "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" ); } +public void testBug130390c_new() throws CoreException { + setUpBug130390(); + search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug130390d() throws CoreException { setUpBug130390(); search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -6639,6 +6963,14 @@ "src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH" ); } +public void testBug130390d_new() throws CoreException { + setUpBug130390(); + search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug130390e() throws CoreException { setUpBug130390(); search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE); @@ -6646,6 +6978,14 @@ "src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH" ); } +public void testBug130390e_new() throws CoreException { + setUpBug130390(); + search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug130390f() throws CoreException { setUpBug130390(); search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH); @@ -6653,6 +6993,14 @@ "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" ); } +public void testBug130390f_new() throws CoreException { + setUpBug130390(); + search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH); + assertSearchResults( + "src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH" + ); +} +/** @deprecated As using a depreciated constant */ public void testBug130390g() throws CoreException { setUpBug130390(); search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE); @@ -6661,263 +7009,147 @@ "src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH" ); } -public void testBug130390h() throws CoreException { +public void testBug130390g_new() throws CoreException { setUpBug130390(); - search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); assertSearchResults( + "src/b130390/TZ.java b130390.TZ [TZ] EXACT_MATCH\n" + "src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH" ); } +public void testBug130390h() throws CoreException { + setUpBug130390(); + search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE); + assertSearchResults( + "" // no result as prefix match is not set + ); +} + /** * 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 + * @bug 137087: Open Type - missing matches when using mixed case pattern * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087" + * @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" ); } +/** @deprecated As using a depreciated constant */ 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' - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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 - ); } +/** @deprecated As using a depreciated constant */ 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" ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } +/** @deprecated As using a depreciated constant */ 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" - ); } + /** * Bug 137984: [search] Field references not found when type is a qualified member type [regression] * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137984" Index: src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java,v retrieving revision 1.43 diff -u -r1.43 JavaSearchMultipleProjectsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 10 Aug 2007 08:14:19 -0000 1.43 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 23 Aug 2007 09:26:37 -0000 @@ -923,6 +923,7 @@ * @bug 199392: [search] Type Dialog Error 'Items filtering ... Reason: Class file name must end with .class' * @test Ensure that types are found even in project which name ends either with ".jar" or ".zip" * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199392" + * @deprecated As using a depreciated constant */ public void testBug199392_Jar() throws CoreException { try { @@ -952,8 +953,6 @@ collector, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); - // Should have same types with these 2 searches - assertEquals("Invalid number of types found!", 1, collector.size()); assertEquals("Found types sounds not to be correct", "test.MyClass", collector.toString() @@ -962,6 +961,43 @@ deleteProject("Test.jar"); } } +public void testBug199392_Jar_new() throws CoreException { + try { + IJavaProject project = createJavaProject("Test.jar"); + createFolder("/Test.jar/test"); + createFile( + "/Test.jar/test/MyClass.java", + "package test;\n" + + "public class MyClass {\n" + + "}\n" + ); + + // Search all type names with TypeNameMatchRequestor + AbstractJavaSearchTests.TypeNameMatchCollector collector = new AbstractJavaSearchTests.TypeNameMatchCollector() { + public String toString(){ + return toFullyQualifiedNamesString(); + } + }; + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }); + new SearchEngine().searchAllTypeNames( + null, + SearchPattern.R_EXACT_MATCH, + new char[] { 'M', 'y' }, + SearchPattern.R_CAMEL_CASE_MATCH, + IJavaSearchConstants.TYPE, + scope, + collector, + IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, + null); + assertEquals("Found types sounds not to be correct", + "", // no result as prefix match is not set + collector.toString() + ); + } finally { + deleteProject("Test.jar"); + } +} +/** @deprecated As using a depreciated constant */ public void testBug199392_Zip() throws CoreException { try { IJavaProject project = createJavaProject("Test.zip"); @@ -990,8 +1026,6 @@ collector, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); - // Should have same types with these 2 searches - assertEquals("Invalid number of types found!", 1, collector.size()); assertEquals("Found types sounds not to be correct", "test.MyClass", collector.toString() @@ -1000,4 +1034,40 @@ deleteProject("Test.zip"); } } +public void testBug199392_Zip_new() throws CoreException { + try { + IJavaProject project = createJavaProject("Test.zip"); + createFolder("/Test.zip/test"); + createFile( + "/Test.zip/test/MyClass.java", + "package test;\n" + + "public class MyClass {\n" + + "}\n" + ); + + // Search all type names with TypeNameMatchRequestor + AbstractJavaSearchTests.TypeNameMatchCollector collector = new AbstractJavaSearchTests.TypeNameMatchCollector() { + public String toString(){ + return toFullyQualifiedNamesString(); + } + }; + IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }); + new SearchEngine().searchAllTypeNames( + null, + SearchPattern.R_EXACT_MATCH, + new char[] { 'M', 'y' }, + SearchPattern.R_CAMEL_CASE_MATCH, + IJavaSearchConstants.TYPE, + scope, + collector, + IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, + null); + assertEquals("Found types sounds not to be correct", + "", // no result as prefix match is not set + collector.toString() + ); + } finally { + deleteProject("Test.zip"); + } +} } Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java,v retrieving revision 1.26 diff -u -r1.26 AbstractJavaSearchTests.java --- src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 16 Aug 2007 13:13:21 -0000 1.26 +++ src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 23 Aug 2007 09:26:35 -0000 @@ -503,6 +503,7 @@ } } System.out.println("--------------------------------------------------------------------------------"); + length *= 2; for (int i=0; i0 && declaringQualification != null && CharOperation.equals(CharOperation.concat(parameterQualifications[0], parameterSimpleNames[0], '.'), declaringQualification); @@ -87,8 +87,8 @@ this.parameterQualifications = new char[this.parameterCount][]; this.parameterSimpleNames = new char[this.parameterCount][]; for (int i = 0; i < this.parameterCount; i++) { - this.parameterQualifications[i] = isCaseSensitive() ? parameterQualifications[i+offset] : CharOperation.toLowerCase(parameterQualifications[i+offset]); - this.parameterSimpleNames[i] = isCaseSensitive() ? parameterSimpleNames[i+offset] : CharOperation.toLowerCase(parameterSimpleNames[i+offset]); + this.parameterQualifications[i] = this.isCaseSensitive ? parameterQualifications[i+offset] : CharOperation.toLowerCase(parameterQualifications[i+offset]); + this.parameterSimpleNames[i] = this.isCaseSensitive ? parameterSimpleNames[i+offset] : CharOperation.toLowerCase(parameterSimpleNames[i+offset]); } } else { this.parameterCount = -1; Index: search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java,v retrieving revision 1.10 diff -u -r1.10 MultiTypeDeclarationPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java 16 Oct 2006 15:58:38 -0000 1.10 +++ search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java 23 Aug 2007 09:26:44 -0000 @@ -48,7 +48,7 @@ } // null simple names are allowed (should return all names) if (simpleNames != null) { - if ((isCaseSensitive() || isCamelCase()) ) { + if (this.isCaseSensitive || this.isCamelCase) { this.simpleNames = simpleNames; } else { int length = simpleNames.length; Index: search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java,v retrieving revision 1.11 diff -u -r1.11 VariablePattern.java --- search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java 10 May 2006 18:03:42 -0000 1.11 +++ search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java 23 Aug 2007 09:26:45 -0000 @@ -24,12 +24,12 @@ public VariablePattern(int patternKind, boolean findDeclarations, boolean readAccess, boolean writeAccess, char[] name, int matchRule) { super(patternKind, matchRule); - this.findDeclarations = findDeclarations; // set to find declarations & all occurences - this.readAccess = readAccess; // set to find any reference, read only references & all occurences - this.writeAccess = writeAccess; // set to find any reference, write only references & all occurences + this.findDeclarations = findDeclarations; // set to find declarations & all occurrences + this.readAccess = readAccess; // set to find any reference, read only references & all occurrences + this.writeAccess = writeAccess; // set to find any reference, write only references & all occurrences this.findReferences = readAccess || writeAccess; - this.name = (isCaseSensitive() || isCamelCase()) ? name : CharOperation.toLowerCase(name); + this.name = (this.isCaseSensitive || this.isCamelCase) ? name : CharOperation.toLowerCase(name); } /* * Returns whether a method declaration or message send will need to be resolved to Index: search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java,v retrieving revision 1.59 diff -u -r1.59 MethodPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java 7 Sep 2006 12:59:26 -0000 1.59 +++ search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java 23 Aug 2007 09:26:44 -0000 @@ -83,18 +83,18 @@ this.findDeclarations = findDeclarations; this.findReferences = findReferences; - this.selector = (isCaseSensitive() || isCamelCase()) ? selector : CharOperation.toLowerCase(selector); - this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification); - this.declaringSimpleName = isCaseSensitive() ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName); - this.returnQualification = isCaseSensitive() ? returnQualification : CharOperation.toLowerCase(returnQualification); - this.returnSimpleName = isCaseSensitive() ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName); + this.selector = (this.isCaseSensitive || this.isCamelCase) ? selector : CharOperation.toLowerCase(selector); + this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification); + this.declaringSimpleName = this.isCaseSensitive ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName); + this.returnQualification = this.isCaseSensitive ? returnQualification : CharOperation.toLowerCase(returnQualification); + this.returnSimpleName = this.isCaseSensitive ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName); if (parameterSimpleNames != null) { this.parameterCount = parameterSimpleNames.length; this.parameterQualifications = new char[this.parameterCount][]; this.parameterSimpleNames = new char[this.parameterCount][]; for (int i = 0; i < this.parameterCount; i++) { - this.parameterQualifications[i] = isCaseSensitive() ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]); - this.parameterSimpleNames[i] = isCaseSensitive() ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]); + this.parameterQualifications[i] = this.isCaseSensitive ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]); + this.parameterSimpleNames[i] = this.isCaseSensitive ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]); } } else { this.parameterCount = -1; 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.56 diff -u -r1.56 TypeReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 27 Apr 2007 15:51:38 -0000 1.56 +++ search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java 23 Aug 2007 09:26:45 -0000 @@ -112,8 +112,11 @@ return IMPOSSIBLE_MATCH; } boolean matchFirstChar = !this.isCaseSensitive || (qualifiedPattern[0] == qualifiedTypeName[0]); - if (this.isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName)) { - return POSSIBLE_MATCH; + if (this.isCamelCase) { + if (matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) { + return POSSIBLE_MATCH; + } + if (this.isCaseSensitive) return IMPOSSIBLE_MATCH; } switch (this.matchMode) { case SearchPattern.R_EXACT_MATCH: Index: search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java,v retrieving revision 1.59 diff -u -r1.59 SuperTypeReferencePattern.java --- search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java 7 Sep 2006 12:59:26 -0000 1.59 +++ search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java 23 Aug 2007 09:26:45 -0000 @@ -150,8 +150,8 @@ this(matchRule); - this.superQualification = isCaseSensitive() ? superQualification : CharOperation.toLowerCase(superQualification); - this.superSimpleName = (isCaseSensitive() || isCamelCase()) ? superSimpleName : CharOperation.toLowerCase(superSimpleName); + this.superQualification = this.isCaseSensitive ? superQualification : CharOperation.toLowerCase(superQualification); + this.superSimpleName = (this.isCaseSensitive || this.isCamelCase) ? superSimpleName : CharOperation.toLowerCase(superSimpleName); ((InternalSearchPattern)this).mustResolve = superQualification != null; this.superRefKind = superRefKind; } Index: search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java,v retrieving revision 1.23 diff -u -r1.23 JavaSearchPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 7 Sep 2006 12:59:26 -0000 1.23 +++ search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java 23 Aug 2007 09:26:44 -0000 @@ -42,7 +42,7 @@ *
  • {@link #R_PREFIX_MATCH}
  • *
  • {@link #R_PATTERN_MATCH}
  • *
  • {@link #R_REGEXP_MATCH}
  • - *
  • {@link #R_CAMELCASE_MATCH}
  • + *
  • {@link #R_CAMEL_CASE_MATCH}
  • * */ int matchMode; @@ -75,7 +75,7 @@ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=81377 int rule = getMatchRule(); this.isCaseSensitive = (rule & R_CASE_SENSITIVE) != 0; - this.isCamelCase = (rule & R_CAMELCASE_MATCH) != 0; + this.isCamelCase = (rule & R_CAMEL_CASE_MATCH) != 0; this.matchCompatibility = rule & MATCH_COMPATIBILITY_MASK; this.matchMode = rule & MATCH_MODE_MASK; } @@ -84,23 +84,23 @@ return null; } - int getMatchMode() { + final int getMatchMode() { return this.matchMode; } - boolean isCamelCase() { + final boolean isCamelCase() { return this.isCamelCase; } - boolean isCaseSensitive () { + final boolean isCaseSensitive () { return this.isCaseSensitive; } - boolean isErasureMatch() { + final boolean isErasureMatch() { return (this.matchCompatibility & R_ERASURE_MATCH) != 0; } - boolean isEquivalentMatch() { + final boolean isEquivalentMatch() { return (this.matchCompatibility & R_EQUIVALENT_MATCH) != 0; } 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.38 diff -u -r1.38 PackageReferenceLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 27 Apr 2007 15:51:38 -0000 1.38 +++ search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java 23 Aug 2007 09:26:44 -0000 @@ -98,9 +98,10 @@ char[] packageName = null; if (this.isCamelCase) { packageName = CharOperation.concatWith(tokens, '.'); - if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName)) { + if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) { return POSSIBLE_MATCH; } + if (this.isCaseSensitive) return IMPOSSIBLE_MATCH; } switch (this.matchMode) { case SearchPattern.R_EXACT_MATCH: Index: search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java,v retrieving revision 1.61 diff -u -r1.61 TypeDeclarationPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java 7 Sep 2006 12:59:26 -0000 1.61 +++ search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java 23 Aug 2007 09:26:45 -0000 @@ -140,8 +140,8 @@ this(matchRule); - this.pkg = isCaseSensitive() ? pkg : CharOperation.toLowerCase(pkg); - if (isCaseSensitive() || enclosingTypeNames == null) { + this.pkg = this.isCaseSensitive ? pkg : CharOperation.toLowerCase(pkg); + if (this.isCaseSensitive || enclosingTypeNames == null) { this.enclosingTypeNames = enclosingTypeNames; } else { int length = enclosingTypeNames.length; @@ -149,7 +149,7 @@ for (int i = 0; i < length; i++) this.enclosingTypeNames[i] = CharOperation.toLowerCase(enclosingTypeNames[i]); } - this.simpleName = (isCaseSensitive() || isCamelCase()) ? simpleName : CharOperation.toLowerCase(simpleName); + this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName); this.typeSuffix = typeSuffix; ((InternalSearchPattern)this).mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX; 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.66 diff -u -r1.66 PatternLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 4 Jul 2007 13:59:58 -0000 1.66 +++ search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java 23 Aug 2007 09:26:45 -0000 @@ -118,7 +118,7 @@ public PatternLocator(SearchPattern pattern) { int matchRule = pattern.getMatchRule(); this.isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0; - this.isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0; + this.isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0; this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0; this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0; this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK; @@ -282,24 +282,25 @@ boolean matchFirstChar = !this.isCaseSensitive || pattern[0] == name[0]; boolean sameLength = pattern.length == name.length; boolean canBePrefix = name.length >= pattern.length; - if (this.isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(pattern, name)) { - return POSSIBLE_MATCH; + if (this.isCamelCase) { + if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) { + return POSSIBLE_MATCH; + } + if (this.isCaseSensitive) return IMPOSSIBLE_MATCH; } switch (this.matchMode) { case SearchPattern.R_EXACT_MATCH: - if (!this.isCamelCase) { - if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) { - return POSSIBLE_MATCH | EXACT_FLAVOR; - } - break; + if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) { + return POSSIBLE_MATCH | EXACT_FLAVOR; } - // fall through next case to match as prefix if camel case failed + break; case SearchPattern.R_PREFIX_MATCH: if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) { return POSSIBLE_MATCH; } break; case SearchPattern.R_PATTERN_MATCH: + // TODO_PERFS (frederic) Not sure this lowercase is necessary if (!this.isCaseSensitive) { pattern = CharOperation.toLowerCase(pattern); } @@ -717,13 +718,13 @@ } } if (this.isCamelCase) { - if (!this.isCaseSensitive || (qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) { - if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName)) { + if ((qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) { + if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) { return ACCURATE_MATCH; } } - if (this.matchMode == SearchPattern.R_EXACT_MATCH) { - boolean matchPattern = CharOperation.prefixEquals(qualifiedPattern, sourceName, this.isCaseSensitive); + if (!this.isCaseSensitive && this.matchMode == SearchPattern.R_EXACT_MATCH) { + boolean matchPattern = CharOperation.equals(qualifiedPattern, sourceName, false); return matchPattern ? ACCURATE_MATCH : IMPOSSIBLE_MATCH; } } Index: search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java,v retrieving revision 1.29 diff -u -r1.29 AndPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java 4 Jul 2007 13:59:58 -0000 1.29 +++ search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java 23 Aug 2007 09:26:44 -0000 @@ -31,7 +31,7 @@ return (combined & (R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH)) | (combined & R_CASE_SENSITIVE) | compatibility - | (combined & R_CAMELCASE_MATCH); + | (combined & R_CAMEL_CASE_MATCH); } public AndPattern(SearchPattern leftPattern, SearchPattern rightPattern) { Index: search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java,v retrieving revision 1.28 diff -u -r1.28 FieldPattern.java --- search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java 6 Mar 2007 02:38:49 -0000 1.28 +++ search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java 23 Aug 2007 09:26:44 -0000 @@ -46,15 +46,15 @@ super(FIELD_PATTERN, findDeclarations, readAccess, writeAccess, name, matchRule); - this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification); - this.declaringSimpleName = isCaseSensitive() ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName); - this.typeQualification = isCaseSensitive() ? typeQualification : CharOperation.toLowerCase(typeQualification); - this.typeSimpleName = (isCaseSensitive() || isCamelCase()) ? typeSimpleName : CharOperation.toLowerCase(typeSimpleName); + this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification); + this.declaringSimpleName = this.isCaseSensitive ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName); + this.typeQualification = this.isCaseSensitive ? typeQualification : CharOperation.toLowerCase(typeQualification); + this.typeSimpleName = (this.isCaseSensitive || this.isCamelCase) ? typeSimpleName : CharOperation.toLowerCase(typeSimpleName); ((InternalSearchPattern)this).mustResolve = mustResolve(); } /* - * Instanciate a field pattern with additional information for generics search + * Instantiate a field pattern with additional information for generic search */ public FieldPattern( boolean findDeclarations, Index: buildnotes_jdt-core.html =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v retrieving revision 1.6035 diff -u -r1.6035 buildnotes_jdt-core.html --- buildnotes_jdt-core.html 21 Aug 2007 18:55:48 -0000 1.6035 +++ buildnotes_jdt-core.html 23 Aug 2007 09:26:42 -0000 @@ -46,9 +46,285 @@
    Project org.eclipse.jdt.core v_809 (cvs).

    What's new in this drop

    +
      +
    • Prefix matching can be disabled while using Camel Case API methods. (see +bug 124624).
      +Following API methods have been added on org.eclipse.jdt.core.compiler.CharOperation: +
      +/**
      + * Answers true if the pattern matches the given name using CamelCase rules, or
      + * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
      + * '*' and '?' and is inherently case sensitive.
      + *
      + * CamelCase denotes the convention of writing compound names without spaces,
      + * and capitalizing every term. This function recognizes both upper and lower
      + * CamelCase, depending whether the leading character is capitalized or not.
      + * The leading part of an upper CamelCase pattern is assumed to contain a
      + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
      + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
      + * uses a lowercase first character. In Java, type names follow the upper
      + * CamelCase convention, whereas method or field names follow the lower
      + * CamelCase convention.
      + *
      + * The pattern may contain lowercase characters, which will be match in a case
      + * sensitive way. These characters must appear in sequence in the name.
      + * For instance, 'NPExcep' will match 'NullPointerException', but not
      + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
      + * 'NoPointerException'.
      + *
      + * Digit characters are treated in a special way. They can be used in the pattern
      + * but are not always considered as leading character. For instance, both
      + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
      + *
      + * CamelCase may or may not match prefixes depending on the given parameter.
      + * When the prefix match parameter is true, the given pattern can
      + * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
      + * patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'.
      + * Reversely, if the prefix match parameter is false, then pattern
      + * and name must have exactly the same number of parts, and their last
      + * parts must be identical if they contain lowercase characters.
      + * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
      + * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
      + * lowercase characters, then the name may end with lowercase characters.
      + * So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not
      + * match 'HashMapEntry'.
      + *
      + * Examples:
      + *  1.	pattern = { 'N', 'P', 'E' }
      + *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	result => true
      + *  2.	pattern = { 'N', 'P', 'E' }
      + *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	result => true
      + *  3.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
      + *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	result => true
      + *  4.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
      + *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	result => false
      + *  5.	pattern = { 'n', p', 'e' }
      + *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	result => false
      + *  6.	pattern = { 'I', 'P', 'L', '3' }
      + *  	name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
      + *  	result => true
      + *  7.	pattern = { 'H', M' }
      + *  	name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
      + *  	result => (prefixMatch == true)
      + *  8.	pattern = { 'H', M', 'a', 'p' }
      + *  	name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
      + *  	result => (prefixMatch == true)
      + * 
      + * @param pattern the given pattern
      + * @param name the given name
      + * @param prefixMatch flag telling whether the pattern can match name prefix or not.
      + * 		. For example, when it's true:
      + * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
      + * 			  but not 'HashMapEntry'
      + * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
      + * 		. and, when it's false:
      + * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
      + * 			  and 'HashMapEntry'
      + * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
      + * 			  types.
      + *
      + * @return true if the pattern matches the given name, false otherwise
      + * @since 3.4
      + */
      +public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean prefixMatch) {
      +...
      +}
      +
      +/**
      + * Answers true if a sub-pattern matches the sub-part of the given name using 
      + * CamelCase rules, or false otherwise.  char[] CamelCase matching does NOT
      + * accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
      + * Can match only subset of name/pattern, considering end positions as
      + * non-inclusive. The sub-pattern is defined by the patternStart and patternEnd
      + * positions.
      + *
      + * CamelCase denotes the convention of writing compound names without spaces,
      + * and capitalizing every term. This function recognizes both upper and lower
      + * CamelCase, depending whether the leading character is capitalized or not.
      + * The leading part of an upper CamelCase pattern is assumed to contain
      + * a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
      + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
      + * uses a lowercase first character. In Java, type names follow the upper
      + * CamelCase convention, whereas method or field names follow the lower
      + * CamelCase convention.
      + *
      + * The pattern may contain lowercase characters, which will be match in a case
      + * sensitive way. These characters must appear in sequence in the name.
      + * For instance, 'NPExcep' will match 'NullPointerException', but not
      + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
      + * 'NoPointerException'.
      + *
      + * Digit characters are treated in a special way. They can be used in the pattern
      + * but are not always considered as leading character. For instance, both
      + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
      + *
      + * CamelCase may or may not match prefixes depending on the given parameter.
      + * When the prefix match parameter is true, the given pattern can
      + * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
      + * patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'.
      + * Reversely, if the prefix match parameter is false, then pattern
      + * and name must have exactly the same number of parts, and their last
      + * parts must be identical if they contain lowercase characters.
      + * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
      + * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
      + * lowercase characters, then the name may end with lowercase characters.
      + * So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not
      + * match 'HashMapEntry'.
      + *
      + * Examples:
      + *  1.	pattern = { 'N', 'P', 'E' }
      + *  	patternStart = 0
      + *  	patternEnd = 3
      + *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	nameStart = 0
      + *  	nameEnd = 20
      + *  	result => true
      + *  2.	pattern = { 'N', 'P', 'E' }
      + *  	patternStart = 0
      + *  	patternEnd = 3
      + *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	nameStart = 0
      + *  	nameEnd = 21
      + *  	result => true
      + *  3.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
      + *  	patternStart = 0
      + *  	patternEnd = 6
      + *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	nameStart = 0
      + *  	nameEnd = 20
      + *  	result => true
      + *  4.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
      + *  	patternStart = 0
      + *  	patternEnd = 6
      + *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	nameStart = 0
      + *  	nameEnd = 21
      + *  	result => false
      + *  5.	pattern = { 'n', p', 'e' }
      + *  	patternStart = 0
      + *  	patternEnd = 3
      + *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      + *  	nameStart = 20
      + *  	nameEnd = 9
      + *  	result => false
      + *  6.	pattern = { 'I', 'P', 'L', '3' }
      + *  	patternStart = 0
      + *  	patternEnd = 4
      + *  	name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
      + *  	nameStart = 0
      + *  	nameEnd = 21
      + *  	result => true
      + *  7.	pattern = { 'H', M' }
      + *  	patternStart = 0
      + *  	patternEnd = 2
      + *  	name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
      + *  	nameStart = 0
      + *  	nameEnd = 12
      + *  	result => (prefixMatch == true)
      + *  8.	pattern = { 'H', M', 'a', 'p' }
      + *  	patternStart = 0
      + *  	patternEnd = 4
      + *  	name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
      + *  	nameStart = 0
      + *  	nameEnd = 9
      + *  	result => (prefixMatch == true)
      + * 
      + * @param pattern the given pattern
      + * @param patternStart the start index of the pattern, inclusive
      + * @param patternEnd the end index of the pattern, exclusive
      + * @param name the given name
      + * @param nameStart the start index of the name, inclusive
      + * @param nameEnd the end index of the name, exclusive
      + * @param prefixMatch flag telling whether the pattern can match name prefix or not.
      + * 		. For example, when it's true:
      + * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
      + * 			  but not 'HashMapEntry'
      + * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
      + * 		. and, when it's false:
      + * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
      + * 			  and 'HashMapEntry'
      + * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
      + * 			  types.
      + *
      + * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
      + * @since 3.4
      + */
      +public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean prefixMatch) {
      +...
      +}
      +
      +Note that same methods have been added on SearchPattern but with +String parameters instead of char[] ones (javadoc comments +are identical): +
      +public static final boolean camelCaseMatch(String pattern, String name, boolean prefixMatch) {
      +...
      +}
      +public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch) {
      +...
      +}
      +
      +Note also that methods camelCaseMatch(String, int, int, String, int, int) +of CharOperation and SearchPattern classes have been +depreciated to avoid too many 'camelCaseMatch*' methods on these classes. +
    • +
    • Search Engine has been modified to better handle additional SearchPattern +constants while using Camel Case one (see bug 200400).
      +Existing SearchPattern#R_CAMELCASE_MATCH constant has been depreciated and
      +is now replaced by SearchPattern#R_CAMEL_CASE_MATCH:
      +	/**
      +	 * Match rule: The search pattern contains a Camel Case expression with
      +	 * a strict number of parts and preventing automatic prefix matching for the last
      +	 * part (if it consists of multiple letters).
      +	 * 
      +	 * Examples:
      +	 * 	. 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
      +	 * 		but not 'HashMapEntry'
      +	 * 	. 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'.
      +	 *
      +	 * This Camel Case match rule does not allow prefix match but accept insensitive
      +	 * case. For instance, 'HashMap' or 'HASHMAP' patterns using this Camel Case
      +	 * rule will match both 'HashMap' but not 'HashMapEntry'.
      +	 *
      +	 * This rule still can be combined to prefix match to accept prefix matches
      +	 * ('HashMap' pattern matching 'HashMapEntry' name). It can also be combined
      +	 * to case sensitive match to reject case insensitive matches ('HAMA' pattern
      +	 * will not match 'HashMap' name).
      +	 *
      +	 * If {@link #R_PATTERN_MATCH} rule is also combined, then the real used
      +	 * match rule will depend on whether string pattern contains specific pattern
      +	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will
      +	 * be used, otherwise only Camel Case match will be used.
      +	 * For example, with 'NPE' string pattern, search will only use
      +	 * Camel Case match rule, but with 'N*P*E*' string pattern, it will 
      +	 * use only Pattern match rule.
      +	 *
      +	 * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed
      +	 * explanation of Camel Case matching.
      +	 *
      +	 * @since 3.4
      +	 */
      +	public static final int R_CAMEL_CASE_MATCH = 0x0100;
      +
      +This change was necessary has the obsolete R_CAMELCASE_MATCH could +not support correctly additional constants as R_PREFIX_MATCH or +R_CASE_SENSITIVE.
      +However, this depreciated constant is still accepted for backward compatibility +but user is advised to replace it with R_CAMEL_CASE_MATCH | R_PREFIX_MATCH +
    • +

    Problem Reports Fixed

    -200547 +200400 +[search] Camel Case match prefix insensitive although spec says prefix sensitive +
    124624 +[search] Camelcase matching routines should support end character +
    200547 [1.5][compiler] Invalid ambiguous error when calling an overriden generic method with MULTIPLE bounds
    198120 [1.5][compiler] Cannot directly invoke the abstract method huch(I1) for the type I1 @@ -59,7 +335,6 @@
    198253 unversioned downloads of ecj.jar and ecjsrc.zip -

    Eclipse Platform Build Notes
    Index: compiler/org/eclipse/jdt/core/compiler/CharOperation.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java,v retrieving revision 1.78 diff -u -r1.78 CharOperation.java --- compiler/org/eclipse/jdt/core/compiler/CharOperation.java 16 Aug 2007 13:13:13 -0000 1.78 +++ compiler/org/eclipse/jdt/core/compiler/CharOperation.java 23 Aug 2007 09:26:42 -0000 @@ -58,7 +58,7 @@ * * * - * @param array the array that is concanated with the suffix character + * @param array the array that is concatenated with the suffix character * @param suffix the suffix character * @return the new array */ @@ -72,8 +72,8 @@ } /** - * Append the given subarray to the target array starting at the given index in the target array. - * The start of the subarray is inclusive, the end is exclusive. + * Append the given sub-array to the target array starting at the given index in the target array. + * The start of the sub-array is inclusive, the end is exclusive. * Answers a new target array if it needs to grow, otherwise answers the same target array. *
    * For example:
    @@ -178,53 +178,60 @@ } /** - * Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. - * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. - *
    - * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. - * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized - * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing - * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern - * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field - * names follow the lower CamelCase convention. - *
    - * The pattern may contain lowercase characters, which will be match in a case sensitive way. These characters must - * appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION' - * or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'. - *

    - * Examples: - *
      - *
    1. - *    pattern = { 'N', 'P', 'E' }
      - *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      - *    result => true
      - * 
      - *
    2. - *
    3. - *    pattern = { 'N', 'P', 'E' }
      - *    name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      - *    result => true
      - * 
      - *
    4. - *
    5. - *    pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
      - *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      - *    result => true
      - * 
      - *
    6. - *
    7. - *    pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
      - *    name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      - *    result => false
      - * 
      - *
    8. - *
    9. - *    pattern = { 'n', p', 'e' }
      - *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
      - *    result => false
      - * 
      - *
    10. - *
    + * Answers true if the pattern matches the given name using CamelCase rules, or + * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards + * '*' and '?' and is inherently case sensitive. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain a + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * This method allow prefix match in Camel Case (see + * {@link #camelCaseMatch(char[], char[], boolean)}). + *

    + *

    + * Examples:
      + *
    1. pattern = { 'N', 'P', 'E' } + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => true
    2. + *
    3. pattern = { 'N', 'P', 'E' } + * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => true
    4. + *
    5. pattern = { 'N', 'u', 'P', 'o', 'E', 'x' } + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => true
    6. + *
    7. pattern = { 'N', 'u', 'P', 'o', 'E', 'x' } + * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => false
    8. + *
    9. pattern = { 'n', p', 'e' } + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => false
    10. + *
    11. pattern = { 'I', 'P', 'L', '3' } + * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' } + * result => true
    12. + *
    13. pattern = { 'H', M' } + * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' } + * result => true
    14. + *
    15. pattern = { 'H', M', 'a', 'p' } + * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' } + * result => true
    16. + *
    * * @param pattern the given pattern * @param name the given name @@ -237,26 +244,138 @@ if (name == null) return false; // null name cannot match - return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length); + return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, true/*prefix match*/); } /** - * Answers true if a sub-pattern matches the subpart of the given name using CamelCase rules, or false otherwise. - * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. + * Answers true if the pattern matches the given name using CamelCase rules, or + * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards + * '*' and '?' and is inherently case sensitive. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain a + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * CamelCase may or may not match prefixes depending on the given parameter. + * When the prefix match parameter is true, the given pattern can + * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and 'HMap' + * patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'. + *
    + * Reversely, if the prefix match parameter is false, then pattern + * and name must have exactly the same number of parts, and their last + * parts must be identical if they contain lowercase characters. + * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither + * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain + * lowercase characters, then the name may end with lowercase characters. + * So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not + * match 'HashMapEntry'. + *

    + *

    + * Examples:
      + *
    1. pattern = { 'N', 'P', 'E' } + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => true
    2. + *
    3. pattern = { 'N', 'P', 'E' } + * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => true
    4. + *
    5. pattern = { 'N', 'u', 'P', 'o', 'E', 'x' } + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => true
    6. + *
    7. pattern = { 'N', 'u', 'P', 'o', 'E', 'x' } + * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => false
    8. + *
    9. pattern = { 'n', p', 'e' } + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * result => false
    10. + *
    11. pattern = { 'I', 'P', 'L', '3' } + * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' } + * result => true
    12. + *
    13. pattern = { 'H', M' } + * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' } + * result => (prefixMatch == true)
    14. + *
    15. pattern = { 'H', M', 'a', 'p' } + * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' } + * result => (prefixMatch == true)
    16. + *
    + * + * @param pattern the given pattern + * @param name the given name + * @param prefixMatch flag telling whether the pattern can match name prefix or not. + *
      + *
    • For example, when it's true:
      + * - 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, + * but not 'HashMapEntry'
      + * - 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'. + *
    • + *
    • and, when it's false:
      + * - 'HM' type string pattern will match both 'HashMap' and 'HtmlMapper' + * and 'HashMapEntry'
      + * - 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper' + * types. + *
    • + *
    + * @return true if the pattern matches the given name, false otherwise + * @since 3.4 + */ +public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean prefixMatch) { + if (pattern == null) + return true; // null pattern is equivalent to '*' + if (name == null) + return false; // null name cannot match + + return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, prefixMatch); +} + +/** + * Answers true if a sub-pattern matches the sub-part of the given name using + * CamelCase rules, or false otherwise. char[] CamelCase matching does NOT + * accept explicit wild-cards '*' and '?' and is inherently case sensitive. * Can match only subset of name/pattern, considering end positions as non-inclusive. - * The subpattern is defined by the patternStart and patternEnd positions. - *
    - * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. - * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized - * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing - * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern - * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field - * names follow the lower CamelCase convention. - *
    - * The pattern may contain lowercase characters, which will be match in a case sensitive way. These characters must - * appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION' - * or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'. - *

    + * The sub-pattern is defined by the patternStart and patternEnd positions. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain a + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * This method allow prefix match in Camel Case (see + * {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)}). + *

    * Examples: *

      *
    1. @@ -309,6 +428,16 @@
        *    result => false
        * 
      *
    2. + *
    3. + *    pattern = { 'I', 'P', 'L', '3' }
      + *    patternStart = 0
      + *    patternEnd = 4
      + *    name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
      + *    nameStart = 0
      + *    nameEnd = 21
      + *    result => true
      + * 
      + *
    4. *
    * * @param pattern the given pattern @@ -317,10 +446,142 @@ * @param name the given name * @param nameStart the start index of the name, inclusive * @param nameEnd the end index of the name, exclusive - * @return true if a sub-pattern matches the subpart of the given name, false otherwise + * @return true if a sub-pattern matches the sub-part of the given name, false otherwise * @since 3.2 + * @deprecated Use {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)} instead */ public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) { + return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, true/*prefix match*/); +} + +/** + * Answers true if a sub-pattern matches the sub-part of the given name using + * CamelCase rules, or false otherwise. char[] CamelCase matching does NOT + * accept explicit wild-cards '*' and '?' and is inherently case sensitive. + * Can match only subset of name/pattern, considering end positions as + * non-inclusive. The sub-pattern is defined by the patternStart and patternEnd + * positions. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain + * a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * CamelCase may or may not match prefixes depending on the given parameter. + * When the prefix match parameter is true, the given pattern can + * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and 'HMap' + * patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'. + *
    + * Reversely, if the prefix match parameter is false, then pattern + * and name must have exactly the same number of parts, and their last + * parts must be identical if they contain lowercase characters. + * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither + * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain + * lowercase characters, then the name may end with lowercase characters. + * So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not + * match 'HashMapEntry'. + *

    + *

    + * Examples:
    + * 
      + *
    1. pattern = { 'N', 'P', 'E' } + * patternStart = 0 + * patternEnd = 3 + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * nameStart = 0 + * nameEnd = 20 + * result => true
    2. + *
    3. pattern = { 'N', 'P', 'E' } + * patternStart = 0 + * patternEnd = 3 + * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * nameStart = 0 + * nameEnd = 21 + * result => true
    4. + *
    5. pattern = { 'N', 'u', 'P', 'o', 'E', 'x' } + * patternStart = 0 + * patternEnd = 6 + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * nameStart = 0 + * nameEnd = 20 + * result => true
    6. + *
    7. pattern = { 'N', 'u', 'P', 'o', 'E', 'x' } + * patternStart = 0 + * patternEnd = 6 + * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * nameStart = 0 + * nameEnd = 21 + * result => false
    8. + *
    9. pattern = { 'n', p', 'e' } + * patternStart = 0 + * patternEnd = 3 + * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' } + * nameStart = 0 + * nameEnd = 20 + * result => false
    10. + *
    11. pattern = { 'I', 'P', 'L', '3' } + * patternStart = 0 + * patternEnd = 4 + * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' } + * nameStart = 0 + * nameEnd = 21 + * result => true
    12. + *
    13. pattern = { 'H', M' } + * patternStart = 0 + * patternEnd = 2 + * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' } + * nameStart = 0 + * nameEnd = 12 + * result => (exactMode == false)
    14. + *
    15. pattern = { 'H', M', 'a', 'p' } + * patternStart = 0 + * patternEnd = 4 + * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' } + * nameStart = 0 + * nameEnd = 9 + * result => (exactMode == false)
    16. + *
    + *
    + * + * @param pattern the given pattern + * @param patternStart the start index of the pattern, inclusive + * @param patternEnd the end index of the pattern, exclusive + * @param name the given name + * @param nameStart the start index of the name, inclusive + * @param nameEnd the end index of the name, exclusive + * @param prefixMatch flag telling whether the pattern can match name prefix or not. + *
      + *
    • For example, when it's true:
      + * - 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, + * but not 'HashMapEntry'
      + * - 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'. + *
    • + *
    • and, when it's false:
      + * - 'HM' type string pattern will match both 'HashMap' and 'HtmlMapper' + * and 'HashMapEntry'
      + * - 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper' + * types. + *
    • + *
    + * @return true if a sub-pattern matches the sub-part of the given name, false otherwise + * @since 3.4 + */ +public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean prefixMatch) { if (name == null) return false; // null name cannot match if (pattern == null) @@ -346,9 +607,38 @@ iPattern++; iName++; - if (iPattern == patternEnd) { - // We have exhausted pattern, so it's a match - return true; + if (iPattern == patternEnd) { // we have exhausted pattern... + // it's a match if not exact mode or name is also exhausted + if (prefixMatch || iName == nameEnd) return true; + + // it's not a match if last pattern character is a lowercase + if ((patternChar = pattern[iPattern-1]) < ScannerHelper.MAX_OBVIOUS) { + if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) { + return false; + } + } + else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) { + return false; + } + + // it's a match only if name has no more uppercase characters (exact mode) + while (true) { + if (iName == nameEnd) { + // we have exhausted name, so it's a match + return true; + } + nameChar = name[iName]; + if (nameChar < ScannerHelper.MAX_OBVIOUS) { + if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) { + // nameChar is uppercase, so it's not a match + return false; + } + } + else if (!Character.isJavaIdentifierPart(nameChar) || Character.isUpperCase(nameChar)) { + return false; + } + iName++; + } } if (iName == nameEnd){ 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.69 diff -u -r1.69 SearchPattern.java --- search/org/eclipse/jdt/core/search/SearchPattern.java 17 Aug 2007 06:14:50 -0000 1.69 +++ search/org/eclipse/jdt/core/search/SearchPattern.java 23 Aug 2007 09:26:44 -0000 @@ -141,34 +141,75 @@ /** * Match rule: The search pattern contains a Camel Case expression. - *
    + *

    * Examples: *

      - *
    • NPE type string pattern will match - * NullPointerException and NpPermissionException types,
    • - *
    • NuPoEx type string pattern will only match - * NullPointerException type.
    • + *
    • 'NPE' type string pattern will match + * 'NullPointerException' and 'NoPermissionException' types,
    • + *
    • 'NuPoEx' type string pattern will only match + * 'NullPointerException' type.
    • *
    - * @see CharOperation#camelCaseMatch(char[], char[]) for a detailed explanation - * of Camel Case matching. - *
    - * Can be combined to {@link #R_PREFIX_MATCH} match rule. For example, - * when prefix match rule is combined with Camel Case match rule, - * "nPE" pattern will match nPException. - *
    + * + * This Camel Case match rule also accepts both prefix and case insensitive + * matches. For instance 'HashMap' or 'HASHMAP' pattern using Camel Case rule will match + * both 'HashMap' and 'HashMapEntry'. + *

    * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules * will not be used simultaneously as they are mutually exclusive. * Used match rule depends on whether string pattern contains specific pattern * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule * will be used, otherwise only Camel Case match will be used. - * For example, with "NPE" string pattern, search will only use - * Camel Case match rule, but with N*P*E* string pattern, it will + * For example, with '"NPE"' string pattern, search will only use + * Camel Case match rule, but with 'N*P*E*' string pattern, it will * use only Pattern match rule. + *

    + * @see #camelCaseMatch(String, String) for a detailed explanation of Camel + * Case matching. * * @since 3.2 + * @deprecated Use {@link #R_CAMEL_CASE_MATCH} | + * {@link #R_PREFIX_MATCH} instead. */ public static final int R_CAMELCASE_MATCH = 0x0080; + /** + * Match rule: The search pattern contains a Camel Case expression with + * a strict number of parts and preventing automatic prefix matching for the last + * part (if it consists of multiple letters). + *
    + * Examples: + *

      + *
    • 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types, + * but not 'HashMapEntry' + *
    • + *
    • 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'. + *
    • + *
    + * + * This Camel Case match rule does not allow prefix match but accept insensitive + * case. For instance, 'HashMap' or 'HASHMAP' patterns using this Camel Case + * rule will match both 'HashMap' but not 'HashMapEntry'. + *

    + * This rule still can be combined to prefix match to accept prefix matches + * ('HashMap' pattern matching 'HashMapEntry' name). It can also be combined + * to case sensitive match to reject case insensitive matches ('HAMA' pattern + * will not match 'HashMap' name). + *

    + * If {@link #R_PATTERN_MATCH} rule is also combined, then the real used + * match rule will depend on whether string pattern contains specific pattern + * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will + * be used, otherwise only Camel Case match will be used.
    + * For example, with 'NPE' string pattern, search will only use + * Camel Case match rule, but with 'N*P*E*' string pattern, it will + * use only Pattern match rule. + *

    + * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed + * explanation of Camel Case matching. + *

    + * @since 3.4 + */ + public static final int R_CAMEL_CASE_MATCH = 0x0100; + private static final int MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH; private int matchRule; @@ -178,7 +219,7 @@ * It can be exact match, prefix match, pattern match or regexp match. * Rule can also be combined with a case sensitivity flag. * - * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH}, {@link #R_PATTERN_MATCH}, + * @param rule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH}, {@link #R_PATTERN_MATCH}, * {@link #R_REGEXP_MATCH}, {@link #R_CAMELCASE_MATCH} combined with one of following values: * {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH}. * e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact and case sensitive match is requested, @@ -188,19 +229,67 @@ * on non-generic types/methods search.
    * Note also that default behavior for generic types/methods search is to find exact matches. */ -public SearchPattern(int matchRule) { - this.matchRule = matchRule; +public SearchPattern(int rule) { + this.matchRule = rule; // Set full match implicit mode - if ((matchRule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) { + if ((rule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) { this.matchRule |= R_FULL_MATCH; } + this.matchRule = updateMatchRule(this.matchRule); } /** - * Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. - * CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. + * Answers true if the pattern matches the given name using CamelCase rules, or + * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards + * '*' and '?' and is inherently case sensitive. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain a + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * This method allow prefix match in Camel Case (see + * {@link #camelCaseMatch(String, String, boolean)}). + *

    + *

    + * Examples:
    + * 
    1. pattern = "NPE" + * name = NullPointerException / NoPermissionException + * result => true
    2. + *
    3. pattern = "NuPoEx" + * name = NullPointerException + * result => true
    4. + *
    5. pattern = "npe" + * name = NullPointerException + * result => false
    6. + *
    7. pattern = "IPL3" + * name = "IPerspectiveListener3" + * result => true
    8. + *
    9. pattern = "HM" + * name = "HashMapEntry" + * result => true
    10. + *
    11. pattern = "HMap" + * name = "HatMapper" + * result => true
    12. + *
    * - * @see CharOperation#camelCaseMatch(char[], char[]) + * @see #camelCaseMatch(String, int, int, String, int, int, boolean) for algorithm + * implementation * * @param pattern the given pattern * @param name the given name @@ -213,17 +302,195 @@ if (name == null) return false; // null name cannot match - return CharOperation.camelCaseMatch(pattern.toCharArray(), 0, pattern.length(), name.toCharArray(), 0, name.length()); + return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), true/*prefix match*/); } /** - * Answers true if a sub-pattern matches the subpart of the given name using CamelCase rules, or false otherwise. - * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. - * Can match only subset of name/pattern, considering end positions as non-inclusive. - * The subpattern is defined by the patternStart and patternEnd positions. + * Answers true if the pattern matches the given name using CamelCase rules, or + * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards + * '*' and '?' and is inherently case sensitive. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain a + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * CamelCase may or may not match prefixes depending on the given parameter. + * When the prefix match parameter is true, the given pattern can + * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and 'HMap' + * patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'. + *
    + * Reversely, if the prefix match parameter is false, then pattern + * and name must have exactly the same number of parts, and their last + * parts must be identical if they contain lowercase characters. + * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither + * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain + * lowercase characters, then the name may end with lowercase characters. + * So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not + * match 'HashMapEntry'. + *

    + *

    + * Examples:
    + * 
    1. pattern = "NPE" + * name = NullPointerException / NoPermissionException + * result => true
    2. + *
    3. pattern = "NuPoEx" + * name = NullPointerException + * result => true
    4. + *
    5. pattern = "npe" + * name = NullPointerException + * result => false
    6. + *
    7. pattern = "IPL3" + * name = "IPerspectiveListener3" + * result => true
    8. + *
    9. pattern = "HM" + * name = "HashMapEntry" + * result => (prefixMatch == true)
    10. + *
    11. pattern = "HMap" + * name = "HatMapper" + * result => (prefixMatch == true)
    12. + *
    + * + * @see #camelCaseMatch(String, int, int, String, int, int, boolean) for algorithm implementation * - * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int) for specification - * and implementation of this algorithm. + * @param pattern the given pattern + * @param name the given name + * @param prefixMatch flag telling whether the pattern can match name prefix or not. + *
      + *
    • For example, when it's true:
      + * - HM type string pattern will match + * HashMap and HtmlMapper types, + * but not HashMapEntry
      + * - HMap type string pattern will match + * HashMap type but not HtmlMapper. + *
    • + *
    • and, when it's false:
      + * - HM type string pattern will match both + * HashMap and HtmlMapper + * and HashMapEntry
      + * - HMap type string pattern will match both + * HashMap and HtmlMapper types. + *
    • + *
    + * @return true if the pattern matches the given name, false otherwise + * @since 3.4 + */ +public static final boolean camelCaseMatch(String pattern, String name, boolean prefixMatch) { + if (pattern == null) + return true; // null pattern is equivalent to '*' + if (name == null) + return false; // null name cannot match + + return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), prefixMatch); +} + +/** + * Answers true if a sub-pattern matches the sub-part of the given name using + * CamelCase rules, or false otherwise. char[] CamelCase matching does NOT + * accept explicit wild-cards '*' and '?' and is inherently case sensitive. + * Can match only subset of name/pattern, considering end positions as non-inclusive. + * The sub-pattern is defined by the patternStart and patternEnd positions. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain a + * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * This method allow prefix match in Camel Case (see + * {@link #camelCaseMatch(String, int, int, String, int, int, boolean)}). + *

    + *

    Examples:
      + *
    1. pattern = "NPE" + * patternStart = 0 + * patternEnd = 3 + * name = NullPointerException + * nameStart = 0 + * nameEnd = 20 + * result => true
    2. + *
    3. pattern = "NPE" + * patternStart = 0 + * patternEnd = 3 + * name = NoPermissionException + * nameStart = 0 + * nameEnd = 21 + * result => true
    4. + *
    5. pattern = "NuPoEx" + * patternStart = 0 + * patternEnd = 6 + * name = NullPointerException + * nameStart = 0 + * nameEnd = 20 + * result => true
    6. + *
    7. pattern = "NuPoEx" + * patternStart = 0 + * patternEnd = 6 + * name = NoPermissionException + * nameStart = 0 + * nameEnd = 21 + * result => false
    8. + *
    9. pattern = "npe" + * patternStart = 0 + * patternEnd = 3 + * name = NullPointerException + * nameStart = 0 + * nameEnd = 20 + * result => false
    10. + *
    11. pattern = "IPL3" + * patternStart = 0 + * patternEnd = 3 + * name = "IPerspectiveListener3" + * nameStart = 0 + * nameEnd = 21 + * result => true
    12. + *
    13. pattern = "HM" + * patternStart = 0 + * patternEnd = 2 + * name = "HashMapEntry" + * nameStart = 0 + * nameEnd = 12 + * result => true
    14. + *
    15. pattern = "HMap" + * patternStart = 0 + * patternEnd = 4 + * name = "HatMapper" + * nameStart = 0 + * nameEnd = 9 + * result => true
    16. + *
    * * @param pattern the given pattern * @param patternStart the start index of the pattern, inclusive @@ -231,11 +498,269 @@ * @param name the given name * @param nameStart the start index of the name, inclusive * @param nameEnd the end index of the name, exclusive - * @return true if a sub-pattern matches the subpart of the given name, false otherwise + * @return true if a sub-pattern matches the sub-part of the given name, false otherwise * @since 3.2 + * @deprecated Use {@link #camelCaseMatch(String, int, int, String, int, int, boolean)} instead */ public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) { - return CharOperation.camelCaseMatch(pattern.toCharArray(), patternStart, patternEnd, name.toCharArray(), nameStart, nameEnd); + return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, true/*prefix match*/); +} + +/** + * Answers true if a sub-pattern matches the sub-part of the given name using + * CamelCase rules, or false otherwise. char[] CamelCase matching does NOT + * accept explicit wild-cards '*' and '?' and is inherently case sensitive. + * Can match only subset of name/pattern, considering end positions as + * non-inclusive. The sub-pattern is defined by the patternStart and patternEnd + * positions. + *

    + * CamelCase denotes the convention of writing compound names without spaces, + * and capitalizing every term. This function recognizes both upper and lower + * CamelCase, depending whether the leading character is capitalized or not. + * The leading part of an upper CamelCase pattern is assumed to contain + * a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will + * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern + * uses a lowercase first character. In Java, type names follow the upper + * CamelCase convention, whereas method or field names follow the lower + * CamelCase convention. + *

    + * The pattern may contain lowercase characters, which will be match in a case + * sensitive way. These characters must appear in sequence in the name. + * For instance, 'NPExcep' will match 'NullPointerException', but not + * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not + * 'NoPointerException'. + *

    + * Digit characters are treated in a special way. They can be used in the pattern + * but are not always considered as leading character. For instance, both + * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'. + *

    + * CamelCase may or may not match prefixes depending on the given parameter. + * When the prefix match parameter is true, the given pattern can + * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and 'HMap' + * patterns will all match 'HashMap', 'HatMapper' and 'HashMapEntry'. + *
    + * Reversely, if the prefix match parameter is false, then pattern + * and name must have exactly the same number of parts, and their last + * parts must be identical if they contain lowercase characters. + * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither + * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain + * lowercase characters, then the name may end with lowercase characters. + * So, 'HM' pattern will match both 'HashMap' and 'HatMapper' but will not + * match 'HashMapEntry'. + *

    + *

    Examples:
      + *
    1. pattern = "NPE" + * patternStart = 0 + * patternEnd = 3 + * name = NullPointerException + * nameStart = 0 + * nameEnd = 20 + * result => true
    2. + *
    3. pattern = "NPE" + * patternStart = 0 + * patternEnd = 3 + * name = NoPermissionException + * nameStart = 0 + * nameEnd = 21 + * result => true
    4. + *
    5. pattern = "NuPoEx" + * patternStart = 0 + * patternEnd = 6 + * name = NullPointerException + * nameStart = 0 + * nameEnd = 20 + * result => true
    6. + *
    7. pattern = "NuPoEx" + * patternStart = 0 + * patternEnd = 6 + * name = NoPermissionException + * nameStart = 0 + * nameEnd = 21 + * result => false
    8. + *
    9. pattern = "npe" + * patternStart = 0 + * patternEnd = 3 + * name = NullPointerException + * nameStart = 0 + * nameEnd = 20 + * result => false
    10. + *
    11. pattern = "IPL3" + * patternStart = 0 + * patternEnd = 3 + * name = "IPerspectiveListener3" + * nameStart = 0 + * nameEnd = 21 + * result => true
    12. + *
    13. pattern = "HM" + * patternStart = 0 + * patternEnd = 2 + * name = "HashMapEntry" + * nameStart = 0 + * nameEnd = 12 + * result => (prefixMatch == true)
    14. + *
    15. pattern = "HMap" + * patternStart = 0 + * patternEnd = 4 + * name = "HatMapper" + * nameStart = 0 + * nameEnd = 9 + * result => (prefixMatch == true)
    16. + *
    + * + * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean) + * from which algorithm implementation has been entirely copied. + * Array lengths have been replaced with call to {@link String#length()} and + * array direct access have been replaced with call to {@link String#charAt(int)}. + * WARNING: Do not change one of these method without changing the other + * the same way otherwise behavior differences may appear while using them... + * + * @param pattern the given pattern + * @param patternStart the start index of the pattern, inclusive + * @param patternEnd the end index of the pattern, exclusive + * @param name the given name + * @param nameStart the start index of the name, inclusive + * @param nameEnd the end index of the name, exclusive + * @param prefixMatch flag telling whether the pattern can match name prefix or not. + *
      + *
    • For example, when it's true:
      + * - HM type string pattern will match + * HashMap and HtmlMapper types, + * but not HashMapEntry
      + * - HMap type string pattern will match + * HashMap type but not HtmlMapper. + *
    • + *
    • and, when it's false:
      + * - HM type string pattern will match both + * HashMap and HtmlMapper + * and HashMapEntry
      + * - HMap type string pattern will match both + * HashMap and HtmlMapper types. + *
    • + *
    + * @return true if a sub-pattern matches the sub-part of the given name, false otherwise + * @since 3.4 + */ +public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch) { + if (name == null) + return false; // null name cannot match + if (pattern == null) + return true; // null pattern is equivalent to '*' + if (patternEnd < 0) patternEnd = pattern.length(); + if (nameEnd < 0) nameEnd = name.length(); + + if (patternEnd <= patternStart) return nameEnd <= nameStart; + if (nameEnd <= nameStart) return false; + // check first pattern char + if (name.charAt(nameStart) != pattern.charAt(patternStart)) { + // first char must strictly match (upper/lower) + return false; + } + + char patternChar, nameChar; + int iPattern = patternStart; + int iName = nameStart; + + // Main loop is on pattern characters + while (true) { + + iPattern++; + iName++; + + if (iPattern == patternEnd) { // we have exhausted pattern... + // it's a match if not exact mode or name is also exhausted + if (prefixMatch || iName == nameEnd) return true; + + // it's not a match if last pattern character is a lowercase + if ((patternChar = pattern.charAt(iPattern-1)) < ScannerHelper.MAX_OBVIOUS) { + if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) { + return false; + } + } + else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) { + return false; + } + + // it's a match only if name has no more uppercase characters (exact mode) + while (true) { + if (iName == nameEnd) { + // we have exhausted name, so it's a match + return true; + } + nameChar = name.charAt(iName); + if (nameChar < ScannerHelper.MAX_OBVIOUS) { + if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) { + // nameChar is uppercase, so it's not a match + return false; + } + } + else if (!Character.isJavaIdentifierPart(nameChar) || Character.isUpperCase(nameChar)) { + return false; + } + iName++; + } + } + + if (iName == nameEnd){ + // We have exhausted name (and not pattern), so it's not a match + return false; + } + + // For as long as we're exactly matching, bring it on (even if it's a lower case character) + if ((patternChar = pattern.charAt(iPattern)) == name.charAt(iName)) { + continue; + } + + // If characters are not equals, then it's not a match if patternChar is lowercase + if (patternChar < ScannerHelper.MAX_OBVIOUS) { + if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) { + return false; + } + } + else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) { + return false; + } + + // patternChar is uppercase, so let's find the next uppercase in name + while (true) { + if (iName == nameEnd){ + // We have exhausted name (and not pattern), so it's not a match + return false; + } + + nameChar = name.charAt(iName); + if (nameChar < ScannerHelper.MAX_OBVIOUS) { + int charNature = ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar]; + if ((charNature & (ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_SPECIAL)) != 0) { + // nameChar is lowercase + iName++; + } else if ((charNature & ScannerHelper.C_DIGIT) != 0) { + // nameChar is digit => break if the digit is current pattern character otherwise consume it + if (patternChar == nameChar) break; + iName++; + // nameChar is uppercase... + } else if (patternChar != nameChar) { + //.. and it does not match patternChar, so it's not a match + return false; + } else { + //.. and it matched patternChar. Back to the big loop + break; + } + } + // Same tests for non-obvious characters + else if (Character.isJavaIdentifierPart(nameChar) && !Character.isUpperCase(nameChar)) { + iName++; + } else if (Character.isDigit(nameChar)) { + if (patternChar == nameChar) break; + iName++; + } else if (patternChar != nameChar) { + return false; + } else { + break; + } + } + // At this point, either name has been exhausted, or it is at an uppercase letter. + // Since pattern is also at an uppercase letter + } } /** @@ -1601,26 +2126,26 @@ if (pattern == null) return true; // null is as if it was "*" if (name != null) { boolean isCaseSensitive = (this.matchRule & R_CASE_SENSITIVE) != 0; - boolean isCamelCase = (this.matchRule & R_CAMELCASE_MATCH) != 0; + boolean isCamelCase = (this.matchRule & R_CAMEL_CASE_MATCH) != 0; int matchMode = this.matchRule & MODE_MASK; boolean emptyPattern = pattern.length == 0; - if (matchMode == R_PREFIX_MATCH && emptyPattern) return true; + boolean isPrefix = (this.matchRule & R_PREFIX_MATCH) != 0; + if (isPrefix && emptyPattern) return true; boolean sameLength = pattern.length == name.length; boolean canBePrefix = name.length >= pattern.length; boolean matchFirstChar = !isCaseSensitive || emptyPattern || (name.length > 0 && pattern[0] == name[0]); - if (isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(pattern, name)) { - return true; + if (isCamelCase) { + if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, isPrefix)) { + return true; + } + if (isCaseSensitive) return false; } switch (matchMode) { case R_EXACT_MATCH : - case R_FULL_MATCH : - if (!isCamelCase) { - if (sameLength && matchFirstChar) { - return CharOperation.equals(pattern, name, isCaseSensitive); - } - break; + if (sameLength && matchFirstChar) { + return CharOperation.equals(pattern, name, isCaseSensitive); } - // fall through next case to match as prefix if camel case failed + break; case R_PREFIX_MATCH : if (canBePrefix && matchFirstChar) { return CharOperation.prefixEquals(pattern, name, isCaseSensitive); @@ -1628,6 +2153,7 @@ break; case R_PATTERN_MATCH : + // TODO_PERFS (frederic) not sure this lowercase was necessary... if (!isCaseSensitive) pattern = CharOperation.toLowerCase(pattern); return CharOperation.match(pattern, name, isCaseSensitive); @@ -1643,7 +2169,7 @@ /** * Validate compatibility between given string pattern and match rule. *
    - * Optimized (ie. returned match rule is modified) combinations are: + * Returned match rule is modified, when following combinations are observed in the given parameters: *
      *
    • {@link #R_PATTERN_MATCH} without any '*' or '?' in string pattern: * pattern match bit is unset, @@ -1675,6 +2201,9 @@ */ public static int validateMatchRule(String stringPattern, int matchRule) { + // Backward compatibility + matchRule = updateMatchRule(matchRule); + // Verify Regexp match rule if ((matchRule & R_REGEXP_MATCH) != 0) { if ((matchRule & R_PATTERN_MATCH) != 0 || (matchRule & R_PREFIX_MATCH) != 0 || (matchRule & R_CAMELCASE_MATCH) != 0) { @@ -1694,12 +2223,12 @@ } if ((matchRule & R_PATTERN_MATCH) != 0) { // remove Camel Case and Prefix match bits if any - matchRule &= ~R_CAMELCASE_MATCH; + matchRule &= ~R_CAMEL_CASE_MATCH; matchRule &= ~R_PREFIX_MATCH; } // Verify Camel Case match rule - if ((matchRule & R_CAMELCASE_MATCH) != 0) { + if ((matchRule & R_CAMEL_CASE_MATCH) != 0) { // Verify sting pattern validity int length = stringPattern.length(); boolean validCamelCase = true; @@ -1713,20 +2242,26 @@ } validCamelCase = validCamelCase && uppercase; // Verify bits compatibility - if (validCamelCase) { - if ((matchRule & R_PREFIX_MATCH) != 0) { - if ((matchRule & R_CASE_SENSITIVE) != 0) { - // This is equivalent to Camel Case match rule - matchRule &= ~R_PREFIX_MATCH; - matchRule &= ~R_CASE_SENSITIVE; - } - } - } else { - matchRule &= ~R_CAMELCASE_MATCH; - if ((matchRule & R_PREFIX_MATCH) == 0) { - matchRule |= R_PREFIX_MATCH; - matchRule |= R_CASE_SENSITIVE; - } + if (!validCamelCase) { + matchRule &= ~R_CAMEL_CASE_MATCH; + matchRule |= R_PREFIX_MATCH; + } + } + return matchRule; +} + +/** + * Update depreciated flags if necessary in the given match rule. + * + * @param matchRule The match rule to update + * @return The updated match rule with the updated flags + */ +static int updateMatchRule(int matchRule) { + if ((matchRule & R_CAMELCASE_MATCH) != 0) { + matchRule &= ~R_CAMELCASE_MATCH; + matchRule |= R_CAMEL_CASE_MATCH; + if ((matchRule & (R_PREFIX_MATCH | R_CASE_SENSITIVE)) == 0) { + matchRule |= R_PREFIX_MATCH; } } return matchRule; Index: search/org/eclipse/jdt/core/search/SearchEngine.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java,v retrieving revision 1.142 diff -u -r1.142 SearchEngine.java --- search/org/eclipse/jdt/core/search/SearchEngine.java 6 Jul 2007 12:25:50 -0000 1.142 +++ search/org/eclipse/jdt/core/search/SearchEngine.java 23 Aug 2007 09:26:43 -0000 @@ -637,7 +637,7 @@ *
    • {@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names * of the searched types.
    • *
    • {@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.
    • - *
    • {@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.
    • + *
    • {@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.
    • *
    * combined with {@link SearchPattern#R_CASE_SENSITIVE}, * e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, @@ -649,7 +649,7 @@ *
  • {@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names * of the searched types.
  • *
  • {@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.
  • - *
  • {@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.
  • + *
  • {@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.
  • * * combined with {@link SearchPattern#R_CASE_SENSITIVE}, * e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, @@ -694,7 +694,15 @@ IProgressMonitor progressMonitor) throws JavaModelException { TypeNameRequestorWrapper requestorWrapper = new TypeNameRequestorWrapper(nameRequestor); - this.basicEngine.searchAllTypeNames(packageName, packageMatchRule, typeName, typeMatchRule, searchFor, scope, requestorWrapper, waitingPolicy, progressMonitor); + this.basicEngine.searchAllTypeNames(packageName, + packageMatchRule, + typeName, + SearchPattern.updateMatchRule(typeMatchRule), + searchFor, + scope, + requestorWrapper, + waitingPolicy, + progressMonitor); } /** @@ -716,7 +724,7 @@ *
  • {@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names * of the searched types.
  • *
  • {@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.
  • - *
  • {@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.
  • + *
  • {@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.
  • * * combined with {@link SearchPattern#R_CASE_SENSITIVE}, * e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, @@ -732,7 +740,7 @@ *
  • {@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names * of the searched types.
  • *
  • {@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.
  • - *
  • {@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.
  • + *
  • {@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.
  • * * combined with {@link SearchPattern#R_CASE_SENSITIVE}, * e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, @@ -778,7 +786,15 @@ IProgressMonitor progressMonitor) throws JavaModelException { TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper(nameMatchRequestor, scope); - this.basicEngine.searchAllTypeNames(packageName, packageMatchRule, typeName, typeMatchRule, searchFor, scope, requestorWrapper, waitingPolicy, progressMonitor); + this.basicEngine.searchAllTypeNames(packageName, + packageMatchRule, + typeName, + SearchPattern.updateMatchRule(typeMatchRule), + searchFor, + scope, + requestorWrapper, + waitingPolicy, + progressMonitor); } /** 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.27 diff -u -r1.27 Index.java --- search/org/eclipse/jdt/internal/core/index/Index.java 15 Aug 2007 18:49:22 -0000 1.27 +++ search/org/eclipse/jdt/internal/core/index/Index.java 23 Aug 2007 09:26:44 -0000 @@ -47,7 +47,7 @@ SearchPattern.R_PATTERN_MATCH | SearchPattern.R_REGEXP_MATCH | SearchPattern.R_CASE_SENSITIVE | - SearchPattern.R_CAMELCASE_MATCH; + SearchPattern.R_CAMEL_CASE_MATCH; public static boolean isMatch(char[] pattern, char[] word, int matchRule) { if (pattern == null) return true; @@ -57,28 +57,25 @@ 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)) { - return true; + boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0; + if (isCamelCase) { + if (pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word, (matchRule & SearchPattern.R_PREFIX_MATCH) != 0)) { + return true; + } + if ((matchRule & SearchPattern.R_CASE_SENSITIVE) != 0) return false; } // need to mask some bits of pattern rule (bug 79790) - matchRule &= ~SearchPattern.R_CAMELCASE_MATCH; + matchRule &= ~SearchPattern.R_CAMEL_CASE_MATCH; switch(matchRule & MATCH_RULE_INDEX_MASK) { case SearchPattern.R_EXACT_MATCH : - if (!isCamelCase) { - return patternLength == wordLength && CharOperation.equals(pattern, word, false); - } - // fall through prefix match if camel case failed + return patternLength == wordLength && CharOperation.equals(pattern, word, false); case SearchPattern.R_PREFIX_MATCH : 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 pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word); - } - // fall through prefix match if camel case failed + return pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word); case SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE : return pattern[0] == word[0] && patternLength <= wordLength && CharOperation.prefixEquals(pattern, word); case SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE : Index: model/org/eclipse/jdt/internal/core/SearchableEnvironment.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java,v retrieving revision 1.68 diff -u -r1.68 SearchableEnvironment.java --- model/org/eclipse/jdt/internal/core/SearchableEnvironment.java 12 Oct 2006 09:21:42 -0000 1.68 +++ model/org/eclipse/jdt/internal/core/SearchableEnvironment.java 23 Aug 2007 09:26:42 -0000 @@ -380,7 +380,7 @@ }; try { int matchRule = SearchPattern.R_PREFIX_MATCH; - if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH; + if (camelCaseMatch) matchRule |= SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH; new BasicSearchEngine(this.workingCopies).searchAllTypeNames( qualification, SearchPattern.R_EXACT_MATCH, 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.47 diff -u -r1.47 BasicSearchEngine.java --- search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 6 Jul 2007 12:25:50 -0000 1.47 +++ search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 23 Aug 2007 09:26:44 -0000 @@ -246,7 +246,7 @@ return "R_EXACT_MATCH"; //$NON-NLS-1$ } StringBuffer buffer = new StringBuffer(); - for (int i=1; i<=8; i++) { + for (int i=1; i<=16; i++) { int bit = matchRule & (1<<(i-1)); if (bit != 0 && buffer.length()>0) buffer.append(" | "); //$NON-NLS-1$ switch (bit) { @@ -271,9 +271,12 @@ case SearchPattern.R_REGEXP_MATCH: buffer.append("R_REGEXP_MATCH"); //$NON-NLS-1$ break; - case SearchPattern.R_CAMELCASE_MATCH: + case 0x0080: // SearchPattern.R_CAMELCASE_MATCH: buffer.append("R_CAMELCASE_MATCH"); //$NON-NLS-1$ break; + case SearchPattern.R_CAMEL_CASE_MATCH: + buffer.append("R_CAMEL_CASE_MATCH"); //$NON-NLS-1$ + break; } } return buffer.toString(); @@ -454,21 +457,21 @@ return false; if (patternTypeName != null) { - boolean isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0; + boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0; int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK; if (!isCaseSensitive && !isCamelCase) { patternTypeName = CharOperation.toLowerCase(patternTypeName); } boolean matchFirstChar = !isCaseSensitive || patternTypeName[0] == typeName[0]; - if (isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName)) { - return true; + if (isCamelCase) { + if (matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, (matchRule & SearchPattern.R_PREFIX_MATCH) != 0)) { + return true; + } + if (isCaseSensitive) return false; } switch(matchMode) { case SearchPattern.R_EXACT_MATCH : - if (!isCamelCase) { - return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive); - } - // fall through next case to match as prefix if camel case failed + return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive); case SearchPattern.R_PREFIX_MATCH : return matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, isCaseSensitive); case SearchPattern.R_PATTERN_MATCH : @@ -842,7 +845,7 @@ } public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) { if (match(typeSuffix, packageName, typeName, typeMatchRule, TypeDeclaration.kind(memberTypeDeclaration.modifiers), packageDeclaration, memberTypeDeclaration.name)) { - // compute encloising type names + // compute enclosing type names TypeDeclaration enclosing = memberTypeDeclaration.enclosingType; char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR; while (enclosing != null) {