View | Details | Raw Unified | Return to bug 124624 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java (-13 / +168 lines)
Lines 3715-3758 Link Here
3715
 *
3715
 *
3716
 * These tests are not really duplicates of {@link JavaSearchBugsTests} ones
3716
 * These tests are not really duplicates of {@link JavaSearchBugsTests} ones
3717
 * as they also test camel case in indexes...
3717
 * as they also test camel case in indexes...
3718
 * @deprecated As using a depreciated constant
3718
 */
3719
 */
3719
public void testCamelCaseTypePattern01() throws CoreException {
3720
public void testCamelCaseTypePattern01() throws CoreException {
3720
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope());
3721
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3721
	assertSearchResults(
3722
	assertSearchResults(
3722
		"src/a3/References.java a3.References [References]\n" + 
3723
		"src/a3/References.java a3.References [References]\n" + 
3723
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3724
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3724
	);
3725
	);
3725
}
3726
}
3726
3727
public void testCamelCaseTypePattern01b() throws CoreException {
3728
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
3729
	assertSearchResults(
3730
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3731
	);
3732
}
3733
/** @deprecated As using a depreciated constant */
3727
public void testCamelCaseTypePattern02() throws CoreException {
3734
public void testCamelCaseTypePattern02() throws CoreException {
3728
	search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope());
3735
	search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3729
	assertSearchResults(
3736
	assertSearchResults(
3730
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3737
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3731
	);
3738
	);
3732
}
3739
}
3733
3740
/** @deprecated As using a depreciated constant */
3734
public void testCamelCaseTypePattern03() throws CoreException {
3741
public void testCamelCaseTypePattern03() throws CoreException {
3735
	search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope());
3742
	search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3736
	assertSearchResults(
3743
	assertSearchResults(
3737
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3744
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3738
	);
3745
	);
3739
}
3746
}
3740
3747
/** @deprecated As using a depreciated constant */
3741
public void testCamelCaseTypePattern04() throws CoreException {
3748
public void testCamelCaseTypePattern04() throws CoreException {
3742
	search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope());
3749
	search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3743
	assertSearchResults(
3750
	assertSearchResults(
3744
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3751
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3745
	);
3752
	);
3746
}
3753
}
3747
3754
/**
3755
 * @deprecated As using a depreciated constant
3756
 */
3748
public void testCamelCaseTypePattern05() throws CoreException {
3757
public void testCamelCaseTypePattern05() throws CoreException {
3749
	search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH, getJavaSearchScope());
3758
	search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3750
	assertSearchResults(
3759
	assertSearchResults(
3751
		"src/a3/References.java a3.References [References]\n" + 
3760
		"src/a3/References.java a3.References [References]\n" + 
3752
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3761
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3753
	);
3762
	);
3754
}
3763
}
3755
3764
/** @deprecated As using a depreciated constant */
3756
public void testCamelCaseTypePattern06() throws CoreException {
3765
public void testCamelCaseTypePattern06() throws CoreException {
3757
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3766
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3758
	new SearchEngine().searchAllTypeNames(
3767
	new SearchEngine().searchAllTypeNames(
Lines 3771-3777 Link Here
3771
		"java.lang.CloneNotSupportedException",
3780
		"java.lang.CloneNotSupportedException",
3772
		requestor);
3781
		requestor);
3773
}
3782
}
3774
3783
/** @deprecated As using a depreciated constant */
3775
public void testCamelCaseTypePattern07() throws CoreException {
3784
public void testCamelCaseTypePattern07() throws CoreException {
3776
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3785
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3777
	new SearchEngine().searchAllTypeNames(
3786
	new SearchEngine().searchAllTypeNames(
Lines 3794-3800 Link Here
3794
		"q1.AA",
3803
		"q1.AA",
3795
		requestor);
3804
		requestor);
3796
}
3805
}
3797
3806
/** @deprecated As using a depreciated constant */
3798
public void testCamelCaseTypePattern08() throws CoreException {
3807
public void testCamelCaseTypePattern08() throws CoreException {
3799
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3808
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3800
	new SearchEngine().searchAllTypeNames(
3809
	new SearchEngine().searchAllTypeNames(
Lines 3816-3822 Link Here
3816
		"q1.AA",
3825
		"q1.AA",
3817
		requestor);
3826
		requestor);
3818
}
3827
}
3819
3828
/** @deprecated As using a depreciated constant */
3820
public void testCamelCaseTypePattern09() throws CoreException {
3829
public void testCamelCaseTypePattern09() throws CoreException {
3821
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3830
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3822
	new SearchEngine().searchAllTypeNames(
3831
	new SearchEngine().searchAllTypeNames(
Lines 3838-3843 Link Here
3838
		"q1.AA",
3847
		"q1.AA",
3839
		requestor);
3848
		requestor);
3840
}
3849
}
3850
/** @deprecated As using a depreciated constant */
3851
public void testCamelCaseTypePattern10() throws CoreException {
3852
	workingCopies = new ICompilationUnit[1];
3853
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3854
		"class Null {}\n" + 
3855
		"class NULL {}\n" + 
3856
		"class NullPointerException {}\n" + 
3857
		"class NULLPointerException {}\n" + 
3858
		"class NULLPOINTERException {}\n" + 
3859
		"class NULLPOINTEREXCEPTION {}\n"
3860
	);
3861
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3862
	assertSearchResults(
3863
		"src/Test.java Null [Null]\n" +
3864
		"src/Test.java NULL [NULL]\n" +
3865
		"src/Test.java NullPointerException [NullPointerException]\n" +
3866
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3867
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3868
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3869
	);
3870
}
3871
/** @deprecated As using a depreciated constant */
3872
public void testCamelCaseTypePattern11() throws CoreException {
3873
	workingCopies = new ICompilationUnit[1];
3874
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3875
		"class Null {}\n" + 
3876
		"class NULL {}\n" + 
3877
		"class NullPointerException {}\n" + 
3878
		"class NULLPointerException {}\n" + 
3879
		"class NULLPOINTERException {}\n" + 
3880
		"class NULLPOINTEREXCEPTION {}\n"
3881
	);
3882
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH);
3883
	assertSearchResults(
3884
		"src/Test.java Null [Null]\n" +
3885
		"src/Test.java NULL [NULL]\n" +
3886
		"src/Test.java NullPointerException [NullPointerException]\n" +
3887
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3888
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3889
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3890
	);
3891
}
3892
/** @deprecated As using a depreciated constant */
3893
public void testCamelCaseTypePattern12() throws CoreException {
3894
	workingCopies = new ICompilationUnit[1];
3895
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3896
		"class Null {}\n" + 
3897
		"class NULL {}\n" + 
3898
		"class NullPointerException {}\n" + 
3899
		"class NULLPointerException {}\n" + 
3900
		"class NULLPOINTERException {}\n" + 
3901
		"class NULLPOINTEREXCEPTION {}\n"
3902
	);
3903
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
3904
	assertSearchResults(
3905
		"src/Test.java Null [Null]"
3906
	);
3907
}
3908
/** @deprecated As using a depreciated constant */
3909
public void testCamelCaseTypePattern13() throws CoreException {
3910
	workingCopies = new ICompilationUnit[1];
3911
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3912
		"class Null {}\n" + 
3913
		"class NULL {}\n" + 
3914
		"class NullPointerException {}\n" + 
3915
		"class NULLPointerException {}\n" + 
3916
		"class NULLPOINTERException {}\n" + 
3917
		"class NULLPOINTEREXCEPTION {}\n"
3918
	);
3919
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
3920
	assertSearchResults(
3921
		"src/Test.java Null [Null]\n" + 
3922
		"src/Test.java NULL [NULL]\n" + 
3923
		"src/Test.java NullPointerException [NullPointerException]\n" + 
3924
		"src/Test.java NULLPointerException [NULLPointerException]\n" + 
3925
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" + 
3926
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3927
	);
3928
}
3929
public void testCamelCaseTypePattern14() throws CoreException {
3930
	workingCopies = new ICompilationUnit[1];
3931
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3932
		"class Null {}\n" + 
3933
		"class NULL {}\n" + 
3934
		"class NullPointerException {}\n" + 
3935
		"class NULLPointerException {}\n" + 
3936
		"class NULLPOINTERException {}\n" + 
3937
		"class NULLPOINTEREXCEPTION {}\n"
3938
	);
3939
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
3940
	assertSearchResults(
3941
		"src/Test.java Null [Null]\n" +
3942
		"src/Test.java NULL [NULL]"
3943
	);
3944
}
3945
public void testCamelCaseTypePattern15() throws CoreException {
3946
	workingCopies = new ICompilationUnit[1];
3947
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3948
		"class Null {}\n" + 
3949
		"class NULL {}\n" + 
3950
		"class NullPointerException {}\n" + 
3951
		"class NULLPointerException {}\n" + 
3952
		"class NULLPOINTERException {}\n" + 
3953
		"class NULLPOINTEREXCEPTION {}\n"
3954
	);
3955
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH);
3956
	assertSearchResults(
3957
		"src/Test.java Null [Null]\n" +
3958
		"src/Test.java NULL [NULL]\n" +
3959
		"src/Test.java NullPointerException [NullPointerException]\n" +
3960
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3961
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3962
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3963
	);
3964
}
3965
public void testCamelCaseTypePattern16() throws CoreException {
3966
	workingCopies = new ICompilationUnit[1];
3967
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3968
		"class Null {}\n" + 
3969
		"class NULL {}\n" + 
3970
		"class NullPointerException {}\n" + 
3971
		"class NULLPointerException {}\n" + 
3972
		"class NULLPOINTERException {}\n" + 
3973
		"class NULLPOINTEREXCEPTION {}\n"
3974
	);
3975
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
3976
	assertSearchResults(
3977
		"src/Test.java Null [Null]"
3978
	);
3979
}
3980
public void testCamelCaseTypePattern17() throws CoreException {
3981
	workingCopies = new ICompilationUnit[1];
3982
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3983
		"class Null {}\n" + 
3984
		"class NULL {}\n" + 
3985
		"class NullPointerException {}\n" + 
3986
		"class NULLPointerException {}\n" + 
3987
		"class NULLPOINTERException {}\n" + 
3988
		"class NULLPOINTEREXCEPTION {}\n"
3989
	);
3990
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
3991
	assertSearchResults(
3992
		"src/Test.java Null [Null]\n" +
3993
		"src/Test.java NullPointerException [NullPointerException]"
3994
	);
3995
}
3841
3996
3842
/**
3997
/**
3843
 * @bug 160323: [search] TypeNameMatch: support hashCode/equals
3998
 * @bug 160323: [search] TypeNameMatch: support hashCode/equals
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (-482 / +714 lines)
Lines 103-120 Link Here
103
	}
103
	}
104
	return getWorkingCopy(path, source, this.wcOwner);
104
	return getWorkingCopy(path, source, this.wcOwner);
105
}
105
}
106
protected void search(IJavaElement element, int limitTo) throws CoreException {
107
	search(element, limitTo, EXACT_RULE, getJavaSearchScope(), resultCollector);
108
}
109
protected void search(IJavaElement element, int limitTo, int matchRule) throws CoreException {
110
	search(element, limitTo, matchRule, getJavaSearchScope(), resultCollector);
111
}
112
protected void search(String patternString, int searchFor, int limitTo) throws CoreException {
113
	search(patternString, searchFor, limitTo, EXACT_RULE, getJavaSearchScope(), resultCollector);
114
}
115
protected void search(String patternString, int searchFor, int limitTo, int matchRule) throws CoreException {
116
	search(patternString, searchFor, limitTo, matchRule, getJavaSearchScope(), resultCollector);
117
}
118
/* (non-Javadoc)
106
/* (non-Javadoc)
119
 * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#setUpSuite()
107
 * @see org.eclipse.jdt.core.tests.model.SuiteOfTestCases#setUpSuite()
120
 */
108
 */
Lines 4731-4737 Link Here
4731
		"interface IDocumentExtension315 {}\n"
4719
		"interface IDocumentExtension315 {}\n"
4732
	);
4720
	);
4733
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4721
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4734
	int validatedRule = SearchPattern.validateMatchRule("IDE3", SearchPattern.R_CAMELCASE_MATCH);
4722
	int validatedRule = SearchPattern.validateMatchRule("IDE3", SearchPattern.R_CAMEL_CASE_MATCH);
4735
	searchAllTypeNames("IDE3", validatedRule, requestor);
4723
	searchAllTypeNames("IDE3", validatedRule, requestor);
4736
	assertSearchResults(
4724
	assertSearchResults(
4737
		"IDocumentExtension135\n" + 
4725
		"IDocumentExtension135\n" + 
Lines 4752-4758 Link Here
4752
		"interface IDocumentProviderExtension54321 {}\n"
4740
		"interface IDocumentProviderExtension54321 {}\n"
4753
	);
4741
	);
4754
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4742
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4755
	int validatedRule = SearchPattern.validateMatchRule("IDPE3", SearchPattern.R_CAMELCASE_MATCH);
4743
	int validatedRule = SearchPattern.validateMatchRule("IDPE3", SearchPattern.R_CAMEL_CASE_MATCH);
4756
	searchAllTypeNames("IDPE3", validatedRule, requestor);
4744
	searchAllTypeNames("IDPE3", validatedRule, requestor);
4757
	assertSearchResults(
4745
	assertSearchResults(
4758
		"IDocumentProviderExtension12345\n" + 
4746
		"IDocumentProviderExtension12345\n" + 
Lines 4769-4775 Link Here
4769
		"interface IPerspectiveListener3 {}\n"
4757
		"interface IPerspectiveListener3 {}\n"
4770
	);
4758
	);
4771
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4759
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4772
	int validatedRule = SearchPattern.validateMatchRule("IPL3", SearchPattern.R_CAMELCASE_MATCH);
4760
	int validatedRule = SearchPattern.validateMatchRule("IPL3", SearchPattern.R_CAMEL_CASE_MATCH);
4773
	searchAllTypeNames("IPL3", validatedRule, requestor);
4761
	searchAllTypeNames("IPL3", validatedRule, requestor);
4774
	assertSearchResults(
4762
	assertSearchResults(
4775
		"IPerspectiveListener3",
4763
		"IPerspectiveListener3",
Lines 4783-4789 Link Here
4783
		"interface IPropertySource2 {}\n"
4771
		"interface IPropertySource2 {}\n"
4784
	);
4772
	);
4785
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4773
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4786
	int validatedRule = SearchPattern.validateMatchRule("IPS2", SearchPattern.R_CAMELCASE_MATCH);
4774
	int validatedRule = SearchPattern.validateMatchRule("IPS2", SearchPattern.R_CAMEL_CASE_MATCH);
4787
	searchAllTypeNames("IPS2", validatedRule, requestor);
4775
	searchAllTypeNames("IPS2", validatedRule, requestor);
4788
	assertSearchResults(
4776
	assertSearchResults(
4789
		"IPropertySource2",
4777
		"IPropertySource2",
Lines 4800-4806 Link Here
4800
		"interface IWorkbenchWindowPulldownDelegate4 {}\n"
4788
		"interface IWorkbenchWindowPulldownDelegate4 {}\n"
4801
	);
4789
	);
4802
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4790
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4803
	int validatedRule = SearchPattern.validateMatchRule("IWWPD2", SearchPattern.R_CAMELCASE_MATCH);
4791
	int validatedRule = SearchPattern.validateMatchRule("IWWPD2", SearchPattern.R_CAMEL_CASE_MATCH);
4804
	searchAllTypeNames("IWWPD2", validatedRule, requestor);
4792
	searchAllTypeNames("IWWPD2", validatedRule, requestor);
4805
	assertSearchResults(
4793
	assertSearchResults(
4806
		"IWorkbenchWindowPulldownDelegate2",
4794
		"IWorkbenchWindowPulldownDelegate2",
Lines 4816-4822 Link Here
4816
		"class UTFDocScannerSupport {}\n"
4804
		"class UTFDocScannerSupport {}\n"
4817
	);
4805
	);
4818
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4806
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4819
	int validatedRule = SearchPattern.validateMatchRule("UTF16DSS", SearchPattern.R_CAMELCASE_MATCH);
4807
	int validatedRule = SearchPattern.validateMatchRule("UTF16DSS", SearchPattern.R_CAMEL_CASE_MATCH);
4820
	searchAllTypeNames("UTF16DSS", validatedRule, requestor);
4808
	searchAllTypeNames("UTF16DSS", validatedRule, requestor);
4821
	assertSearchResults(
4809
	assertSearchResults(
4822
		"UTF16DocumentScannerSupport",
4810
		"UTF16DocumentScannerSupport",
Lines 4832-4838 Link Here
4832
		"class UTFDocScannerSupport {}\n"
4820
		"class UTFDocScannerSupport {}\n"
4833
	);
4821
	);
4834
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4822
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4835
	int validatedRule = SearchPattern.validateMatchRule("UTF1DSS", SearchPattern.R_CAMELCASE_MATCH);
4823
	int validatedRule = SearchPattern.validateMatchRule("UTF1DSS", SearchPattern.R_CAMEL_CASE_MATCH);
4836
	searchAllTypeNames("UTF1DSS", validatedRule, requestor);
4824
	searchAllTypeNames("UTF1DSS", validatedRule, requestor);
4837
	assertSearchResults(
4825
	assertSearchResults(
4838
		"UTF16DocumentScannerSupport\n" + 
4826
		"UTF16DocumentScannerSupport\n" + 
Lines 4849-4855 Link Here
4849
		"class UTFDocScannerSupport {}\n"
4837
		"class UTFDocScannerSupport {}\n"
4850
	);
4838
	);
4851
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4839
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4852
	int validatedRule = SearchPattern.validateMatchRule("UTF6DSS", SearchPattern.R_CAMELCASE_MATCH);
4840
	int validatedRule = SearchPattern.validateMatchRule("UTF6DSS", SearchPattern.R_CAMEL_CASE_MATCH);
4853
	searchAllTypeNames("UTF6DSS", validatedRule, requestor);
4841
	searchAllTypeNames("UTF6DSS", validatedRule, requestor);
4854
	assertSearchResults(
4842
	assertSearchResults(
4855
		"UTF16DocumentScannerSupport\n" + 
4843
		"UTF16DocumentScannerSupport\n" + 
Lines 4866-4872 Link Here
4866
		"class UTFDocScannerSupport {}\n"
4854
		"class UTFDocScannerSupport {}\n"
4867
	);
4855
	);
4868
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4856
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4869
	int validatedRule = SearchPattern.validateMatchRule("UTFDSS", SearchPattern.R_CAMELCASE_MATCH);
4857
	int validatedRule = SearchPattern.validateMatchRule("UTFDSS", SearchPattern.R_CAMEL_CASE_MATCH);
4870
	searchAllTypeNames("UTFDSS", validatedRule, requestor);
4858
	searchAllTypeNames("UTFDSS", validatedRule, requestor);
4871
	assertSearchResults(
4859
	assertSearchResults(
4872
		"UTF16DocumentScannerSupport\n" + 
4860
		"UTF16DocumentScannerSupport\n" + 
Lines 4886-5340 Link Here
4886
 */
4874
 */
4887
// Types search
4875
// Types search
4888
private void setUpBug110060_TypePattern() throws CoreException {
4876
private void setUpBug110060_TypePattern() throws CoreException {
4889
	workingCopies = new ICompilationUnit[5];
4877
	workingCopies = new ICompilationUnit[1];
4890
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java",
4878
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
4891
		"package b110060;\n" +
4892
		"public class AA {\n" +
4893
		"}\n"
4894
	);
4895
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b110060/AAxx.java",
4896
		"package b110060;\n" +
4897
		"public class AAxx {\n" +
4898
		"}\n"
4899
	);
4900
	workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/b110060/AxxAyy.java",
4901
		"package b110060;\n" +
4902
		"public class AxxAyy {\n" +
4903
		"}\n"
4904
	);
4905
	workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/b110060/AxA.java",
4906
		"package b110060;\n" +
4907
		"public class AxA {\n" +
4908
		"}\n"
4909
	);
4910
	workingCopies[4] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
4911
		"package b110060;\n" +
4879
		"package b110060;\n" +
4912
		"public class Test {\n" +
4880
		"public class Test {\n" +
4913
		"	AA aa;\n" +
4881
		"	Aaa a1;\n" +
4914
		"	AAxx aaxx;\n" +
4882
		"	AAa a2;\n" +
4915
		"	AxA axa;\n" +
4883
		"	AaAaAa a3;\n" +
4916
		"	AxxAyy axxayy;\n" +
4884
		"	AAxx a4;\n" +
4917
		"}\n"
4885
		"	AxA a5;\n" +
4886
		"	AxxAyy a6;\n" +
4887
		"}\n" +
4888
		"class AAa {}\n" +
4889
		"class Aaa {}\n" +
4890
		"class AaAaAa {}\n" +
4891
		"class AAxx {}\n" +
4892
		"class AxA {}\n" +
4893
		"class AxxAyy {}\n"
4918
	);
4894
	);
4919
}
4895
}
4896
/** @deprecated As using a depreciated constant */
4920
public void testBug110060_TypePattern01() throws CoreException {
4897
public void testBug110060_TypePattern01() throws CoreException {
4921
	setUpBug110060_TypePattern();
4898
	setUpBug110060_TypePattern();
4922
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4899
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4923
	assertSearchResults(
4900
	assertSearchResults(
4924
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" +
4901
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
4925
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" +
4902
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4926
		"src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" +
4903
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
4927
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4904
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4905
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
4906
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4928
	);
4907
	);
4929
}
4908
}
4930
4909
public void testBug110060_TypePattern01new() throws CoreException {
4910
	setUpBug110060_TypePattern();
4911
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4912
	assertSearchResults(
4913
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4914
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4915
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
4916
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4917
	);
4918
}
4919
/** @deprecated As using a depreciated constant */
4931
public void testBug110060_TypePattern02() throws CoreException {
4920
public void testBug110060_TypePattern02() throws CoreException {
4932
	setUpBug110060_TypePattern();
4921
	setUpBug110060_TypePattern();
4933
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4922
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4934
	assertSearchResults(
4923
	assertSearchResults(
4935
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" +
4924
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
4936
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" +
4925
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4937
		"src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" +
4926
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
4938
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
4927
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4939
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" +
4928
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
4940
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" +
4929
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH\n" + 
4941
		"src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" +
4930
		"src/b110060/Test.java b110060.AAa [AAa] EXACT_MATCH\n" + 
4942
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4931
		"src/b110060/Test.java b110060.Aaa [Aaa] EXACT_MATCH\n" + 
4932
		"src/b110060/Test.java b110060.AaAaAa [AaAaAa] EXACT_MATCH\n" + 
4933
		"src/b110060/Test.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4934
		"src/b110060/Test.java b110060.AxA [AxA] EXACT_MATCH\n" + 
4935
		"src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH"
4943
	);
4936
	);
4944
}
4937
}
4945
4938
public void testBug110060_TypePattern02new() throws CoreException {
4939
	setUpBug110060_TypePattern();
4940
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4941
	assertSearchResults(
4942
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4943
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4944
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
4945
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH\n" + 
4946
		"src/b110060/Test.java b110060.AAa [AAa] EXACT_MATCH\n" + 
4947
		"src/b110060/Test.java b110060.AAxx [AAxx] EXACT_MATCH\n" + 
4948
		"src/b110060/Test.java b110060.AxA [AxA] EXACT_MATCH\n" + 
4949
		"src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH"
4950
	);
4951
}
4952
/** @deprecated As using a depreciated constant */
4946
public void testBug110060_TypePattern03() throws CoreException {
4953
public void testBug110060_TypePattern03() throws CoreException {
4947
	setUpBug110060_TypePattern();
4954
	setUpBug110060_TypePattern();
4948
	search("AAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4955
	search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4949
	assertSearchResults(
4956
	assertSearchResults(
4950
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" +
4957
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
4951
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH"
4952
	);
4958
	);
4953
}
4959
}
4954
4960
public void testBug110060_TypePattern03new() throws CoreException {
4961
	setUpBug110060_TypePattern();
4962
	search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4963
	assertSearchResults(
4964
		"" // no result as camel case does not allow prefix match
4965
	);
4966
}
4967
/** @deprecated As using a depreciated constant */
4955
public void testBug110060_TypePattern04() throws CoreException {
4968
public void testBug110060_TypePattern04() throws CoreException {
4956
	setUpBug110060_TypePattern();
4969
	setUpBug110060_TypePattern();
4957
	search("Axx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4970
	search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4958
	assertSearchResults(
4971
	assertSearchResults(
4959
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
4972
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4960
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4961
	);
4973
	);
4962
}
4974
}
4963
4975
public void testBug110060_TypePattern04new() throws CoreException {
4976
	setUpBug110060_TypePattern();
4977
	search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4978
	assertSearchResults(
4979
		"" // no result as camel case does not allow prefix match
4980
	);
4981
}
4982
/** @deprecated As using a depreciated constant */
4964
public void testBug110060_TypePattern05() throws CoreException {
4983
public void testBug110060_TypePattern05() throws CoreException {
4965
	setUpBug110060_TypePattern();
4984
	setUpBug110060_TypePattern();
4966
	search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4985
	search("Ax", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4967
	assertSearchResults(
4986
	assertSearchResults(
4968
		"src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" +
4987
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
4969
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
4988
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4970
		"src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" +
4971
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
4972
	);
4989
	);
4973
}
4990
}
4974
4991
public void testBug110060_TypePattern05new() throws CoreException {
4992
	setUpBug110060_TypePattern();
4993
	search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4994
	assertSearchResults(
4995
		"" // no result as camel case does not allow prefix match
4996
	);
4997
}
4998
/** @deprecated As using a depreciated constant */
4975
public void testBug110060_TypePattern06() throws CoreException {
4999
public void testBug110060_TypePattern06() throws CoreException {
4976
	setUpBug110060_TypePattern();
5000
	setUpBug110060_TypePattern();
4977
	search("A*A*", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5001
	search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4978
	assertSearchResults(
5002
	assertSearchResults(
4979
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" +
5003
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
4980
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" +
5004
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4981
		"src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" +
5005
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
4982
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
5006
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4983
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" +
5007
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
4984
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" +
5008
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4985
		"src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" +
4986
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH\n" +
4987
		""+ getExternalJCLPathString("1.5") + " java.lang.annotation.Annotation EXACT_MATCH"
4988
	);
5009
	);
4989
}
5010
}
4990
5011
public void testBug110060_TypePattern06new() throws CoreException {
5012
	setUpBug110060_TypePattern();
5013
	search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5014
	assertSearchResults(
5015
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5016
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5017
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
5018
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
5019
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
5020
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5021
	);
5022
}
5023
/** @deprecated As using a depreciated constant */
4991
public void testBug110060_TypePattern07() throws CoreException {
5024
public void testBug110060_TypePattern07() throws CoreException {
4992
	setUpBug110060_TypePattern();
5025
	setUpBug110060_TypePattern();
4993
	search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5026
	search("aa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4994
	assertSearchResults("");
5027
	assertSearchResults(
5028
		"" // no result because it's an invalid camel case pattern which is replaced with 
5029
			// prefix case sensitive match bu SearchPatter.validateMatchRule(...) (old behavior)
5030
	);
5031
}
5032
public void testBug110060_TypePattern07new() throws CoreException {
5033
	setUpBug110060_TypePattern();
5034
	search("aa", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5035
	// Not a valid camel case pattern => changed to prefix
5036
	assertSearchResults(
5037
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5038
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5039
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
5040
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
5041
	);
4995
}
5042
}
4996
4997
public void testBug110060_TypePattern08() throws CoreException {
5043
public void testBug110060_TypePattern08() throws CoreException {
4998
	setUpBug110060_TypePattern();
5044
	setUpBug110060_TypePattern();
4999
	search("aa", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH);
5045
	search("aa", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH);
5000
	assertSearchResults(
5046
	assertSearchResults(
5001
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" +
5047
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5002
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" +
5048
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5003
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" +
5049
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
5004
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH"
5050
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
5005
	);
5051
	);
5006
}
5052
}
5007
5008
public void testBug110060_TypePattern09() throws CoreException {
5053
public void testBug110060_TypePattern09() throws CoreException {
5009
	setUpBug110060_TypePattern();
5054
	setUpBug110060_TypePattern();
5010
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
5055
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
5011
	assertSearchResults(
5056
	assertSearchResults(
5012
		"src/b110060/AA.java b110060.AA [AA] EXACT_MATCH\n" +
5057
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5013
		"src/b110060/AAxx.java b110060.AAxx [AAxx] EXACT_MATCH\n" +
5058
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
5014
		"src/b110060/AxA.java b110060.AxA [AxA] EXACT_MATCH\n" +
5059
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
5015
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
5060
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5016
		"src/b110060/Test.java b110060.Test.aa [AA] EXACT_MATCH\n" +
5017
		"src/b110060/Test.java b110060.Test.aaxx [AAxx] EXACT_MATCH\n" +
5018
		"src/b110060/Test.java b110060.Test.axa [AxA] EXACT_MATCH\n" +
5019
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
5020
	);
5061
	);
5021
}
5062
}
5022
5063
/** @deprecated As using a depreciated constant */
5023
public void testBug110060_TypePattern10() throws CoreException {
5064
public void testBug110060_TypePattern10() throws CoreException {
5024
	setUpBug110060_TypePattern();
5065
	setUpBug110060_TypePattern();
5025
	search("AxAx", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5066
	search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5026
	assertSearchResults("");
5067
	assertSearchResults("");
5027
}
5068
}
5028
5069
public void testBug110060_TypePattern10new() throws CoreException {
5070
	setUpBug110060_TypePattern();
5071
	search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5072
	assertSearchResults("");
5073
}
5074
/** @deprecated As using a depreciated constant */
5029
public void testBug110060_TypePattern11() throws CoreException {
5075
public void testBug110060_TypePattern11() throws CoreException {
5030
	setUpBug110060_TypePattern();
5076
	setUpBug110060_TypePattern();
5031
	search("AxxA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5077
	search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5032
	assertSearchResults(
5078
	assertSearchResults(
5033
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
5079
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5034
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
5035
	);
5080
	);
5036
}
5081
}
5037
5082
public void testBug110060_TypePattern11new() throws CoreException {
5083
	setUpBug110060_TypePattern();
5084
	search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5085
	assertSearchResults(
5086
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5087
	);
5088
}
5089
/** @deprecated As using a depreciated constant */
5038
public void testBug110060_TypePattern12() throws CoreException {
5090
public void testBug110060_TypePattern12() throws CoreException {
5039
	setUpBug110060_TypePattern();
5091
	setUpBug110060_TypePattern();
5040
	search("AxXA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5092
	search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5041
	assertSearchResults(
5093
	assertSearchResults(
5042
		"src/b110060/AxxAyy.java b110060.AxxAyy [AxxAyy] EXACT_MATCH\n" +
5094
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5043
		"src/b110060/Test.java b110060.Test.axxayy [AxxAyy] EXACT_MATCH"
5044
	);
5095
	);
5045
}
5096
}
5097
public void testBug110060_TypePattern12new() throws CoreException {
5098
	setUpBug110060_TypePattern();
5099
	search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5100
	assertSearchResults("");
5101
}
5046
5102
5103
// Search all type names requests
5104
/** @deprecated As using a depreciated constant */
5047
public void testBug110060_AllTypeNames01() throws CoreException {
5105
public void testBug110060_AllTypeNames01() throws CoreException {
5048
	setUpBug110060_TypePattern();
5106
	setUpBug110060_TypePattern();
5049
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5107
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5050
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5108
	searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_MATCH, requestor);
5051
		null,
5052
		SearchPattern.R_EXACT_MATCH,
5053
		"AA".toCharArray(),
5054
		SearchPattern.R_CAMELCASE_MATCH,
5055
		TYPE,
5056
		getJavaSearchScope(),
5057
		requestor,
5058
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5059
		null
5060
	);
5061
	assertSearchResults(
5109
	assertSearchResults(
5062
		"Unexpected all type names",
5110
		"Unexpected all type names",
5063
		"b110060.AA\n" +
5111
		"b110060.AAa\n" + 
5064
		"b110060.AAxx\n" +
5112
		"b110060.AAxx\n" + 
5065
		"b110060.AxA\n" +
5113
		"b110060.AaAaAa\n" + 
5114
		"b110060.Aaa\n" + 
5115
		"b110060.AxA\n" + 
5116
		"b110060.AxxAyy",
5117
		requestor);
5118
}
5119
public void testBug110060_AllTypeNames01new() throws CoreException {
5120
	setUpBug110060_TypePattern();
5121
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5122
	searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH, requestor);
5123
	assertSearchResults(
5124
		"Unexpected all type names",
5125
		"b110060.AAa\n" + 
5126
		"b110060.AAxx\n" + 
5127
		"b110060.AxA\n" + 
5066
		"b110060.AxxAyy",
5128
		"b110060.AxxAyy",
5067
		requestor);
5129
		requestor);
5068
}
5130
}
5069
5070
public void testBug110060_AllTypeNames02() throws CoreException {
5131
public void testBug110060_AllTypeNames02() throws CoreException {
5071
	setUpBug110060_TypePattern();
5132
	setUpBug110060_TypePattern();
5072
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5133
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5073
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5134
	searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
5074
		null,
5075
		SearchPattern.R_EXACT_MATCH,
5076
		"AA".toCharArray(),
5077
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH,
5078
		TYPE,
5079
		getJavaSearchScope(),
5080
		requestor,
5081
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5082
		null
5083
	);
5084
	assertSearchResults(
5135
	assertSearchResults(
5085
		"Unexpected all type names",
5136
		"Unexpected all type names",
5086
		"b110060.AA\n" +
5137
		"b110060.AAa\n" + 
5087
		"b110060.AAxx\n" +
5138
		"b110060.AAxx\n" + 
5088
		"b110060.AxA\n" +
5139
		"b110060.AaAaAa\n" + 
5140
		"b110060.Aaa\n" + 
5141
		"b110060.AxA\n" + 
5089
		"b110060.AxxAyy",
5142
		"b110060.AxxAyy",
5090
		requestor);
5143
		requestor);
5091
}
5144
}
5092
5093
public void testBug110060_AllTypeNames03() throws CoreException {
5145
public void testBug110060_AllTypeNames03() throws CoreException {
5094
	setUpBug110060_TypePattern();
5146
	setUpBug110060_TypePattern();
5095
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5147
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5096
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5148
	searchAllTypeNames("AAA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5097
		null,
5098
		SearchPattern.R_EXACT_MATCH,
5099
		"AA".toCharArray(),
5100
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE,
5101
		TYPE,
5102
		getJavaSearchScope(),
5103
		requestor,
5104
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5105
		null
5106
	);
5107
	assertSearchResults(
5149
	assertSearchResults(
5108
		"Unexpected all type names",
5150
		"Unexpected all type names",
5109
		"b110060.AA\n" +
5151
		"b110060.AaAaAa",
5110
		"b110060.AAxx\n" +
5111
		"b110060.AxA\n" +
5112
		"b110060.AxxAyy",
5113
		requestor);
5152
		requestor);
5114
}
5153
}
5115
5116
public void testBug110060_AllTypeNames04() throws CoreException {
5154
public void testBug110060_AllTypeNames04() throws CoreException {
5117
	setUpBug110060_TypePattern();
5155
	setUpBug110060_TypePattern();
5118
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5156
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5119
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5157
	searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5120
		null,
5121
		SearchPattern.R_EXACT_MATCH,
5122
		"AA".toCharArray(),
5123
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
5124
		TYPE,
5125
		getJavaSearchScope(),
5126
		requestor,
5127
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5128
		null
5129
	);
5130
	assertSearchResults(
5158
	assertSearchResults(
5131
		"Unexpected all type names",
5159
		"Unexpected all type names",
5132
		"b110060.AA\n" +
5160
		"b110060.AAa\n" + 
5133
		"b110060.AAxx\n" +
5161
		"b110060.AAxx\n" + 
5134
		"b110060.AxA\n" +
5162
		"b110060.AaAaAa\n" + 
5163
		"b110060.AxA\n" + 
5135
		"b110060.AxxAyy",
5164
		"b110060.AxxAyy",
5136
		requestor);
5165
		requestor);
5137
}
5166
}
5138
5139
public void testBug110060_AllTypeNames05() throws CoreException {
5167
public void testBug110060_AllTypeNames05() throws CoreException {
5140
	setUpBug110060_TypePattern();
5168
	setUpBug110060_TypePattern();
5141
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5169
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5142
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5170
	searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH, requestor);
5143
		null,
5144
		SearchPattern.R_EXACT_MATCH,
5145
		"AA".toCharArray(),
5146
		SearchPattern.R_PREFIX_MATCH,
5147
		TYPE,
5148
		getJavaSearchScope(),
5149
		requestor,
5150
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5151
		null
5152
	);
5153
	assertSearchResults(
5171
	assertSearchResults(
5154
		"Unexpected all type names",
5172
		"Unexpected all type names",
5155
		"b110060.AA\n" +
5173
		"b110060.AAa\n" + 
5156
		"b110060.AAxx",
5174
		"b110060.AAxx\n" + 
5175
		"b110060.AaAaAa\n" + 
5176
		"b110060.Aaa",
5157
		requestor);
5177
		requestor);
5158
}
5178
}
5159
5160
public void testBug110060_AllTypeNames06() throws CoreException {
5179
public void testBug110060_AllTypeNames06() throws CoreException {
5161
	setUpBug110060_TypePattern();
5180
	setUpBug110060_TypePattern();
5162
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5181
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5163
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5182
	searchAllTypeNames("AAA", SearchPattern.R_CASE_SENSITIVE, requestor);
5164
		null,
5165
		SearchPattern.R_EXACT_MATCH,
5166
		"AA".toCharArray(),
5167
		SearchPattern.R_CASE_SENSITIVE,
5168
		TYPE,
5169
		getJavaSearchScope(),
5170
		requestor,
5171
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5172
		null
5173
	);
5174
	assertSearchResults(
5183
	assertSearchResults(
5175
		"Unexpected all type names",
5184
		"Unexpected all type names",
5176
		"b110060.AA",
5185
		"",
5177
		requestor);
5186
		requestor);
5178
}
5187
}
5179
5180
public void testBug110060_AllTypeNames07() throws CoreException {
5188
public void testBug110060_AllTypeNames07() throws CoreException {
5181
	setUpBug110060_TypePattern();
5189
	setUpBug110060_TypePattern();
5182
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5190
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5183
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5191
	searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5184
		null,
5185
		SearchPattern.R_EXACT_MATCH,
5186
		"AA".toCharArray(),
5187
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
5188
		TYPE,
5189
		getJavaSearchScope(),
5190
		requestor,
5191
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5192
		null
5193
	);
5194
	assertSearchResults(
5192
	assertSearchResults(
5195
		"Unexpected all type names",
5193
		"Unexpected all type names",
5196
		"b110060.AA\n" +
5194
		"b110060.AAa\n" + 
5197
		"b110060.AAxx",
5195
		"b110060.AAxx",
5198
		requestor);
5196
		requestor);
5199
}
5197
}
5200
5198
/** @deprecated As using a depreciated constant */
5201
public void testBug110060_AllTypeNames08() throws CoreException {
5199
public void testBug110060_AllTypeNames08() throws CoreException {
5202
	setUpBug110060_TypePattern();
5200
	setUpBug110060_TypePattern();
5203
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5201
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5204
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5202
	searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_MATCH, requestor);
5205
		null,
5206
		SearchPattern.R_EXACT_MATCH,
5207
		"aa".toCharArray(),
5208
		SearchPattern.R_CAMELCASE_MATCH,
5209
		TYPE,
5210
		getJavaSearchScope(),
5211
		requestor,
5212
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5213
		null
5214
	);
5215
	assertSearchResults(
5203
	assertSearchResults(
5216
		"Unexpected all type names",
5204
		"Unexpected all type names",
5217
		"b110060.AA\n" +
5205
		"b110060.AAa\n" + 
5218
		"b110060.AAxx",
5206
		"b110060.AAxx\n" + 
5207
		"b110060.AaAaAa\n" + 
5208
		"b110060.Aaa",
5209
		requestor);
5210
}
5211
public void testBug110060_AllTypeNames08new() throws CoreException {
5212
	setUpBug110060_TypePattern();
5213
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5214
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH, requestor);
5215
	assertSearchResults(
5216
		"Unexpected all type names",
5217
		"", // no match as pattern is not a valid camel case
5219
		requestor);
5218
		requestor);
5220
}
5219
}
5221
5222
public void testBug110060_AllTypeNames09() throws CoreException {
5220
public void testBug110060_AllTypeNames09() throws CoreException {
5223
	setUpBug110060_TypePattern();
5221
	setUpBug110060_TypePattern();
5224
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5222
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5225
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5223
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
5226
		null,
5227
		SearchPattern.R_EXACT_MATCH,
5228
		"aa".toCharArray(),
5229
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH,
5230
		TYPE,
5231
		getJavaSearchScope(),
5232
		requestor,
5233
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5234
		null
5235
	);
5236
	assertSearchResults(
5224
	assertSearchResults(
5237
		"Unexpected all type names",
5225
		"Unexpected all type names",
5238
		"b110060.AA\n" +
5226
		"b110060.AAa\n" + 
5239
		"b110060.AAxx",
5227
		"b110060.AAxx\n" + 
5228
		"b110060.AaAaAa\n" + 
5229
		"b110060.Aaa",
5240
		requestor);
5230
		requestor);
5241
}
5231
}
5242
5243
public void testBug110060_AllTypeNames10() throws CoreException {
5232
public void testBug110060_AllTypeNames10() throws CoreException {
5244
	setUpBug110060_TypePattern();
5233
	setUpBug110060_TypePattern();
5245
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5234
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5246
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5235
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5247
		null,
5248
		SearchPattern.R_EXACT_MATCH,
5249
		"aa".toCharArray(),
5250
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE,
5251
		TYPE,
5252
		getJavaSearchScope(),
5253
		requestor,
5254
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5255
		null
5256
	);
5257
	assertSearchResults(
5236
	assertSearchResults(
5258
		"Unexpected all type names",
5237
		"Unexpected all type names",
5259
		"",
5238
		"", // no match as pattern is not a valid camel case
5260
		requestor);
5239
		requestor);
5261
}
5240
}
5262
5263
public void testBug110060_AllTypeNames11() throws CoreException {
5241
public void testBug110060_AllTypeNames11() throws CoreException {
5264
	setUpBug110060_TypePattern();
5242
	setUpBug110060_TypePattern();
5265
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5243
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5266
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5244
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5267
		null,
5268
		SearchPattern.R_EXACT_MATCH,
5269
		"aa".toCharArray(),
5270
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
5271
		TYPE,
5272
		getJavaSearchScope(),
5273
		requestor,
5274
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5275
		null
5276
	);
5277
	assertSearchResults(
5245
	assertSearchResults(
5278
		"Unexpected all type names",
5246
		"Unexpected all type names",
5279
		"",
5247
		"",
5280
		requestor);
5248
		requestor);
5281
}
5249
}
5282
5283
public void testBug110060_AllTypeNames12() throws CoreException {
5250
public void testBug110060_AllTypeNames12() throws CoreException {
5284
	setUpBug110060_TypePattern();
5251
	setUpBug110060_TypePattern();
5285
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5252
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5286
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5253
	searchAllTypeNames("aa", SearchPattern.R_PREFIX_MATCH, requestor);
5287
		null,
5288
		SearchPattern.R_EXACT_MATCH,
5289
		"aa".toCharArray(),
5290
		SearchPattern.R_PREFIX_MATCH,
5291
		TYPE,
5292
		getJavaSearchScope(),
5293
		requestor,
5294
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5295
		null
5296
	);
5297
	assertSearchResults(
5254
	assertSearchResults(
5298
		"Unexpected all type names",
5255
		"Unexpected all type names",
5299
		"b110060.AA\n" +
5256
		"b110060.AAa\n" + 
5300
		"b110060.AAxx",
5257
		"b110060.AAxx\n" + 
5258
		"b110060.AaAaAa\n" + 
5259
		"b110060.Aaa",
5301
		requestor);
5260
		requestor);
5302
}
5261
}
5303
5304
public void testBug110060_AllTypeNames13() throws CoreException {
5262
public void testBug110060_AllTypeNames13() throws CoreException {
5305
	setUpBug110060_TypePattern();
5263
	setUpBug110060_TypePattern();
5306
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5264
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5307
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5265
	searchAllTypeNames("aa", SearchPattern.R_CASE_SENSITIVE, requestor);
5308
		null,
5309
		SearchPattern.R_EXACT_MATCH,
5310
		"aa".toCharArray(),
5311
		SearchPattern.R_CASE_SENSITIVE,
5312
		TYPE,
5313
		getJavaSearchScope(),
5314
		requestor,
5315
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5316
		null
5317
	);
5318
	assertSearchResults(
5266
	assertSearchResults(
5319
		"Unexpected all type names",
5267
		"Unexpected all type names",
5320
		"",
5268
		"",
5321
		requestor);
5269
		requestor);
5322
}
5270
}
5323
5324
public void testBug110060_AllTypeNames14() throws CoreException {
5271
public void testBug110060_AllTypeNames14() throws CoreException {
5325
	setUpBug110060_TypePattern();
5272
	setUpBug110060_TypePattern();
5326
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5273
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5327
	new SearchEngine(this.workingCopies).searchAllTypeNames(
5274
	searchAllTypeNames("aa", SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5328
		null,
5329
		SearchPattern.R_EXACT_MATCH,
5330
		"aa".toCharArray(),
5331
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
5332
		TYPE,
5333
		getJavaSearchScope(),
5334
		requestor,
5335
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
5336
		null
5337
	);
5338
	assertSearchResults(
5275
	assertSearchResults(
5339
		"Unexpected all type names",
5276
		"Unexpected all type names",
5340
		"",
5277
		"",
Lines 5380-5386 Link Here
5380
}
5317
}
5381
public void testBug110060_ConstructorPattern01() throws CoreException {
5318
public void testBug110060_ConstructorPattern01() throws CoreException {
5382
	setUpBug110060_ConstructorPattern();
5319
	setUpBug110060_ConstructorPattern();
5383
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5320
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5384
	assertSearchResults(
5321
	assertSearchResults(
5385
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" +
5322
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" +
5386
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5323
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
Lines 5388-5397 Link Here
5388
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5325
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5389
	);
5326
	);
5390
}
5327
}
5391
5392
public void testBug110060_ConstructorPattern02() throws CoreException {
5328
public void testBug110060_ConstructorPattern02() throws CoreException {
5393
	setUpBug110060_ConstructorPattern();
5329
	setUpBug110060_ConstructorPattern();
5394
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5330
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5395
	assertSearchResults(
5331
	assertSearchResults(
5396
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" +
5332
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" +
5397
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5333
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
Lines 5403-5441 Link Here
5403
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5339
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5404
	);
5340
	);
5405
}
5341
}
5406
5407
public void testBug110060_ConstructorPattern03() throws CoreException {
5342
public void testBug110060_ConstructorPattern03() throws CoreException {
5408
	setUpBug110060_ConstructorPattern();
5343
	setUpBug110060_ConstructorPattern();
5409
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5344
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5410
	assertSearchResults(
5345
	assertSearchResults(
5411
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5346
		"" // no match as prefix is not set
5412
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH"
5413
	);
5347
	);
5414
}
5348
}
5415
5416
public void testBug110060_ConstructorPattern04() throws CoreException {
5349
public void testBug110060_ConstructorPattern04() throws CoreException {
5417
	setUpBug110060_ConstructorPattern();
5350
	setUpBug110060_ConstructorPattern();
5418
	search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5351
	search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5419
	assertSearchResults(
5352
	assertSearchResults(
5420
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5353
		"" // no match as prefix is not set
5421
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5422
	);
5354
	);
5423
}
5355
}
5424
5425
public void testBug110060_ConstructorPattern05() throws CoreException {
5356
public void testBug110060_ConstructorPattern05() throws CoreException {
5426
	setUpBug110060_ConstructorPattern();
5357
	setUpBug110060_ConstructorPattern();
5427
	search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5358
	search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5428
	assertSearchResults(
5359
	assertSearchResults(
5429
		"src/b110060/AxA.java b110060.AxA() [AxA] EXACT_MATCH\n" +
5360
		"" // no match as prefix is not set
5430
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5431
		"src/b110060/Test.java b110060.Test.axa [new AxA()] EXACT_MATCH\n" +
5432
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5433
	);
5361
	);
5434
}
5362
}
5435
5436
public void testBug110060_ConstructorPattern06() throws CoreException {
5363
public void testBug110060_ConstructorPattern06() throws CoreException {
5437
	setUpBug110060_ConstructorPattern();
5364
	setUpBug110060_ConstructorPattern();
5438
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5365
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5439
	assertSearchResults(
5366
	assertSearchResults(
5440
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" +
5367
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" +
5441
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5368
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
Lines 5469-5486 Link Here
5469
		"}\n"
5396
		"}\n"
5470
	);
5397
	);
5471
}
5398
}
5399
/** @deprecated As using a depreciated constant */
5472
public void testBug110060_MethodPattern01() throws CoreException {
5400
public void testBug110060_MethodPattern01() throws CoreException {
5473
	setUpBug110060_MethodPattern();
5401
	setUpBug110060_MethodPattern();
5474
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5402
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5475
	assertSearchResults("");
5403
	assertSearchResults("");
5476
}
5404
}
5477
5405
public void testBug110060_MethodPattern01new() throws CoreException {
5478
public void testBug110060_MethodPattern02() throws CoreException {
5406
	setUpBug110060_MethodPattern();
5407
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5408
	assertSearchResults("");
5409
}
5410
/** @deprecated As using a depreciated constant */
5411
public void testBug110060_MethodPattern02() throws CoreException {
5479
	setUpBug110060_MethodPattern();
5412
	setUpBug110060_MethodPattern();
5480
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5413
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5481
	assertSearchResults("");
5414
	assertSearchResults("");
5482
}
5415
}
5483
5416
public void testBug110060_MethodPattern02new() throws CoreException {
5417
	setUpBug110060_MethodPattern();
5418
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5419
	assertSearchResults("");
5420
}
5421
/** @deprecated As using a depreciated constant */
5484
public void testBug110060_MethodPattern03() throws CoreException {
5422
public void testBug110060_MethodPattern03() throws CoreException {
5485
	setUpBug110060_MethodPattern();
5423
	setUpBug110060_MethodPattern();
5486
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5424
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5491-5497 Link Here
5491
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5429
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5492
	);
5430
	);
5493
}
5431
}
5494
5432
public void testBug110060_MethodPattern03new() throws CoreException {
5433
	setUpBug110060_MethodPattern();
5434
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5435
	assertSearchResults(
5436
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5437
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH"
5438
	);
5439
}
5440
/** @deprecated As using a depreciated constant */
5495
public void testBug110060_MethodPattern04() throws CoreException {
5441
public void testBug110060_MethodPattern04() throws CoreException {
5496
	setUpBug110060_MethodPattern();
5442
	setUpBug110060_MethodPattern();
5497
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5443
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5506-5512 Link Here
5506
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5452
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5507
	);
5453
	);
5508
}
5454
}
5509
5455
public void testBug110060_MethodPattern04new() throws CoreException {
5456
	setUpBug110060_MethodPattern();
5457
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5458
	assertSearchResults(
5459
		"" // no result as prefix match is not set
5460
	);
5461
}
5462
/** @deprecated As using a depreciated constant */
5510
public void testBug110060_MethodPattern05() throws CoreException {
5463
public void testBug110060_MethodPattern05() throws CoreException {
5511
	setUpBug110060_MethodPattern();
5464
	setUpBug110060_MethodPattern();
5512
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5465
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5521-5527 Link Here
5521
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5474
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5522
	);
5475
	);
5523
}
5476
}
5524
5477
public void testBug110060_MethodPattern05new() throws CoreException {
5478
	setUpBug110060_MethodPattern();
5479
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5480
	assertSearchResults(
5481
		"" // no result as prefix match is not set
5482
	);
5483
}
5484
/** @deprecated As using a depreciated constant */
5525
public void testBug110060_MethodPattern06() throws CoreException {
5485
public void testBug110060_MethodPattern06() throws CoreException {
5526
	setUpBug110060_MethodPattern();
5486
	setUpBug110060_MethodPattern();
5527
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5487
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5534-5540 Link Here
5534
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5494
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5535
	);
5495
	);
5536
}
5496
}
5537
5497
public void testBug110060_MethodPattern06new() throws CoreException {
5498
	setUpBug110060_MethodPattern();
5499
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5500
	assertSearchResults(
5501
		"" // no result as prefix match is not set
5502
	);
5503
}
5504
/** @deprecated As using a depreciated constant */
5538
public void testBug110060_MethodPattern07() throws CoreException {
5505
public void testBug110060_MethodPattern07() throws CoreException {
5539
	setUpBug110060_MethodPattern();
5506
	setUpBug110060_MethodPattern();
5540
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5507
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5549-5555 Link Here
5549
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5516
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5550
	);
5517
	);
5551
}
5518
}
5552
5519
public void testBug110060_MethodPattern07new() throws CoreException {
5520
	setUpBug110060_MethodPattern();
5521
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5522
	assertSearchResults(
5523
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" +
5524
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" +
5525
		"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" +
5526
		"src/b110060/Test.java void b110060.Test.otherMethodWhichStartsWithAnotherLetter() [otherMethodWhichStartsWithAnotherLetter] EXACT_MATCH\n" +
5527
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH\n" +
5528
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH\n" +
5529
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH\n" +
5530
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5531
	);
5532
}
5533
/** @deprecated As using a depreciated constant */
5553
public void testBug110060_MethodPattern08() throws CoreException {
5534
public void testBug110060_MethodPattern08() throws CoreException {
5554
	setUpBug110060_MethodPattern();
5535
	setUpBug110060_MethodPattern();
5555
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5536
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5560-5566 Link Here
5560
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5541
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5561
	);
5542
	);
5562
}
5543
}
5563
5544
public void testBug110060_MethodPattern08new() throws CoreException {
5545
	setUpBug110060_MethodPattern();
5546
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5547
	assertSearchResults(
5548
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5549
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH"
5550
	);
5551
}
5552
/** @deprecated As using a depreciated constant */
5564
public void testBug110060_MethodPattern09() throws CoreException {
5553
public void testBug110060_MethodPattern09() throws CoreException {
5565
	setUpBug110060_MethodPattern();
5554
	setUpBug110060_MethodPattern();
5566
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5555
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5569-5574 Link Here
5569
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5558
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5570
	);
5559
	);
5571
}
5560
}
5561
public void testBug110060_MethodPattern09new() throws CoreException {
5562
	setUpBug110060_MethodPattern();
5563
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5564
	assertSearchResults(
5565
		"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" +
5566
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5567
	);
5568
}
5572
5569
5573
// Fields search
5570
// Fields search
5574
private void setUpBug110060_FieldPattern() throws CoreException {
5571
private void setUpBug110060_FieldPattern() throws CoreException {
Lines 5591-5596 Link Here
5591
		"}\n"
5588
		"}\n"
5592
	);
5589
	);
5593
}
5590
}
5591
/** @deprecated As using a depreciated constant */
5594
public void testBug110060_FieldPattern01() throws CoreException {
5592
public void testBug110060_FieldPattern01() throws CoreException {
5595
	setUpBug110060_FieldPattern();
5593
	setUpBug110060_FieldPattern();
5596
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5594
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5601-5613 Link Here
5601
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH"
5599
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH"
5602
	);
5600
	);
5603
}
5601
}
5604
5602
public void testBug110060_FieldPattern01new() throws CoreException {
5603
	setUpBug110060_FieldPattern();
5604
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5605
	assertSearchResults(
5606
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5607
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5608
	);
5609
}
5610
/** @deprecated As using a depreciated constant */
5605
public void testBug110060_FieldPattern02() throws CoreException {
5611
public void testBug110060_FieldPattern02() throws CoreException {
5606
	setUpBug110060_FieldPattern();
5612
	setUpBug110060_FieldPattern();
5607
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5613
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5608
	assertSearchResults("");
5614
	assertSearchResults("");
5609
}
5615
}
5610
5616
public void testBug110060_FieldPattern02new() throws CoreException {
5617
	setUpBug110060_FieldPattern();
5618
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5619
	assertSearchResults("");
5620
}
5621
/** @deprecated As using a depreciated constant */
5611
public void testBug110060_FieldPattern03() throws CoreException {
5622
public void testBug110060_FieldPattern03() throws CoreException {
5612
	setUpBug110060_FieldPattern();
5623
	setUpBug110060_FieldPattern();
5613
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5624
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5616-5622 Link Here
5616
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5627
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5617
	);
5628
	);
5618
}
5629
}
5619
5630
public void testBug110060_FieldPattern03new() throws CoreException {
5631
	setUpBug110060_FieldPattern();
5632
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5633
	assertSearchResults(
5634
		"" // no result as prefix match is not set
5635
	);
5636
}
5637
/** @deprecated As using a depreciated constant */
5620
public void testBug110060_FieldPattern04() throws CoreException {
5638
public void testBug110060_FieldPattern04() throws CoreException {
5621
	setUpBug110060_FieldPattern();
5639
	setUpBug110060_FieldPattern();
5622
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5640
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5625-5631 Link Here
5625
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5643
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5626
	);
5644
	);
5627
}
5645
}
5628
5646
public void testBug110060_FieldPattern04new() throws CoreException {
5647
	setUpBug110060_FieldPattern();
5648
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5649
	assertSearchResults(
5650
		"src/b110060/Test.java b110060.Test.aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH\n" +
5651
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5652
	);
5653
}
5654
/** @deprecated As using a depreciated constant */
5629
public void testBug110060_FieldPattern05() throws CoreException {
5655
public void testBug110060_FieldPattern05() throws CoreException {
5630
	setUpBug110060_FieldPattern();
5656
	setUpBug110060_FieldPattern();
5631
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5657
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5635-5640 Link Here
5635
		"src/b110060/Test.java b110060.Test.oF [otherFieldWhichStartsWithAnotherLetter] EXACT_MATCH"
5661
		"src/b110060/Test.java b110060.Test.oF [otherFieldWhichStartsWithAnotherLetter] EXACT_MATCH"
5636
	);
5662
	);
5637
}
5663
}
5664
public void testBug110060_FieldPattern05new() throws CoreException {
5665
	setUpBug110060_FieldPattern();
5666
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5667
	assertSearchResults(
5668
		"src/b110060/Test.java b110060.Test.oF [oF] EXACT_MATCH"
5669
	);
5670
}
5638
5671
5639
/**
5672
/**
5640
 * @test Bug 110291: [search] BasicSearchEngine return constructor declarations that doesn't exist in source
5673
 * @test Bug 110291: [search] BasicSearchEngine return constructor declarations that doesn't exist in source
Lines 6418-6423 Link Here
6418
}
6451
}
6419
6452
6420
/**
6453
/**
6454
 *	@bug 124624: [search] Camel case matching routines should support end character
6455
 *	@test Ensure that camel case pattern may use end character
6456
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624"
6457
 */
6458
public void testBug124624_HM_new() throws CoreException {
6459
	workingCopies = new ICompilationUnit[1];
6460
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6461
		"class HashMap {}\n" + 
6462
		"class HtmlMapper {}\n" + 
6463
		"class HashMapEntry {}\n" + 
6464
		"class HatMappage {}\n"
6465
	);
6466
	search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6467
	assertSearchResults(
6468
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6469
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6470
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6471
	);
6472
}
6473
/** @deprecated As using a depreciated constant */
6474
public void testBug124624_HM_old() throws CoreException {
6475
	workingCopies = new ICompilationUnit[1];
6476
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6477
		"class HashMap {}\n" + 
6478
		"class HtmlMapper {}\n" + 
6479
		"class HashMapEntry {}\n" + 
6480
		"class HatMappage {}\n"
6481
	);
6482
	search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6483
	assertSearchResults(
6484
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6485
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6486
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6487
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6488
	);
6489
}
6490
public void testBug124624_HaM_new() throws CoreException {
6491
	workingCopies = new ICompilationUnit[1];
6492
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6493
		"class HashMap {}\n" + 
6494
		"class HtmlMapper {}\n" + 
6495
		"class HashMapEntry {}\n" + 
6496
		"class HatMappage {}\n"
6497
	);
6498
	search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6499
	assertSearchResults(
6500
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6501
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6502
	);
6503
}
6504
/** @deprecated As using a depreciated constant */
6505
public void testBug124624_HaM_old() throws CoreException {
6506
	workingCopies = new ICompilationUnit[1];
6507
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6508
		"class HashMap {}\n" + 
6509
		"class HtmlMapper {}\n" + 
6510
		"class HashMapEntry {}\n" + 
6511
		"class HatMappage {}\n"
6512
	);
6513
	search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6514
	assertSearchResults(
6515
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6516
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6517
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6518
	);
6519
}
6520
public void testBug124624_HashM_new() throws CoreException {
6521
	workingCopies = new ICompilationUnit[1];
6522
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6523
		"class HashMap {}\n" + 
6524
		"class HtmlMapper {}\n" + 
6525
		"class HashMapEntry {}\n" + 
6526
		"class HatMappage {}\n"
6527
	);
6528
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6529
	assertSearchResults(
6530
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6531
	);
6532
}
6533
/** @deprecated As using a depreciated constant */
6534
public void testBug124624_HashM_old() throws CoreException {
6535
	workingCopies = new ICompilationUnit[1];
6536
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6537
		"class HashMap {}\n" + 
6538
		"class HtmlMapper {}\n" + 
6539
		"class HashMapEntry {}\n" + 
6540
		"class HatMappage {}\n"
6541
	);
6542
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6543
	assertSearchResults(
6544
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6545
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6546
	);
6547
}
6548
public void testBug124624_HMa_new() throws CoreException {
6549
	workingCopies = new ICompilationUnit[1];
6550
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6551
		"class HashMap {}\n" + 
6552
		"class HtmlMapper {}\n" + 
6553
		"class HashMapEntry {}\n" + 
6554
		"class HatMappage {}\n"
6555
	);
6556
	search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6557
	assertSearchResults("");
6558
}
6559
/** @deprecated As using a depreciated constant */
6560
public void testBug124624_HMa_old() throws CoreException {
6561
	workingCopies = new ICompilationUnit[1];
6562
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6563
		"class HashMap {}\n" + 
6564
		"class HtmlMapper {}\n" + 
6565
		"class HashMapEntry {}\n" + 
6566
		"class HatMappage {}\n"
6567
	);
6568
	search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6569
	assertSearchResults(
6570
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6571
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6572
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6573
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6574
	);
6575
}
6576
public void testBug124624_HaMa_new() throws CoreException {
6577
	workingCopies = new ICompilationUnit[1];
6578
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6579
		"class HashMap {}\n" + 
6580
		"class HtmlMapper {}\n" + 
6581
		"class HashMapEntry {}\n" + 
6582
		"class HatMappage {}\n"
6583
	);
6584
	search("HaMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6585
	assertSearchResults("");
6586
}
6587
/** @deprecated As using a depreciated constant */
6588
public void testBug124624_HaMa_old() throws CoreException {
6589
	workingCopies = new ICompilationUnit[1];
6590
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6591
		"class HashMap {}\n" + 
6592
		"class HtmlMapper {}\n" + 
6593
		"class HashMapEntry {}\n" + 
6594
		"class HatMappage {}\n"
6595
	);
6596
	search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6597
	assertSearchResults(
6598
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6599
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6600
	);
6601
}
6602
public void testBug124624_HashMa_new() throws CoreException {
6603
	workingCopies = new ICompilationUnit[1];
6604
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6605
		"class HashMap {}\n" + 
6606
		"class HtmlMapper {}\n" + 
6607
		"class HashMapEntry {}\n" + 
6608
		"class HatMappage {}\n"
6609
	);
6610
	search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6611
	assertSearchResults("");
6612
}
6613
/** @deprecated As using a depreciated constant */
6614
public void testBug124624_HashMa_old() throws CoreException {
6615
	workingCopies = new ICompilationUnit[1];
6616
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6617
		"class HashMap {}\n" + 
6618
		"class HtmlMapper {}\n" + 
6619
		"class HashMapEntry {}\n" + 
6620
		"class HatMappage {}\n"
6621
	);
6622
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6623
	assertSearchResults(
6624
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6625
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6626
	);
6627
}
6628
public void testBug124624_HMap_new() throws CoreException {
6629
	workingCopies = new ICompilationUnit[1];
6630
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6631
		"class HashMap {}\n" + 
6632
		"class HtmlMapper {}\n" + 
6633
		"class HashMapEntry {}\n" + 
6634
		"class HatMappage {}\n"
6635
	);
6636
	search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6637
	assertSearchResults(
6638
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6639
	);
6640
}
6641
/** @deprecated As using a depreciated constant */
6642
public void testBug124624_HMap_old() throws CoreException {
6643
	workingCopies = new ICompilationUnit[1];
6644
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6645
		"class HashMap {}\n" + 
6646
		"class HtmlMapper {}\n" + 
6647
		"class HashMapEntry {}\n" + 
6648
		"class HatMappage {}\n"
6649
	);
6650
	search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6651
	assertSearchResults(
6652
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6653
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6654
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6655
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6656
	);
6657
}
6658
public void testBug124624_HaMap_new() throws CoreException {
6659
	workingCopies = new ICompilationUnit[1];
6660
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6661
		"class HashMap {}\n" + 
6662
		"class HtmlMapper {}\n" + 
6663
		"class HashMapEntry {}\n" + 
6664
		"class HatMappage {}\n"
6665
	);
6666
	search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6667
	assertSearchResults(
6668
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6669
	);
6670
}
6671
/** @deprecated As using a depreciated constant */
6672
public void testBug124624_HaMap_old() throws CoreException {
6673
	workingCopies = new ICompilationUnit[1];
6674
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6675
		"class HashMap {}\n" + 
6676
		"class HtmlMapper {}\n" + 
6677
		"class HashMapEntry {}\n" + 
6678
		"class HatMappage {}\n"
6679
	);
6680
	search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6681
	assertSearchResults(
6682
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6683
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6684
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6685
	);
6686
}
6687
public void testBug124624_HashMap_new() throws CoreException {
6688
	workingCopies = new ICompilationUnit[1];
6689
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6690
		"class HashMap {}\n" + 
6691
		"class HtmlMapper {}\n" + 
6692
		"class HashMapEntry {}\n" + 
6693
		"class HatMappage {}\n"
6694
	);
6695
	search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6696
	assertSearchResults(
6697
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6698
	);
6699
}
6700
/** @deprecated As using a depreciated constant */
6701
public void testBug124624_HashMap_old() throws CoreException {
6702
	workingCopies = new ICompilationUnit[1];
6703
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6704
		"class HashMap {}\n" + 
6705
		"class HtmlMapper {}\n" + 
6706
		"class HashMapEntry {}\n" + 
6707
		"class HatMappage {}\n"
6708
	);
6709
	search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6710
	assertSearchResults(
6711
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6712
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6713
	);
6714
}
6715
6716
/**
6421
 * @test Bug 124645: [search] for implementors does not find subclasses of binary classes
6717
 * @test Bug 124645: [search] for implementors does not find subclasses of binary classes
6422
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124645"
6718
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124645"
6423
 */
6719
 */
Lines 6610-6615 Link Here
6610
		"}\n"
6906
		"}\n"
6611
	);
6907
	);
6612
}
6908
}
6909
/** @deprecated As using a depreciated constant */
6613
public void testBug130390() throws CoreException {
6910
public void testBug130390() throws CoreException {
6614
	setUpBug130390();
6911
	setUpBug130390();
6615
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6912
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
Lines 6617-6622 Link Here
6617
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6914
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6618
	);
6915
	);
6619
}
6916
}
6917
public void testBug130390_new() throws CoreException {
6918
	setUpBug130390();
6919
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6920
	assertSearchResults(
6921
		"" // no result as prefix match is not set
6922
	);
6923
}
6924
/** @deprecated As using a depreciated constant */
6620
public void testBug130390b() throws CoreException {
6925
public void testBug130390b() throws CoreException {
6621
	setUpBug130390();
6926
	setUpBug130390();
6622
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6927
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
Lines 6625-6630 Link Here
6625
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6930
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6626
	);
6931
	);
6627
}
6932
}
6933
public void testBug130390b_new() throws CoreException {
6934
	setUpBug130390();
6935
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6936
	assertSearchResults(
6937
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH\n" +
6938
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6939
	);
6940
}
6941
/** @deprecated As using a depreciated constant */
6628
public void testBug130390c() throws CoreException {
6942
public void testBug130390c() throws CoreException {
6629
	setUpBug130390();
6943
	setUpBug130390();
6630
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6944
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
Lines 6632-6637 Link Here
6632
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6946
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6633
	);
6947
	);
6634
}
6948
}
6949
public void testBug130390c_new() throws CoreException {
6950
	setUpBug130390();
6951
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6952
	assertSearchResults(
6953
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6954
	);
6955
}
6956
/** @deprecated As using a depreciated constant */
6635
public void testBug130390d() throws CoreException {
6957
public void testBug130390d() throws CoreException {
6636
	setUpBug130390();
6958
	setUpBug130390();
6637
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6959
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 6639-6644 Link Here
6639
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6961
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6640
	);
6962
	);
6641
}
6963
}
6964
public void testBug130390d_new() throws CoreException {
6965
	setUpBug130390();
6966
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
6967
	assertSearchResults(
6968
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6969
	);
6970
}
6971
/** @deprecated As using a depreciated constant */
6642
public void testBug130390e() throws CoreException {
6972
public void testBug130390e() throws CoreException {
6643
	setUpBug130390();
6973
	setUpBug130390();
6644
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6974
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
Lines 6646-6651 Link Here
6646
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6976
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6647
	);
6977
	);
6648
}
6978
}
6979
public void testBug130390e_new() throws CoreException {
6980
	setUpBug130390();
6981
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6982
	assertSearchResults(
6983
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6984
	);
6985
}
6986
/** @deprecated As using a depreciated constant */
6649
public void testBug130390f() throws CoreException {
6987
public void testBug130390f() throws CoreException {
6650
	setUpBug130390();
6988
	setUpBug130390();
6651
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6989
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 6653-6658 Link Here
6653
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6991
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6654
	);
6992
	);
6655
}
6993
}
6994
public void testBug130390f_new() throws CoreException {
6995
	setUpBug130390();
6996
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
6997
	assertSearchResults(
6998
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6999
	);
7000
}
7001
/** @deprecated As using a depreciated constant */
6656
public void testBug130390g() throws CoreException {
7002
public void testBug130390g() throws CoreException {
6657
	setUpBug130390();
7003
	setUpBug130390();
6658
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
7004
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
Lines 6661-6923 Link Here
6661
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
7007
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6662
	);
7008
	);
6663
}
7009
}
6664
public void testBug130390h() throws CoreException {
7010
public void testBug130390g_new() throws CoreException {
6665
	setUpBug130390();
7011
	setUpBug130390();
6666
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
7012
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6667
	assertSearchResults(
7013
	assertSearchResults(
7014
		"src/b130390/TZ.java b130390.TZ [TZ] EXACT_MATCH\n" +
6668
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
7015
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6669
	);
7016
	);
6670
}
7017
}
7018
public void testBug130390h() throws CoreException {
7019
	setUpBug130390();
7020
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
7021
	assertSearchResults(
7022
		"" // no result as prefix match is not set
7023
	);
7024
}
7025
6671
/**
7026
/**
6672
 * To get these tests search matches in a workspace, do NOT forget to modify files
7027
 * To get these tests search matches in a workspace, do NOT forget to modify files
6673
 * to set them as working copies.
7028
 * to set them as working copies.
6674
 *
7029
 *
6675
 * @test Bug 137087: Open Type - missing matches when using mixed case pattern
7030
 * @bug 137087: Open Type - missing matches when using mixed case pattern
6676
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087"
7031
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087"
7032
 * @deprecated As using a depreciated constant
6677
 */
7033
 */
6678
public void testBug137087() throws CoreException {
7034
public void testBug137087() throws CoreException {
6679
	// Search CamelCase
6680
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7035
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6681
	String pattern = "runtimeEx";
7036
	String pattern = "runtimeEx";
6682
	search(pattern, TYPE, DECLARATIONS, matchRule);
7037
	search(pattern, TYPE, DECLARATIONS, matchRule);
6683
	assertSearchResults(
7038
	assertSearchResults(
6684
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
7039
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6685
	);
7040
	);
6686
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6687
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6688
	if (validatedRule != matchRule) {
6689
		matchRule = SearchPattern.R_PREFIX_MATCH;
6690
	}
6691
	search(pattern, TYPE, DECLARATIONS, matchRule);
6692
	assertSearchResults(
6693
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH\n" +
6694
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6695
	);
6696
}
7041
}
7042
/** @deprecated As using a depreciated constant */
6697
public void testBug137087b() throws CoreException {
7043
public void testBug137087b() throws CoreException {
6698
	// Search CamelCase
6699
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7044
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6700
	String pattern = "Runtimeex";
7045
	String pattern = "Runtimeex";
6701
	search(pattern, TYPE, DECLARATIONS, matchRule);
7046
	search(pattern, TYPE, DECLARATIONS, matchRule);
6702
	assertSearchResults(
7047
	assertSearchResults(
6703
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
7048
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6704
	);
7049
	);
6705
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6706
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6707
	if (validatedRule != matchRule) {
6708
		matchRule = SearchPattern.R_PREFIX_MATCH;
6709
	}
6710
	search(pattern, TYPE, DECLARATIONS, matchRule);
6711
	assertSearchResults(
6712
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH\n" +
6713
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6714
	);
6715
}
7050
}
7051
/** @deprecated As using a depreciated constant */
6716
public void testBug137087c() throws CoreException {
7052
public void testBug137087c() throws CoreException {
6717
	// Search CamelCase
6718
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7053
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6719
	String pattern = "runtimeexception";
7054
	String pattern = "runtimeexception";
6720
	search(pattern, TYPE, DECLARATIONS, matchRule);
7055
	search(pattern, TYPE, DECLARATIONS, matchRule);
6721
	assertSearchResults(
7056
	assertSearchResults(
6722
		"" // no match expected as this is not a valid camel case
7057
		"" // no result because it's an invalid camel case pattern which is replaced with 
6723
	);
7058
			// prefix case sensitive match bu SearchPatter.validateMatchRule(...) (old behavior)
6724
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6725
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6726
	if (validatedRule != matchRule) {
6727
		matchRule = SearchPattern.R_PREFIX_MATCH;
6728
	}
6729
	search(pattern, TYPE, DECLARATIONS, matchRule);
6730
	assertSearchResults(
6731
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6732
	);
7059
	);
6733
}
7060
}
7061
/** @deprecated As using a depreciated constant */
6734
public void testBug137087d() throws CoreException {
7062
public void testBug137087d() throws CoreException {
6735
	// Search CamelCase
6736
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7063
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6737
	String pattern = "Runtimexception";
7064
	String pattern = "Runtimexception";
6738
	search(pattern, TYPE, DECLARATIONS, matchRule);
7065
	search(pattern, TYPE, DECLARATIONS, matchRule);
6739
	assertSearchResults(
7066
	assertSearchResults(
6740
		"" // no match expected as pattern is missing a 'e'
7067
		"" // no match expected as pattern is missing a 'e'
6741
	);
7068
	);
6742
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6743
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6744
	if (validatedRule != matchRule) {
6745
		matchRule = SearchPattern.R_PREFIX_MATCH;
6746
	}
6747
	search(pattern, TYPE, DECLARATIONS, matchRule);
6748
	assertSearchResults(
6749
		"" // no match expected as pattern is missing a 'e'
6750
	);
6751
}
7069
}
7070
/** @deprecated As using a depreciated constant */
6752
public void testBug137087e() throws CoreException {
7071
public void testBug137087e() throws CoreException {
6753
	// Search CamelCase
6754
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7072
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6755
	String pattern = "IllegalMSException";
7073
	String pattern = "IllegalMSException";
6756
	search(pattern, TYPE, DECLARATIONS, matchRule);
7074
	search(pattern, TYPE, DECLARATIONS, matchRule);
6757
	assertSearchResults(
7075
	assertSearchResults(
6758
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH"
7076
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH"
6759
	);
7077
	);
6760
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6761
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6762
	if (validatedRule != matchRule) {
6763
		matchRule = SearchPattern.R_PREFIX_MATCH;
6764
	}
6765
	search(pattern, TYPE, DECLARATIONS, matchRule);
6766
	assertSearchResults(
6767
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH\n" +
6768
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH"
6769
	);
6770
}
7078
}
7079
/** @deprecated As using a depreciated constant */
6771
public void testBug137087f() throws CoreException {
7080
public void testBug137087f() throws CoreException {
6772
	// Search CamelCase
6773
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7081
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6774
	String pattern = "illegalMsExceptionSException";
7082
	String pattern = "illegalMsExceptionSException";
6775
	search(pattern, TYPE, DECLARATIONS, matchRule);
7083
	search(pattern, TYPE, DECLARATIONS, matchRule);
6776
	assertSearchResults(
7084
	assertSearchResults(
6777
		"" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types
7085
		"" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types
6778
	);
7086
	);
6779
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6780
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6781
	if (validatedRule != matchRule) {
6782
		matchRule = SearchPattern.R_PREFIX_MATCH;
6783
	}
6784
	search(pattern, TYPE, DECLARATIONS, matchRule);
6785
	assertSearchResults(
6786
		"" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types
6787
	);
6788
}
7087
}
7088
/** @deprecated As using a depreciated constant */
6789
public void testBug137087g() throws CoreException {
7089
public void testBug137087g() throws CoreException {
6790
	// Search CamelCase
6791
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7090
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6792
	String pattern = "clonenotsupportedex";
7091
	String pattern = "clonenotsupportedex";
6793
	search(pattern, TYPE, DECLARATIONS, matchRule);
7092
	search(pattern, TYPE, DECLARATIONS, matchRule);
6794
	assertSearchResults(
7093
	assertSearchResults(
6795
		"" // no match expected as this is not a valid camel case
7094
		"" // no result because it's an invalid camel case pattern which is replaced with 
6796
	);
7095
			// prefix case sensitive match bu SearchPatter.validateMatchRule(...) (old behavior)
6797
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6798
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6799
	if (validatedRule != matchRule) {
6800
		matchRule = SearchPattern.R_PREFIX_MATCH;
6801
	}
6802
	search(pattern, TYPE, DECLARATIONS, matchRule);
6803
	assertSearchResults(
6804
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6805
	);
7096
	);
6806
}
7097
}
7098
/** @deprecated As using a depreciated constant */
6807
public void testBug137087h() throws CoreException {
7099
public void testBug137087h() throws CoreException {
6808
	// Search CamelCase
6809
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7100
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6810
	String pattern = "CloneNotSupportedEx";
7101
	String pattern = "CloneNotSupportedEx";
6811
	search(pattern, TYPE, DECLARATIONS, matchRule);
7102
	search(pattern, TYPE, DECLARATIONS, matchRule);
6812
	assertSearchResults(
7103
	assertSearchResults(
6813
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7104
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6814
	);
7105
	);
6815
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6816
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6817
	if (validatedRule != matchRule) {
6818
		matchRule = SearchPattern.R_PREFIX_MATCH;
6819
	}
6820
	search(pattern, TYPE, DECLARATIONS, matchRule);
6821
	assertSearchResults(
6822
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" +
6823
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6824
	);
6825
}
7106
}
7107
/** @deprecated As using a depreciated constant */
6826
public void testBug137087i() throws CoreException {
7108
public void testBug137087i() throws CoreException {
6827
	// Search CamelCase
6828
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7109
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6829
	String pattern = "cloneNotsupportedEx";
7110
	String pattern = "cloneNotsupportedEx";
6830
	search(pattern, TYPE, DECLARATIONS, matchRule);
7111
	search(pattern, TYPE, DECLARATIONS, matchRule);
6831
	assertSearchResults(
7112
	assertSearchResults(
6832
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7113
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6833
	);
7114
	);
6834
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6835
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6836
	if (validatedRule != matchRule) {
6837
		matchRule = SearchPattern.R_PREFIX_MATCH;
6838
	}
6839
	search(pattern, TYPE, DECLARATIONS, matchRule);
6840
	assertSearchResults(
6841
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" +
6842
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6843
	);
6844
}
7115
}
7116
/** @deprecated As using a depreciated constant */
6845
public void testBug137087j() throws CoreException {
7117
public void testBug137087j() throws CoreException {
6846
	// Search CamelCase
6847
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7118
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6848
	String pattern = "ClonenotSupportedexc";
7119
	String pattern = "ClonenotSupportedexc";
6849
	search(pattern, TYPE, DECLARATIONS, matchRule);
7120
	search(pattern, TYPE, DECLARATIONS, matchRule);
6850
	assertSearchResults(
7121
	assertSearchResults(
6851
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7122
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6852
	);
7123
	);
6853
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6854
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6855
	if (validatedRule != matchRule) {
6856
		matchRule = SearchPattern.R_PREFIX_MATCH;
6857
	}
6858
	search(pattern, TYPE, DECLARATIONS, matchRule);
6859
	assertSearchResults(
6860
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" +
6861
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6862
	);
6863
}
7124
}
7125
/** @deprecated As using a depreciated constant */
6864
public void testBug137087k() throws CoreException {
7126
public void testBug137087k() throws CoreException {
6865
	// Search CamelCase
6866
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7127
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6867
	String pattern = "cloneNotSupportedExcep";
7128
	String pattern = "cloneNotSupportedExcep";
6868
	search(pattern, TYPE, DECLARATIONS, matchRule);
7129
	search(pattern, TYPE, DECLARATIONS, matchRule);
6869
	assertSearchResults(
7130
	assertSearchResults(
6870
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7131
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6871
	);
7132
	);
6872
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6873
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6874
	if (validatedRule != matchRule) {
6875
		matchRule = SearchPattern.R_PREFIX_MATCH;
6876
	}
6877
	search(pattern, TYPE, DECLARATIONS, matchRule);
6878
	assertSearchResults(
6879
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" +
6880
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6881
	);
6882
}
7133
}
7134
/** @deprecated As using a depreciated constant */
6883
public void testBug137087l() throws CoreException {
7135
public void testBug137087l() throws CoreException {
6884
	// Search CamelCase
6885
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7136
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6886
	String pattern = "Clonenotsupportedexception";
7137
	String pattern = "Clonenotsupportedexception";
6887
	search(pattern, TYPE, DECLARATIONS, matchRule);
7138
	search(pattern, TYPE, DECLARATIONS, matchRule);
6888
	assertSearchResults(
7139
	assertSearchResults(
6889
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7140
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6890
	);
7141
	);
6891
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6892
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6893
	if (validatedRule != matchRule) {
6894
		matchRule = SearchPattern.R_PREFIX_MATCH;
6895
	}
6896
	search(pattern, TYPE, DECLARATIONS, matchRule);
6897
	assertSearchResults(
6898
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" +
6899
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6900
	);
6901
}
7142
}
7143
/** @deprecated As using a depreciated constant */
6902
public void testBug137087m() throws CoreException {
7144
public void testBug137087m() throws CoreException {
6903
	// Search CamelCase
6904
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7145
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6905
	String pattern = "CloneNotSupportedException";
7146
	String pattern = "CloneNotSupportedException";
6906
	search(pattern, TYPE, DECLARATIONS, matchRule);
7147
	search(pattern, TYPE, DECLARATIONS, matchRule);
6907
	assertSearchResults(
7148
	assertSearchResults(
6908
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7149
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6909
	);
7150
	);
6910
	// Search like UI does (ie. replace it with prefix if it's not a valid CamelCase)
6911
	int validatedRule = SearchPattern.validateMatchRule(pattern, matchRule);
6912
	if (validatedRule != matchRule) {
6913
		matchRule = SearchPattern.R_PREFIX_MATCH;
6914
	}
6915
	search(pattern, TYPE, DECLARATIONS, matchRule);
6916
	assertSearchResults(
6917
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH\n" +
6918
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
6919
	);
6920
}
7151
}
7152
6921
/**
7153
/**
6922
 * Bug 137984: [search] Field references not found when type is a qualified member type [regression]
7154
 * Bug 137984: [search] Field references not found when type is a qualified member type [regression]
6923
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137984"
7155
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137984"
(-)src/org/eclipse/jdt/core/tests/model/SearchTests.java (-24 / +151 lines)
Lines 124-130 Link Here
124
		}
124
		}
125
	}
125
	}
126
static {
126
static {
127
//	TESTS_NAMES = new String[] { "testSearchPatternCreation25" };
127
	TESTS_PREFIX = "testSearchPatternValidateMatchRule";
128
}
128
}
129
public static Test suite() {
129
public static Test suite() {
130
	return buildModelTestSuite(SearchTests.class);
130
	return buildModelTestSuite(SearchTests.class);
Lines 185-197 Link Here
185
}
185
}
186
protected void assertValidMatchRule(String pattern, int rule, int expected) {
186
protected void assertValidMatchRule(String pattern, int rule, int expected) {
187
	int validated = SearchPattern.validateMatchRule(pattern, rule);
187
	int validated = SearchPattern.validateMatchRule(pattern, rule);
188
	String givenRule = BasicSearchEngine.getMatchRuleString(rule);
188
	String validatedRule = BasicSearchEngine.getMatchRuleString(validated);
189
	String validatedRule = BasicSearchEngine.getMatchRuleString(validated);
189
	String expectedRule = BasicSearchEngine.getMatchRuleString(expected);
190
	String expectedRule = BasicSearchEngine.getMatchRuleString(expected);
190
	if (!validatedRule.equals(expectedRule)) {
191
	if (!validatedRule.equals(expectedRule)) {
191
		System.out.println("Test "+getName());
192
		System.out.println("Test "+getName());
192
		System.out.print("	assertValidMatchRule(\"");
193
		System.out.print("	assertValidMatchRule(\"");
193
		System.out.print(pattern);
194
		System.out.print(pattern);
194
		System.out.print("\", ");
195
		System.out.println("\",");
196
		System.out.print("		SearchPattern.");
197
		System.out.print(givenRule);
198
		System.out.println("\",");
199
		System.out.print("		SearchPattern.");
195
		System.out.print(validatedRule);
200
		System.out.print(validatedRule);
196
		System.out.println(");");
201
		System.out.println(");");
197
		assertEquals(pattern+"' does not match expected match rule!", expectedRule, validatedRule);
202
		assertEquals(pattern+"' does not match expected match rule!", expectedRule, validatedRule);
Lines 993-1035 Link Here
993
		"TypeReferencePattern: qualification<X.*>, type<Y>, exact match, case sensitive, erasure only",
998
		"TypeReferencePattern: qualification<X.*>, type<Y>, exact match, case sensitive, erasure only",
994
		searchPattern);
999
		searchPattern);
995
}
1000
}
1001
996
/**
1002
/**
997
 * Test CamelCase validation
1003
 * Test pattern  validation
998
 */
1004
 */
999
public void testSearchPatternValidMatchRule01() {
1005
public void testSearchPatternValidMatchRule01() {
1000
	assertValidMatchRule("foo", SearchPattern.R_EXACT_MATCH, SearchPattern.R_EXACT_MATCH);
1006
	assertValidMatchRule("foo", 
1001
	assertValidMatchRule("foo", SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PREFIX_MATCH);
1007
		SearchPattern.R_EXACT_MATCH,
1002
	assertValidMatchRule("foo", SearchPattern.R_PATTERN_MATCH, SearchPattern.R_EXACT_MATCH);
1008
		SearchPattern.R_EXACT_MATCH);
1003
	assertValidMatchRule("foo", SearchPattern.R_PATTERN_MATCH|SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PREFIX_MATCH);
1004
	assertValidMatchRule("foo", SearchPattern.R_CAMELCASE_MATCH, SearchPattern.R_PREFIX_MATCH|SearchPattern.R_CASE_SENSITIVE);
1005
}
1009
}
1006
public void testSearchPatternValidMatchRule02() {
1010
public void testSearchPatternValidMatchRule02() {
1007
	assertValidMatchRule("CP*P", SearchPattern.R_EXACT_MATCH, SearchPattern.R_PATTERN_MATCH);
1011
	assertValidMatchRule("foo",
1008
	assertValidMatchRule("CP*P", SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PATTERN_MATCH);
1012
		SearchPattern.R_PREFIX_MATCH,
1009
	assertValidMatchRule("CP*P", SearchPattern.R_PATTERN_MATCH, SearchPattern.R_PATTERN_MATCH);
1013
		SearchPattern.R_PREFIX_MATCH);
1010
	assertValidMatchRule("CP*P", SearchPattern.R_PATTERN_MATCH|SearchPattern.R_PREFIX_MATCH, SearchPattern.R_PATTERN_MATCH);
1011
	assertValidMatchRule("CP*P", SearchPattern.R_CAMELCASE_MATCH, SearchPattern.R_PATTERN_MATCH);
1012
}
1014
}
1013
public void testSearchPatternValidMatchRule03() {
1015
public void testSearchPatternValidMatchRule03() {
1014
	assertValidMatchRule("NPE", SearchPattern.R_CAMELCASE_MATCH);
1016
	assertValidMatchRule("foo", 
1017
		SearchPattern.R_PATTERN_MATCH,
1018
		SearchPattern.R_EXACT_MATCH);
1019
}
1020
public void testSearchPatternValidMatchRule04() {
1021
	assertValidMatchRule("foo",
1022
		SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH,
1023
		SearchPattern.R_PREFIX_MATCH);
1024
}
1025
/** @deprecated As using a depreciated constant */
1026
public void testSearchPatternValidMatchRule05() {
1027
	assertValidMatchRule("foo",
1028
		SearchPattern.R_CAMELCASE_MATCH,
1029
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
1030
}
1031
public void testSearchPatternValidMatchRule06() {
1032
	assertValidMatchRule("foo",
1033
		SearchPattern.R_CAMEL_CASE_MATCH,
1034
		SearchPattern.R_PREFIX_MATCH);
1035
}
1036
public void testSearchPatternValidMatchRule10() {
1037
	assertValidMatchRule("CP*P",
1038
		SearchPattern.R_EXACT_MATCH,
1039
		SearchPattern.R_PATTERN_MATCH);
1040
}
1041
public void testSearchPatternValidMatchRule11() {
1042
	assertValidMatchRule("CP*P",
1043
		SearchPattern.R_PREFIX_MATCH,
1044
		SearchPattern.R_PATTERN_MATCH);
1045
}
1046
public void testSearchPatternValidMatchRule12() {
1047
	assertValidMatchRule("CP*P",
1048
		SearchPattern.R_PATTERN_MATCH,
1049
		SearchPattern.R_PATTERN_MATCH);
1050
}
1051
public void testSearchPatternValidMatchRule13() {
1052
	assertValidMatchRule("CP*P",
1053
		SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH,
1054
		SearchPattern.R_PATTERN_MATCH);
1055
}
1056
/** @deprecated As using a depreciated constant */
1057
public void testSearchPatternValidMatchRule14() {
1058
	assertValidMatchRule("CP*P",
1059
		SearchPattern.R_CAMELCASE_MATCH,
1060
		SearchPattern.R_PATTERN_MATCH);
1061
}
1062
public void testSearchPatternValidMatchRule15() {
1063
	assertValidMatchRule("CP*P",
1064
		SearchPattern.R_CAMEL_CASE_MATCH,
1065
		SearchPattern.R_PATTERN_MATCH);
1066
}
1067
/** @deprecated As using a depreciated constant */
1068
public void testSearchPatternValidMatchRule20() {
1069
	assertValidMatchRule("NPE", 
1070
		SearchPattern.R_CAMELCASE_MATCH);
1071
}
1072
/** @deprecated As using a depreciated constant */
1073
public void testSearchPatternValidMatchRule21() {
1015
	assertValidMatchRule("NPE",
1074
	assertValidMatchRule("NPE",
1016
		SearchPattern.R_CAMELCASE_MATCH|SearchPattern.R_PREFIX_MATCH|SearchPattern.R_CASE_SENSITIVE,
1075
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
1017
		SearchPattern.R_CAMELCASE_MATCH);
1076
		SearchPattern.R_CAMELCASE_MATCH);
1018
	assertValidMatchRule("nPE", SearchPattern.R_CAMELCASE_MATCH);
1019
	assertValidMatchRule("NuPoEx", SearchPattern.R_CAMELCASE_MATCH);
1020
	assertValidMatchRule("oF", SearchPattern.R_CAMELCASE_MATCH);
1021
}
1077
}
1022
public void testSearchPatternValidMatchRule04() {
1078
/** @deprecated As using a depreciated constant */
1079
public void testSearchPatternValidMatchRule22() {
1080
	assertValidMatchRule("nPE",
1081
		SearchPattern.R_CAMELCASE_MATCH);
1082
}
1083
/** @deprecated As using a depreciated constant */
1084
public void testSearchPatternValidMatchRule23() {
1085
	assertValidMatchRule("NuPoEx", 
1086
		SearchPattern.R_CAMELCASE_MATCH);
1087
}
1088
/** @deprecated As using a depreciated constant */
1089
public void testSearchPatternValidMatchRule24() {
1090
	assertValidMatchRule("oF",
1091
		SearchPattern.R_CAMELCASE_MATCH);
1092
}
1093
public void testSearchPatternValidMatchRule30() {
1094
	assertValidMatchRule("NPE",
1095
		SearchPattern.R_CAMEL_CASE_MATCH);
1096
}
1097
public void testSearchPatternValidMatchRule31() {
1098
	assertValidMatchRule("NPE",
1099
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH);
1100
}
1101
public void testSearchPatternValidMatchRule32() {
1102
	assertValidMatchRule("NPE",
1103
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
1104
}
1105
public void testSearchPatternValidMatchRule33() {
1106
	assertValidMatchRule("NPE",
1107
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
1108
}
1109
public void testSearchPatternValidMatchRule34() {
1110
	assertValidMatchRule("nPE",
1111
		SearchPattern.R_CAMEL_CASE_MATCH);
1112
}
1113
public void testSearchPatternValidMatchRule35() {
1114
	assertValidMatchRule("NuPoEx", 
1115
		SearchPattern.R_CAMEL_CASE_MATCH);
1116
}
1117
public void testSearchPatternValidMatchRule36() {
1118
	assertValidMatchRule("oF",
1119
		SearchPattern.R_CAMEL_CASE_MATCH);
1120
}
1121
/** @deprecated As using a depreciated constant */
1122
public void testSearchPatternValidMatchRule40() {
1023
	assertValidMatchRule("Nu/Po/Ex",
1123
	assertValidMatchRule("Nu/Po/Ex",
1024
		SearchPattern.R_CAMELCASE_MATCH,
1124
		SearchPattern.R_CAMELCASE_MATCH,
1025
		SearchPattern.R_PREFIX_MATCH|SearchPattern.R_CASE_SENSITIVE);
1125
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
1126
}
1127
/** @deprecated As using a depreciated constant */
1128
public void testSearchPatternValidMatchRule41() {
1026
	assertValidMatchRule("Nu.Po.Ex",
1129
	assertValidMatchRule("Nu.Po.Ex",
1027
		SearchPattern.R_CAMELCASE_MATCH|SearchPattern.R_PREFIX_MATCH,
1130
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH,
1028
		SearchPattern.R_PREFIX_MATCH);
1131
		SearchPattern.R_PREFIX_MATCH);
1029
}
1132
}
1030
public void testSearchPatternValidMatchRule05() {
1133
/** @deprecated As using a depreciated constant */
1031
	assertValidMatchRule("hashMap", SearchPattern.R_CAMELCASE_MATCH);
1134
public void testSearchPatternValidMatchRule42() {
1032
	assertValidMatchRule("Hashmap", SearchPattern.R_CAMELCASE_MATCH);
1135
	assertValidMatchRule("hashMap",
1136
		SearchPattern.R_CAMELCASE_MATCH);
1137
}
1138
/** @deprecated As using a depreciated constant */
1139
public void testSearchPatternValidMatchRule43() {
1140
	assertValidMatchRule("Hashmap",
1141
		SearchPattern.R_CAMELCASE_MATCH);
1142
}
1143
public void testSearchPatternValidMatchRule44() {
1144
	assertValidMatchRule("Nu/Po/Ex",
1145
		SearchPattern.R_CAMEL_CASE_MATCH,
1146
		SearchPattern.R_PREFIX_MATCH);
1147
}
1148
public void testSearchPatternValidMatchRule45() {
1149
	assertValidMatchRule("Nu.Po.Ex",
1150
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH,
1151
		SearchPattern.R_PREFIX_MATCH);
1152
}
1153
public void testSearchPatternValidMatchRule46() {
1154
	assertValidMatchRule("hashMap",
1155
		SearchPattern.R_CAMEL_CASE_MATCH);
1156
}
1157
public void testSearchPatternValidMatchRule47() {
1158
	assertValidMatchRule("Hashmap",
1159
		SearchPattern.R_CAMEL_CASE_MATCH);
1033
}
1160
}
1034
1161
1035
/**
1162
/**
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java (-4 / +74 lines)
Lines 923-928 Link Here
923
 * @bug 199392: [search] Type Dialog Error 'Items filtering ... Reason: Class file name must end with .class'
923
 * @bug 199392: [search] Type Dialog Error 'Items filtering ... Reason: Class file name must end with .class'
924
 * @test Ensure that types are found even in project which name ends either with ".jar" or ".zip"
924
 * @test Ensure that types are found even in project which name ends either with ".jar" or ".zip"
925
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199392"
925
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199392"
926
 * @deprecated As using a depreciated constant
926
 */
927
 */
927
public void testBug199392_Jar() throws CoreException {
928
public void testBug199392_Jar() throws CoreException {
928
	try {
929
	try {
Lines 952-959 Link Here
952
			collector,
953
			collector,
953
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
954
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
954
			null);
955
			null);
955
		// Should have same types with these 2 searches
956
		assertEquals("Invalid number of types found!", 1, collector.size());
957
		assertEquals("Found types sounds not to be correct", 
956
		assertEquals("Found types sounds not to be correct", 
958
			"test.MyClass",
957
			"test.MyClass",
959
			collector.toString()
958
			collector.toString()
Lines 962-967 Link Here
962
		deleteProject("Test.jar");
961
		deleteProject("Test.jar");
963
	}
962
	}
964
}
963
}
964
public void testBug199392_Jar_new() throws CoreException {
965
	try {
966
		IJavaProject project = createJavaProject("Test.jar");
967
		createFolder("/Test.jar/test");
968
		createFile(
969
			"/Test.jar/test/MyClass.java",
970
			"package test;\n" + 
971
			"public class MyClass {\n" + 
972
			"}\n"
973
		);
974
975
		// Search all type names with TypeNameMatchRequestor
976
		AbstractJavaSearchTests.TypeNameMatchCollector collector = new AbstractJavaSearchTests.TypeNameMatchCollector() {
977
			public String toString(){
978
				return toFullyQualifiedNamesString();
979
			}
980
		};
981
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project });
982
		new SearchEngine().searchAllTypeNames(
983
			null,
984
			SearchPattern.R_EXACT_MATCH,
985
			new char[] { 'M', 'y' },
986
			SearchPattern.R_CAMEL_CASE_MATCH,
987
			IJavaSearchConstants.TYPE,
988
			scope,
989
			collector,
990
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
991
			null);
992
		assertEquals("Found types sounds not to be correct", 
993
			"", // no result as prefix match is not set
994
			collector.toString()
995
		);
996
	} finally {
997
		deleteProject("Test.jar");
998
	}
999
}
1000
/** @deprecated As using a depreciated constant */
965
public void testBug199392_Zip() throws CoreException {
1001
public void testBug199392_Zip() throws CoreException {
966
	try {
1002
	try {
967
		IJavaProject project = createJavaProject("Test.zip");
1003
		IJavaProject project = createJavaProject("Test.zip");
Lines 990-997 Link Here
990
			collector,
1026
			collector,
991
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
1027
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
992
			null);
1028
			null);
993
		// Should have same types with these 2 searches
994
		assertEquals("Invalid number of types found!", 1, collector.size());
995
		assertEquals("Found types sounds not to be correct", 
1029
		assertEquals("Found types sounds not to be correct", 
996
			"test.MyClass",
1030
			"test.MyClass",
997
			collector.toString()
1031
			collector.toString()
Lines 1000-1003 Link Here
1000
		deleteProject("Test.zip");
1034
		deleteProject("Test.zip");
1001
	}
1035
	}
1002
}
1036
}
1037
public void testBug199392_Zip_new() throws CoreException {
1038
	try {
1039
		IJavaProject project = createJavaProject("Test.zip");
1040
		createFolder("/Test.zip/test");
1041
		createFile(
1042
			"/Test.zip/test/MyClass.java",
1043
			"package test;\n" + 
1044
			"public class MyClass {\n" + 
1045
			"}\n"
1046
		);
1047
1048
		// Search all type names with TypeNameMatchRequestor
1049
		AbstractJavaSearchTests.TypeNameMatchCollector collector = new AbstractJavaSearchTests.TypeNameMatchCollector() {
1050
			public String toString(){
1051
				return toFullyQualifiedNamesString();
1052
			}
1053
		};
1054
		IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project });
1055
		new SearchEngine().searchAllTypeNames(
1056
			null,
1057
			SearchPattern.R_EXACT_MATCH,
1058
			new char[] { 'M', 'y' },
1059
			SearchPattern.R_CAMEL_CASE_MATCH,
1060
			IJavaSearchConstants.TYPE,
1061
			scope,
1062
			collector,
1063
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
1064
			null);
1065
		assertEquals("Found types sounds not to be correct", 
1066
			"", // no result as prefix match is not set
1067
			collector.toString()
1068
		);
1069
	} finally {
1070
		deleteProject("Test.zip");
1071
	}
1072
}
1003
}
1073
}
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java (+13 lines)
Lines 503-508 Link Here
503
					}
503
					}
504
				}
504
				}
505
				System.out.println("--------------------------------------------------------------------------------");
505
				System.out.println("--------------------------------------------------------------------------------");
506
				length *= 2;
506
				for (int i=0; i<length; i+=2) {
507
				for (int i=0; i<length; i+=2) {
507
					System.out.println(sources[i]);
508
					System.out.println(sources[i]);
508
					System.out.println(sources[i+1]);
509
					System.out.println(sources[i+1]);
Lines 632-637 Link Here
632
			requestor,
633
			requestor,
633
			null);
634
			null);
634
	}
635
	}
636
	protected void search(IJavaElement element, int limitTo) throws CoreException {
637
		search(element, limitTo, EXACT_RULE, getJavaSearchScope(), resultCollector);
638
	}
639
	protected void search(IJavaElement element, int limitTo, int matchRule) throws CoreException {
640
		search(element, limitTo, matchRule, getJavaSearchScope(), resultCollector);
641
	}
642
	protected void search(String patternString, int searchFor, int limitTo) throws CoreException {
643
		search(patternString, searchFor, limitTo, EXACT_RULE, getJavaSearchScope(), resultCollector);
644
	}
645
	protected void search(String patternString, int searchFor, int limitTo, int matchRule) throws CoreException {
646
		search(patternString, searchFor, limitTo, matchRule, getJavaSearchScope(), resultCollector);
647
	}
635
	protected void searchAllTypeNames(String pattern, int matchRule, TypeNameRequestor requestor) throws JavaModelException {
648
	protected void searchAllTypeNames(String pattern, int matchRule, TypeNameRequestor requestor) throws JavaModelException {
636
		new SearchEngine(this.workingCopies).searchAllTypeNames(
649
		new SearchEngine(this.workingCopies).searchAllTypeNames(
637
			null,
650
			null,
(-)src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java (-1 / +131 lines)
Lines 13-18 Link Here
13
import java.io.File;
13
import java.io.File;
14
14
15
//import org.apache.tools.ant.types.selectors.SelectorUtils;
15
//import org.apache.tools.ant.types.selectors.SelectorUtils;
16
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.core.compiler.CharOperation;
17
18
18
//import junit.framework.AssertionFailedError;
19
//import junit.framework.AssertionFailedError;
Lines 36-42 Link Here
36
 * If result is invalid then store warning in buffer and display it.
37
 * If result is invalid then store warning in buffer and display it.
37
 */
38
 */
38
void assertCamelCase(String pattern, String name, boolean match) {
39
void assertCamelCase(String pattern, String name, boolean match) {
39
	boolean camelCase = CharOperation.camelCaseMatch(pattern==null?null:pattern.toCharArray(), name==null?null:name.toCharArray());
40
	assertCamelCase(pattern, name, true /*prefix match*/, match);
41
}
42
/**
43
 * Assert that a pattern and a name matches or not.
44
 * If result is invalid then store warning in buffer and display it.
45
 */
46
void assertCamelCase(String pattern, String name, boolean prefixMatch, boolean match) {
47
	boolean camelCase = CharOperation.camelCaseMatch(pattern==null?null:pattern.toCharArray(), name==null?null:name.toCharArray(), prefixMatch);
40
	if (match != camelCase) {
48
	if (match != camelCase) {
41
		StringBuffer line = new StringBuffer("'");
49
		StringBuffer line = new StringBuffer("'");
42
		line.append(name);
50
		line.append(name);
Lines 608-613 Link Here
608
	// Verify that there were no unexpected results
616
	// Verify that there were no unexpected results
609
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
617
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
610
}
618
}
619
620
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=109695
621
public void test70() throws CoreException {
622
	assertCamelCase("IDE3", "IDocumentExtension", false /*no prefix match*/, false /* should not match */);
623
	assertCamelCase("IDE3", "IDocumentExtension2", false /*no prefix match*/, false /* should not match */);
624
	assertCamelCase("IDE3", "IDocumentExtension3", false /*no prefix match*/, true /* should match */);
625
	assertCamelCase("IDE3", "IDocumentExtension135", false /*no prefix match*/, true /* should match */);
626
	assertCamelCase("IDE3", "IDocumentExtension315", false /*no prefix match*/, true /* should match */);
627
	assertCamelCase("IDPE3", "IDocumentProviderExtension", false /*no prefix match*/, false /* should not match */);
628
	assertCamelCase("IDPE3", "IDocumentProviderExtension2", false /*no prefix match*/, false /* should not match */);
629
	assertCamelCase("IDPE3", "IDocumentProviderExtension4", false /*no prefix match*/, false /* should not match */);
630
	assertCamelCase("IDPE3", "IDocumentProviderExtension3", false /*no prefix match*/, true /* should match */);
631
	assertCamelCase("IDPE3", "IDocumentProviderExtension5", false /*no prefix match*/, false /* should not match */);
632
	assertCamelCase("IDPE3", "IDocumentProviderExtension54321", false /*no prefix match*/, true /* should match */);
633
	assertCamelCase("IDPE3", "IDocumentProviderExtension12345", false /*no prefix match*/, true /* should match */);
634
	assertCamelCase("IPL3", "IPerspectiveListener", false /*no prefix match*/, false /* should not match */);
635
	assertCamelCase("IPL3", "IPerspectiveListener2", false /*no prefix match*/, false /* should not match */);
636
	assertCamelCase("IPL3", "IPerspectiveListener3", false /*no prefix match*/, true /* should match */);
637
	assertCamelCase("IPS2", "IPropertySource", false /*no prefix match*/, false /* should not match */);
638
	assertCamelCase("IPS2", "IPropertySource2", false /*no prefix match*/, true /* should match */);
639
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate", false /*no prefix match*/, false /* should not match */);
640
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate2", false /*no prefix match*/, true /* should match */);
641
	assertCamelCase("UTF16DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
642
	assertCamelCase("UTF16DSS", "UTF1DocScannerSupport", false /*no prefix match*/, false /* should not match */);
643
	assertCamelCase("UTF16DSS", "UTF6DocScannerSupport", false /*no prefix match*/, false /* should not match */);
644
	assertCamelCase("UTF16DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */);
645
	assertCamelCase("UTF1DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
646
	assertCamelCase("UTF1DSS", "UTF1DocScannerSupport", false /*no prefix match*/, true /* should match */);
647
	assertCamelCase("UTF1DSS", "UTF6DocScannerSupport", false /*no prefix match*/, false /* should not match */);
648
	assertCamelCase("UTF1DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */);
649
	assertCamelCase("UTF6DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
650
	assertCamelCase("UTF6DSS", "UTF1DocScannerSupport", false /*no prefix match*/, false /* should not match */);
651
	assertCamelCase("UTF6DSS", "UTF6DocScannerSupport", false /*no prefix match*/, true /* should match */);
652
	assertCamelCase("UTF6DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */);
653
	assertCamelCase("UTFDSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
654
	assertCamelCase("UTFDSS", "UTF1DocScannerSupport", false /*no prefix match*/, true /* should match */);
655
	assertCamelCase("UTFDSS", "UTF6DocScannerSupport", false /*no prefix match*/, true /* should match */);
656
	assertCamelCase("UTFDSS", "UTFDocScannerSupport", false /*no prefix match*/, true /* should match */);
657
	// Verify that there were no unexpected results
658
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
659
}
660
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
661
public void test71() {
662
	assertCamelCase("HM", "HashMap", false /*no prefix match*/, true /*should match*/);
663
	assertCamelCase("HM", "HtmlMapper", false /*no prefix match*/, true /*should match*/);
664
	assertCamelCase("HM", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
665
	assertCamelCase("HaM", "HashMap", false /*no prefix match*/, true /* should match */);
666
	assertCamelCase("HaM", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
667
	assertCamelCase("HaM", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
668
	assertCamelCase("HashM", "HashMap", false /*no prefix match*/, true /* should match */);
669
	assertCamelCase("HashM", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
670
	assertCamelCase("HashM", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
671
	// Verify that there were no unexpected results
672
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
673
}
674
public void test71b() { // previous test cases but with 3.3 behavior
675
	assertCamelCase("HM", "HashMap", true /*should match*/);
676
	assertCamelCase("HM", "HtmlMapper", true /*should match*/);
677
	assertCamelCase("HM", "HashMapEntry", true /*should match*/);
678
	assertCamelCase("HaM", "HashMap", true /* should match */);
679
	assertCamelCase("HaM", "HtmlMapper", false /*should not match*/);
680
	assertCamelCase("HaM", "HashMapEntry", true /*should match*/);
681
	assertCamelCase("HashM", "HashMap", true /* should match */);
682
	assertCamelCase("HashM", "HtmlMapper", false /*should not match*/);
683
	assertCamelCase("HashM", "HashMapEntry", true /*should match*/);
684
	// Verify that there were no unexpected results
685
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
686
}
687
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
688
public void test72() {
689
	assertCamelCase("HMa", "HashMap", false /*no prefix match*/, false /* should not match */);
690
	assertCamelCase("HMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
691
	assertCamelCase("HMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
692
	assertCamelCase("HaMa", "HashMap", false /*no prefix match*/, false /* should not match */);
693
	assertCamelCase("HaMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
694
	assertCamelCase("HaMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
695
	assertCamelCase("HashMa", "HashMap", false /*no prefix match*/, false /* should not match */);
696
	assertCamelCase("HashMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
697
	assertCamelCase("HashMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
698
	// Verify that there were no unexpected results
699
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
700
}
701
public void test72b() { // previous test cases but with 3.3 behavior
702
	assertCamelCase("HMa", "HashMap", true /*should match*/);
703
	assertCamelCase("HMa", "HtmlMapper", true /*should match*/);
704
	assertCamelCase("HMa", "HashMapEntry", true /*should match*/);
705
	assertCamelCase("HaMa", "HashMap", true /* should match */);
706
	assertCamelCase("HaMa", "HtmlMapper", false /*should not match*/);
707
	assertCamelCase("HaMa", "HashMapEntry", true /*should match*/);
708
	assertCamelCase("HashMa", "HashMap", true /* should match */);
709
	assertCamelCase("HashMa", "HtmlMapper", false /*should not match*/);
710
	assertCamelCase("HashMa", "HashMapEntry", true /*should match*/);
711
	// Verify that there were no unexpected results
712
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
713
}
714
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
715
public void test73() {
716
	assertCamelCase("HMap", "HashMap", false /*no prefix match*/, true /*should match*/);
717
	assertCamelCase("HMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
718
	assertCamelCase("HMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
719
	assertCamelCase("HaMap", "HashMap", false /*no prefix match*/, true /* should match */);
720
	assertCamelCase("HaMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
721
	assertCamelCase("HaMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
722
	assertCamelCase("HashMap", "HashMap", false /*no prefix match*/, true /* should match */);
723
	assertCamelCase("HashMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
724
	assertCamelCase("HashMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
725
	// Verify that there were no unexpected results
726
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
727
}
728
public void test73b() { // previous test cases but with 3.3 behavior
729
	assertCamelCase("HMap", "HashMap", true /*should match*/);
730
	assertCamelCase("HMap", "HtmlMapper", true /*should match*/);
731
	assertCamelCase("HMap", "HashMapEntry", true /*should match*/);
732
	assertCamelCase("HaMap", "HashMap", true /* should match */);
733
	assertCamelCase("HaMap", "HtmlMapper", false /*should not match*/);
734
	assertCamelCase("HaMap", "HashMapEntry", true /*should match*/);
735
	assertCamelCase("HashMap", "HashMap", true /* should match */);
736
	assertCamelCase("HashMap", "HtmlMapper", false /*should not match*/);
737
	assertCamelCase("HashMap", "HashMapEntry", true /*should match*/);
738
	// Verify that there were no unexpected results
739
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
740
}
611
public static Class testClass() {
741
public static Class testClass() {
612
	return UtilTest.class;
742
	return UtilTest.class;
613
}
743
}
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java (-2 / +2 lines)
Lines 32-39 Link Here
32
	public TypeReferencePattern(char[] qualification, char[] simpleName, int matchRule) {
32
	public TypeReferencePattern(char[] qualification, char[] simpleName, int matchRule) {
33
		this(matchRule);
33
		this(matchRule);
34
	
34
	
35
		this.qualification = isCaseSensitive() ? qualification : CharOperation.toLowerCase(qualification);
35
		this.qualification = this.isCaseSensitive ? qualification : CharOperation.toLowerCase(qualification);
36
		this.simpleName = (isCaseSensitive() || isCamelCase())  ? simpleName : CharOperation.toLowerCase(simpleName);
36
		this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName);
37
	
37
	
38
		if (simpleName == null)
38
		if (simpleName == null)
39
			this.segments = this.qualification == null ? ONE_STAR_CHAR : CharOperation.splitOn('.', this.qualification);
39
			this.segments = this.qualification == null ? ONE_STAR_CHAR : CharOperation.splitOn('.', this.qualification);
(-)search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java (-2 / +2 lines)
Lines 23-30 Link Here
23
public QualifiedTypeDeclarationPattern(char[] qualification, char[] simpleName, char typeSuffix, int matchRule) {
23
public QualifiedTypeDeclarationPattern(char[] qualification, char[] simpleName, char typeSuffix, int matchRule) {
24
	this(matchRule);
24
	this(matchRule);
25
25
26
	this.qualification = isCaseSensitive() ? qualification : CharOperation.toLowerCase(qualification);
26
	this.qualification = this.isCaseSensitive ? qualification : CharOperation.toLowerCase(qualification);
27
	this.simpleName = (isCaseSensitive() || isCamelCase())  ? simpleName : CharOperation.toLowerCase(simpleName);
27
	this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName);
28
	this.typeSuffix = typeSuffix;
28
	this.typeSuffix = typeSuffix;
29
29
30
	((InternalSearchPattern)this).mustResolve = this.qualification != null || typeSuffix != TYPE_SUFFIX;
30
	((InternalSearchPattern)this).mustResolve = this.qualification != null || typeSuffix != TYPE_SUFFIX;
(-)search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java (-4 / +4 lines)
Lines 73-80 Link Here
73
	this.findDeclarations = findDeclarations;
73
	this.findDeclarations = findDeclarations;
74
	this.findReferences = findReferences;
74
	this.findReferences = findReferences;
75
75
76
	this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
76
	this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
77
	this.declaringSimpleName = (isCaseSensitive() || isCamelCase()) ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
77
	this.declaringSimpleName = (this.isCaseSensitive || this.isCamelCase) ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
78
	if (parameterSimpleNames != null) {
78
	if (parameterSimpleNames != null) {
79
		this.parameterCount = parameterSimpleNames.length;
79
		this.parameterCount = parameterSimpleNames.length;
80
		boolean synthetic = this.parameterCount>0 && declaringQualification != null && CharOperation.equals(CharOperation.concat(parameterQualifications[0], parameterSimpleNames[0], '.'), declaringQualification);
80
		boolean synthetic = this.parameterCount>0 && declaringQualification != null && CharOperation.equals(CharOperation.concat(parameterQualifications[0], parameterSimpleNames[0], '.'), declaringQualification);
Lines 87-94 Link Here
87
		this.parameterQualifications = new char[this.parameterCount][];
87
		this.parameterQualifications = new char[this.parameterCount][];
88
		this.parameterSimpleNames = new char[this.parameterCount][];
88
		this.parameterSimpleNames = new char[this.parameterCount][];
89
		for (int i = 0; i < this.parameterCount; i++) {
89
		for (int i = 0; i < this.parameterCount; i++) {
90
			this.parameterQualifications[i] = isCaseSensitive() ? parameterQualifications[i+offset] : CharOperation.toLowerCase(parameterQualifications[i+offset]);
90
			this.parameterQualifications[i] = this.isCaseSensitive ? parameterQualifications[i+offset] : CharOperation.toLowerCase(parameterQualifications[i+offset]);
91
			this.parameterSimpleNames[i] = isCaseSensitive() ? parameterSimpleNames[i+offset] : CharOperation.toLowerCase(parameterSimpleNames[i+offset]);
91
			this.parameterSimpleNames[i] = this.isCaseSensitive ? parameterSimpleNames[i+offset] : CharOperation.toLowerCase(parameterSimpleNames[i+offset]);
92
		}
92
		}
93
	} else {
93
	} else {
94
		this.parameterCount = -1;
94
		this.parameterCount = -1;
(-)search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java (-1 / +1 lines)
Lines 30-36 Link Here
30
		this.segments = new char[][] {CharOperation.NO_CHAR};
30
		this.segments = new char[][] {CharOperation.NO_CHAR};
31
		((InternalSearchPattern)this).mustResolve = false;
31
		((InternalSearchPattern)this).mustResolve = false;
32
	} else {
32
	} else {
33
		this.pkgName = (isCaseSensitive() || isCamelCase())  ? pkgName : CharOperation.toLowerCase(pkgName);
33
		this.pkgName = (this.isCaseSensitive || this.isCamelCase) ? pkgName : CharOperation.toLowerCase(pkgName);
34
		this.segments = CharOperation.splitOn('.', this.pkgName);
34
		this.segments = CharOperation.splitOn('.', this.pkgName);
35
		((InternalSearchPattern)this).mustResolve = true;
35
		((InternalSearchPattern)this).mustResolve = true;
36
	}
36
	}
(-)search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java (-1 / +1 lines)
Lines 48-54 Link Here
48
	}
48
	}
49
	// null simple names are allowed (should return all names)
49
	// null simple names are allowed (should return all names)
50
	if (simpleNames != null) {
50
	if (simpleNames != null) {
51
		if ((isCaseSensitive() || isCamelCase()) ) {
51
		if (this.isCaseSensitive || this.isCamelCase) {
52
			this.simpleNames = simpleNames;
52
			this.simpleNames = simpleNames;
53
		} else {
53
		} else {
54
			int length = simpleNames.length;
54
			int length = simpleNames.length;
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java (-7 / +7 lines)
Lines 83-100 Link Here
83
	this.findDeclarations = findDeclarations;
83
	this.findDeclarations = findDeclarations;
84
	this.findReferences = findReferences;
84
	this.findReferences = findReferences;
85
85
86
	this.selector = (isCaseSensitive() || isCamelCase())  ? selector : CharOperation.toLowerCase(selector);
86
	this.selector = (this.isCaseSensitive || this.isCamelCase) ? selector : CharOperation.toLowerCase(selector);
87
	this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
87
	this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
88
	this.declaringSimpleName = isCaseSensitive() ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
88
	this.declaringSimpleName = this.isCaseSensitive ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
89
	this.returnQualification = isCaseSensitive() ? returnQualification : CharOperation.toLowerCase(returnQualification);
89
	this.returnQualification = this.isCaseSensitive ? returnQualification : CharOperation.toLowerCase(returnQualification);
90
	this.returnSimpleName = isCaseSensitive() ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName);
90
	this.returnSimpleName = this.isCaseSensitive ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName);
91
	if (parameterSimpleNames != null) {
91
	if (parameterSimpleNames != null) {
92
		this.parameterCount = parameterSimpleNames.length;
92
		this.parameterCount = parameterSimpleNames.length;
93
		this.parameterQualifications = new char[this.parameterCount][];
93
		this.parameterQualifications = new char[this.parameterCount][];
94
		this.parameterSimpleNames = new char[this.parameterCount][];
94
		this.parameterSimpleNames = new char[this.parameterCount][];
95
		for (int i = 0; i < this.parameterCount; i++) {
95
		for (int i = 0; i < this.parameterCount; i++) {
96
			this.parameterQualifications[i] = isCaseSensitive() ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]);
96
			this.parameterQualifications[i] = this.isCaseSensitive ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]);
97
			this.parameterSimpleNames[i] = isCaseSensitive() ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]);
97
			this.parameterSimpleNames[i] = this.isCaseSensitive ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]);
98
		}
98
		}
99
	} else {
99
	} else {
100
		this.parameterCount = -1;
100
		this.parameterCount = -1;
(-)search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java (-4 / +4 lines)
Lines 24-35 Link Here
24
public VariablePattern(int patternKind, boolean findDeclarations, boolean readAccess, boolean writeAccess, char[] name, int matchRule) {
24
public VariablePattern(int patternKind, boolean findDeclarations, boolean readAccess, boolean writeAccess, char[] name, int matchRule) {
25
	super(patternKind, matchRule);
25
	super(patternKind, matchRule);
26
26
27
	this.findDeclarations = findDeclarations; // set to find declarations & all occurences
27
	this.findDeclarations = findDeclarations; // set to find declarations & all occurrences
28
	this.readAccess = readAccess; // set to find any reference, read only references & all occurences
28
	this.readAccess = readAccess; // set to find any reference, read only references & all occurrences
29
	this.writeAccess = writeAccess; // set to find any reference, write only references & all occurences
29
	this.writeAccess = writeAccess; // set to find any reference, write only references & all occurrences
30
	this.findReferences = readAccess || writeAccess;
30
	this.findReferences = readAccess || writeAccess;
31
31
32
	this.name = (isCaseSensitive() || isCamelCase())  ? name : CharOperation.toLowerCase(name);
32
	this.name = (this.isCaseSensitive || this.isCamelCase) ? name : CharOperation.toLowerCase(name);
33
}
33
}
34
/*
34
/*
35
 * Returns whether a method declaration or message send will need to be resolved to 
35
 * Returns whether a method declaration or message send will need to be resolved to 
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java (-2 / +5 lines)
Lines 112-119 Link Here
112
			return IMPOSSIBLE_MATCH;
112
			return IMPOSSIBLE_MATCH;
113
		}
113
		}
114
		boolean matchFirstChar = !this.isCaseSensitive || (qualifiedPattern[0] == qualifiedTypeName[0]);
114
		boolean matchFirstChar = !this.isCaseSensitive || (qualifiedPattern[0] == qualifiedTypeName[0]);
115
		if (this.isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName)) {
115
		if (this.isCamelCase) {
116
			return POSSIBLE_MATCH;
116
			if (matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
117
				return POSSIBLE_MATCH;
118
			}
119
			if (this.isCaseSensitive) return IMPOSSIBLE_MATCH;
117
		}
120
		}
118
		switch (this.matchMode) {
121
		switch (this.matchMode) {
119
			case SearchPattern.R_EXACT_MATCH:
122
			case SearchPattern.R_EXACT_MATCH:
(-)search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java (-2 / +2 lines)
Lines 150-157 Link Here
150
150
151
	this(matchRule);
151
	this(matchRule);
152
152
153
	this.superQualification = isCaseSensitive() ? superQualification : CharOperation.toLowerCase(superQualification);
153
	this.superQualification = this.isCaseSensitive ? superQualification : CharOperation.toLowerCase(superQualification);
154
	this.superSimpleName = (isCaseSensitive() || isCamelCase())  ? superSimpleName : CharOperation.toLowerCase(superSimpleName);
154
	this.superSimpleName = (this.isCaseSensitive || this.isCamelCase) ? superSimpleName : CharOperation.toLowerCase(superSimpleName);
155
	((InternalSearchPattern)this).mustResolve = superQualification != null;
155
	((InternalSearchPattern)this).mustResolve = superQualification != null;
156
	this.superRefKind = superRefKind;
156
	this.superRefKind = superRefKind;
157
}
157
}
(-)search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java (-7 / +7 lines)
Lines 42-48 Link Here
42
	 *		<li>{@link #R_PREFIX_MATCH}</li>
42
	 *		<li>{@link #R_PREFIX_MATCH}</li>
43
	 *		<li>{@link #R_PATTERN_MATCH}</li>
43
	 *		<li>{@link #R_PATTERN_MATCH}</li>
44
	 *		<li>{@link #R_REGEXP_MATCH}</li>
44
	 *		<li>{@link #R_REGEXP_MATCH}</li>
45
	 *		<li>{@link #R_CAMELCASE_MATCH}</li>
45
	 *		<li>{@link #R_CAMEL_CASE_MATCH}</li>
46
	 * </ul>
46
	 * </ul>
47
	 */
47
	 */
48
	int matchMode;
48
	int matchMode;
Lines 75-81 Link Here
75
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=81377
75
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=81377
76
		int rule = getMatchRule();
76
		int rule = getMatchRule();
77
		this.isCaseSensitive = (rule & R_CASE_SENSITIVE) != 0;
77
		this.isCaseSensitive = (rule & R_CASE_SENSITIVE) != 0;
78
		this.isCamelCase = (rule & R_CAMELCASE_MATCH) != 0;
78
		this.isCamelCase = (rule & R_CAMEL_CASE_MATCH) != 0;
79
		this.matchCompatibility = rule & MATCH_COMPATIBILITY_MASK;
79
		this.matchCompatibility = rule & MATCH_COMPATIBILITY_MASK;
80
		this.matchMode = rule & MATCH_MODE_MASK;
80
		this.matchMode = rule & MATCH_MODE_MASK;
81
	}
81
	}
Lines 84-106 Link Here
84
		return null;
84
		return null;
85
	}
85
	}
86
86
87
	int getMatchMode() {
87
	final int getMatchMode() {
88
		return this.matchMode;
88
		return this.matchMode;
89
	}
89
	}
90
90
91
	boolean isCamelCase() {
91
	final boolean isCamelCase() {
92
		return this.isCamelCase;
92
		return this.isCamelCase;
93
	}
93
	}
94
94
95
	boolean isCaseSensitive () {
95
	final boolean isCaseSensitive () {
96
		return this.isCaseSensitive;
96
		return this.isCaseSensitive;
97
	}
97
	}
98
98
99
	boolean isErasureMatch() {
99
	final boolean isErasureMatch() {
100
		return (this.matchCompatibility & R_ERASURE_MATCH) != 0;
100
		return (this.matchCompatibility & R_ERASURE_MATCH) != 0;
101
	}
101
	}
102
102
103
	boolean isEquivalentMatch() {
103
	final boolean isEquivalentMatch() {
104
		return (this.matchCompatibility & R_EQUIVALENT_MATCH) != 0;
104
		return (this.matchCompatibility & R_EQUIVALENT_MATCH) != 0;
105
	}
105
	}
106
106
(-)search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java (-1 / +2 lines)
Lines 98-106 Link Here
98
	char[] packageName = null;
98
	char[] packageName = null;
99
	if (this.isCamelCase) {
99
	if (this.isCamelCase) {
100
		packageName = CharOperation.concatWith(tokens, '.');
100
		packageName = CharOperation.concatWith(tokens, '.');
101
		if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName)) {
101
		if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
102
			return POSSIBLE_MATCH;
102
			return POSSIBLE_MATCH;
103
		}
103
		}
104
		if (this.isCaseSensitive) return IMPOSSIBLE_MATCH;
104
	}
105
	}
105
	switch (this.matchMode) {
106
	switch (this.matchMode) {
106
		case SearchPattern.R_EXACT_MATCH:
107
		case SearchPattern.R_EXACT_MATCH:
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java (-3 / +3 lines)
Lines 140-147 Link Here
140
140
141
	this(matchRule);
141
	this(matchRule);
142
142
143
	this.pkg = isCaseSensitive() ? pkg : CharOperation.toLowerCase(pkg);
143
	this.pkg = this.isCaseSensitive ? pkg : CharOperation.toLowerCase(pkg);
144
	if (isCaseSensitive() || enclosingTypeNames == null) {
144
	if (this.isCaseSensitive || enclosingTypeNames == null) {
145
		this.enclosingTypeNames = enclosingTypeNames;
145
		this.enclosingTypeNames = enclosingTypeNames;
146
	} else {
146
	} else {
147
		int length = enclosingTypeNames.length;
147
		int length = enclosingTypeNames.length;
Lines 149-155 Link Here
149
		for (int i = 0; i < length; i++)
149
		for (int i = 0; i < length; i++)
150
			this.enclosingTypeNames[i] = CharOperation.toLowerCase(enclosingTypeNames[i]);
150
			this.enclosingTypeNames[i] = CharOperation.toLowerCase(enclosingTypeNames[i]);
151
	}
151
	}
152
	this.simpleName = (isCaseSensitive() || isCamelCase())  ? simpleName : CharOperation.toLowerCase(simpleName);
152
	this.simpleName = (this.isCaseSensitive || this.isCamelCase) ? simpleName : CharOperation.toLowerCase(simpleName);
153
	this.typeSuffix = typeSuffix;
153
	this.typeSuffix = typeSuffix;
154
154
155
	((InternalSearchPattern)this).mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX;
155
	((InternalSearchPattern)this).mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX;
(-)search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java (-13 / +14 lines)
Lines 118-124 Link Here
118
public PatternLocator(SearchPattern pattern) {
118
public PatternLocator(SearchPattern pattern) {
119
	int matchRule = pattern.getMatchRule();
119
	int matchRule = pattern.getMatchRule();
120
	this.isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0;
120
	this.isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0;
121
	this.isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0;
121
	this.isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
122
	this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0;
122
	this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0;
123
	this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0;
123
	this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0;
124
	this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
124
	this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
Lines 282-305 Link Here
282
	boolean matchFirstChar = !this.isCaseSensitive || pattern[0] == name[0];
282
	boolean matchFirstChar = !this.isCaseSensitive || pattern[0] == name[0];
283
	boolean sameLength = pattern.length == name.length;
283
	boolean sameLength = pattern.length == name.length;
284
	boolean canBePrefix = name.length >= pattern.length;
284
	boolean canBePrefix = name.length >= pattern.length;
285
	if (this.isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(pattern, name)) {
285
	if (this.isCamelCase) {
286
		return POSSIBLE_MATCH;
286
		if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
287
			return POSSIBLE_MATCH;
288
		}
289
		if (this.isCaseSensitive) return IMPOSSIBLE_MATCH;
287
	}
290
	}
288
	switch (this.matchMode) {
291
	switch (this.matchMode) {
289
		case SearchPattern.R_EXACT_MATCH:
292
		case SearchPattern.R_EXACT_MATCH:
290
			if (!this.isCamelCase) {
293
			if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) {
291
				if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) {
294
				return POSSIBLE_MATCH | EXACT_FLAVOR;
292
					return POSSIBLE_MATCH | EXACT_FLAVOR;
293
				}
294
				break;
295
			}
295
			}
296
			// fall through next case to match as prefix if camel case failed
296
			break;
297
		case SearchPattern.R_PREFIX_MATCH:
297
		case SearchPattern.R_PREFIX_MATCH:
298
			if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) {
298
			if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) {
299
				return POSSIBLE_MATCH;
299
				return POSSIBLE_MATCH;
300
			}
300
			}
301
			break;
301
			break;
302
		case SearchPattern.R_PATTERN_MATCH:
302
		case SearchPattern.R_PATTERN_MATCH:
303
			// TODO_PERFS (frederic) Not sure this lowercase is necessary
303
			if (!this.isCaseSensitive) {
304
			if (!this.isCaseSensitive) {
304
				pattern = CharOperation.toLowerCase(pattern);
305
				pattern = CharOperation.toLowerCase(pattern);
305
			}
306
			}
Lines 717-729 Link Here
717
		}
718
		}
718
	}
719
	}
719
	if (this.isCamelCase) {
720
	if (this.isCamelCase) {
720
		if (!this.isCaseSensitive || (qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) {
721
		if ((qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) {
721
			if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName)) {
722
			if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
722
				return ACCURATE_MATCH;
723
				return ACCURATE_MATCH;
723
			}
724
			}
724
		}
725
		}
725
		if (this.matchMode == SearchPattern.R_EXACT_MATCH) {
726
		if (!this.isCaseSensitive && this.matchMode == SearchPattern.R_EXACT_MATCH) {
726
			boolean matchPattern = CharOperation.prefixEquals(qualifiedPattern, sourceName, this.isCaseSensitive);
727
			boolean matchPattern = CharOperation.equals(qualifiedPattern, sourceName, false);
727
			return matchPattern ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
728
			return matchPattern ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
728
		}
729
		}
729
	}
730
	}
(-)search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java (-1 / +1 lines)
Lines 31-37 Link Here
31
	return (combined & (R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH))
31
	return (combined & (R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH))
32
		| (combined & R_CASE_SENSITIVE)
32
		| (combined & R_CASE_SENSITIVE)
33
		| compatibility
33
		| compatibility
34
		| (combined & R_CAMELCASE_MATCH);
34
		| (combined & R_CAMEL_CASE_MATCH);
35
}
35
}
36
36
37
public AndPattern(SearchPattern leftPattern, SearchPattern rightPattern) {
37
public AndPattern(SearchPattern leftPattern, SearchPattern rightPattern) {
(-)search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java (-5 / +5 lines)
Lines 46-60 Link Here
46
46
47
	super(FIELD_PATTERN, findDeclarations, readAccess, writeAccess, name, matchRule);
47
	super(FIELD_PATTERN, findDeclarations, readAccess, writeAccess, name, matchRule);
48
48
49
	this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
49
	this.declaringQualification = this.isCaseSensitive ? declaringQualification : CharOperation.toLowerCase(declaringQualification);
50
	this.declaringSimpleName = isCaseSensitive() ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
50
	this.declaringSimpleName = this.isCaseSensitive ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName);
51
	this.typeQualification = isCaseSensitive() ? typeQualification : CharOperation.toLowerCase(typeQualification);
51
	this.typeQualification = this.isCaseSensitive ? typeQualification : CharOperation.toLowerCase(typeQualification);
52
	this.typeSimpleName = (isCaseSensitive() || isCamelCase())  ? typeSimpleName : CharOperation.toLowerCase(typeSimpleName);
52
	this.typeSimpleName = (this.isCaseSensitive || this.isCamelCase) ? typeSimpleName : CharOperation.toLowerCase(typeSimpleName);
53
53
54
	((InternalSearchPattern)this).mustResolve = mustResolve();
54
	((InternalSearchPattern)this).mustResolve = mustResolve();
55
}
55
}
56
/*
56
/*
57
 * Instanciate a field pattern with additional information for generics search
57
 * Instantiate a field pattern with additional information for generic search
58
 */
58
 */
59
public FieldPattern(
59
public FieldPattern(
60
	boolean findDeclarations,
60
	boolean findDeclarations,
(-)buildnotes_jdt-core.html (-1 / +277 lines)
Lines 46-54 Link Here
46
<br>Project org.eclipse.jdt.core v_809
46
<br>Project org.eclipse.jdt.core v_809
47
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_809">cvs</a>).
47
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_809">cvs</a>).
48
<h2>What's new in this drop</h2>
48
<h2>What's new in this drop</h2>
49
<ul>
50
<li>Prefix matching can be disabled while using Camel Case API methods. (see 
51
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=124624">bug 124624</a>).<br>
52
Following API methods have been added on <code>org.eclipse.jdt.core.compiler.CharOperation</code>:
53
<pre>
54
/**
55
 * Answers true if the pattern matches the given name using CamelCase rules, or
56
 * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
57
 * '*' and '?' and is inherently case sensitive.
58
 *
59
 * CamelCase denotes the convention of writing compound names without spaces,
60
 * and capitalizing every term. This function recognizes both upper and lower
61
 * CamelCase, depending whether the leading character is capitalized or not.
62
 * The leading part of an upper CamelCase pattern is assumed to contain a
63
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
64
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
65
 * uses a lowercase first character. In Java, type names follow the upper
66
 * CamelCase convention, whereas method or field names follow the lower
67
 * CamelCase convention.
68
 *
69
 * The pattern may contain lowercase characters, which will be match in a case
70
 * sensitive way. These characters must appear in sequence in the name.
71
 * For instance, 'NPExcep' will match 'NullPointerException', but not
72
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
73
 * 'NoPointerException'.
74
 *
75
 * Digit characters are treated in a special way. They can be used in the pattern
76
 * but are not always considered as leading character. For instance, both
77
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
78
 *
79
 * CamelCase may or may not match prefixes depending on the given parameter.
80
 * When the prefix match parameter is <code>true</code>, the given pattern can
81
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
82
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
83
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
84
 * and name must have <b>exactly</b> the same number of parts, and their last
85
 * parts must be identical if they contain lowercase characters.
86
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
87
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
88
 * lowercase characters, then the name may end with lowercase characters.
89
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
90
 * match 'HashMapEntry'.
91
 *
92
 * Examples:
93
 *  1.	pattern = { 'N', 'P', 'E' }
94
 *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
95
 *  	result => true
96
 *  2.	pattern = { 'N', 'P', 'E' }
97
 *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
98
 *  	result => true
99
 *  3.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
100
 *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
101
 *  	result => true
102
 *  4.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
103
 *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
104
 *  	result => false
105
 *  5.	pattern = { 'n', p', 'e' }
106
 *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
107
 *  	result => false
108
 *  6.	pattern = { 'I', 'P', 'L', '3' }
109
 *  	name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
110
 *  	result => true
111
 *  7.	pattern = { 'H', M' }
112
 *  	name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
113
 *  	result => (prefixMatch == true)
114
 *  8.	pattern = { 'H', M', 'a', 'p' }
115
 *  	name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
116
 *  	result => (prefixMatch == true)
117
 * 
118
 * @param pattern the given pattern
119
 * @param name the given name
120
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
121
 * 		. For example, when it's <code>true</code>:
122
 * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
123
 * 			  but not 'HashMapEntry'
124
 * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
125
 * 		. and, when it's <code>false</code>:
126
 * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
127
 * 			  and 'HashMapEntry'
128
 * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
129
 * 			  types.
130
 *
131
 * @return true if the pattern matches the given name, false otherwise
132
 * @since 3.4
133
 */
134
public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean prefixMatch) {
135
...
136
}
137
138
/**
139
 * Answers true if a sub-pattern matches the sub-part of the given name using 
140
 * CamelCase rules, or false otherwise.  char[] CamelCase matching does NOT
141
 * accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
142
 * Can match only subset of name/pattern, considering end positions as
143
 * non-inclusive. The sub-pattern is defined by the patternStart and patternEnd
144
 * positions.
145
 *
146
 * CamelCase denotes the convention of writing compound names without spaces,
147
 * and capitalizing every term. This function recognizes both upper and lower
148
 * CamelCase, depending whether the leading character is capitalized or not.
149
 * The leading part of an upper CamelCase pattern is assumed to contain
150
 * a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
151
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
152
 * uses a lowercase first character. In Java, type names follow the upper
153
 * CamelCase convention, whereas method or field names follow the lower
154
 * CamelCase convention.
155
 *
156
 * The pattern may contain lowercase characters, which will be match in a case
157
 * sensitive way. These characters must appear in sequence in the name.
158
 * For instance, 'NPExcep' will match 'NullPointerException', but not
159
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
160
 * 'NoPointerException'.
161
 *
162
 * Digit characters are treated in a special way. They can be used in the pattern
163
 * but are not always considered as leading character. For instance, both
164
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
165
 *
166
 * CamelCase may or may not match prefixes depending on the given parameter.
167
 * When the prefix match parameter is <code>true</code>, the given pattern can
168
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
169
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
170
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
171
 * and name must have <b>exactly</b> the same number of parts, and their last
172
 * parts must be identical if they contain lowercase characters.
173
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
174
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
175
 * lowercase characters, then the name may end with lowercase characters.
176
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
177
 * match 'HashMapEntry'.
178
 *
179
 * Examples:
180
 *  1.	pattern = { 'N', 'P', 'E' }
181
 *  	patternStart = 0
182
 *  	patternEnd = 3
183
 *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
184
 *  	nameStart = 0
185
 *  	nameEnd = 20
186
 *  	result => true
187
 *  2.	pattern = { 'N', 'P', 'E' }
188
 *  	patternStart = 0
189
 *  	patternEnd = 3
190
 *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
191
 *  	nameStart = 0
192
 *  	nameEnd = 21
193
 *  	result => true
194
 *  3.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
195
 *  	patternStart = 0
196
 *  	patternEnd = 6
197
 *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
198
 *  	nameStart = 0
199
 *  	nameEnd = 20
200
 *  	result => true
201
 *  4.	pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
202
 *  	patternStart = 0
203
 *  	patternEnd = 6
204
 *  	name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
205
 *  	nameStart = 0
206
 *  	nameEnd = 21
207
 *  	result => false
208
 *  5.	pattern = { 'n', p', 'e' }
209
 *  	patternStart = 0
210
 *  	patternEnd = 3
211
 *  	name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
212
 *  	nameStart = 20
213
 *  	nameEnd = 9
214
 *  	result => false
215
 *  6.	pattern = { 'I', 'P', 'L', '3' }
216
 *  	patternStart = 0
217
 *  	patternEnd = 4
218
 *  	name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
219
 *  	nameStart = 0
220
 *  	nameEnd = 21
221
 *  	result => true
222
 *  7.	pattern = { 'H', M' }
223
 *  	patternStart = 0
224
 *  	patternEnd = 2
225
 *  	name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
226
 *  	nameStart = 0
227
 *  	nameEnd = 12
228
 *  	result => (prefixMatch == true)
229
 *  8.	pattern = { 'H', M', 'a', 'p' }
230
 *  	patternStart = 0
231
 *  	patternEnd = 4
232
 *  	name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
233
 *  	nameStart = 0
234
 *  	nameEnd = 9
235
 *  	result => (prefixMatch == true)
236
 * 
237
 * @param pattern the given pattern
238
 * @param patternStart the start index of the pattern, inclusive
239
 * @param patternEnd the end index of the pattern, exclusive
240
 * @param name the given name
241
 * @param nameStart the start index of the name, inclusive
242
 * @param nameEnd the end index of the name, exclusive
243
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
244
 * 		. For example, when it's <code>true</code>:
245
 * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
246
 * 			  but not 'HashMapEntry'
247
 * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
248
 * 		. and, when it's <code>false</code>:
249
 * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
250
 * 			  and 'HashMapEntry'
251
 * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
252
 * 			  types.
253
 *
254
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
255
 * @since 3.4
256
 */
257
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean prefixMatch) {
258
...
259
}
260
</pre>
261
Note that same methods have been added on <code>SearchPattern</code> but with
262
<code>String</code> parameters instead of <code>char[]</code> ones (javadoc comments
263
are identical):
264
<pre>
265
public static final boolean camelCaseMatch(String pattern, String name, boolean prefixMatch) {
266
...
267
}
268
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch) {
269
...
270
}
271
</pre>
272
Note also that methods <code>camelCaseMatch(String, int, int, String, int, int)</code>
273
of <code>CharOperation</code> and <code>SearchPattern</code> classes have been
274
depreciated to avoid too many 'camelCaseMatch*' methods on these classes.
275
</li>
276
<li>Search Engine has been modified to better handle additional <code>SearchPattern</code>
277
constants while using Camel Case one (see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=200400">bug 200400</a>).<br>
278
Existing <code>SearchPattern#R_CAMELCASE_MATCH</code> constant has been depreciated and<br>
279
is <b>now replaced by <code>SearchPattern#R_CAMEL_CASE_MATCH</code></b>:<pre>
280
	/**
281
	 * Match rule: The search pattern contains a Camel Case expression with
282
	 * a strict number of parts and preventing automatic prefix matching for the last
283
	 * part (if it consists of multiple letters).
284
	 * 
285
	 * Examples:
286
	 * 	. 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
287
	 * 		but not 'HashMapEntry'
288
	 * 	. 'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'.
289
	 *
290
	 * This Camel Case match rule does not allow prefix match but accept insensitive
291
	 * case. For instance, 'HashMap' or 'HASHMAP' patterns using this Camel Case
292
	 * rule will match both 'HashMap' but not 'HashMapEntry'.
293
	 *
294
	 * This rule still can be combined to prefix match to accept prefix matches
295
	 * ('HashMap' pattern matching 'HashMapEntry' name). It can also be combined
296
	 * to case sensitive match to reject case insensitive matches ('HAMA' pattern
297
	 * will not match 'HashMap' name).
298
	 *
299
	 * If {@link #R_PATTERN_MATCH} rule is also combined, then the real used
300
	 * match rule will depend on whether string pattern contains specific pattern
301
	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will
302
	 * be used, otherwise only Camel Case match will be used.
303
	 * For example, with 'NPE' string pattern, search will only use
304
	 * Camel Case match rule, but with 'N*P*E*' string pattern, it will 
305
	 * use only Pattern match rule.
306
	 *
307
	 * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed
308
	 * explanation of Camel Case matching.
309
	 *
310
	 * @since 3.4
311
	 */
312
	public static final int R_CAMEL_CASE_MATCH = 0x0100;
313
</pre>
314
This change was necessary has the obsolete <code>R_CAMELCASE_MATCH</code> could
315
not support correctly additional constants as <code>R_PREFIX_MATCH</code> or 
316
<code>R_CASE_SENSITIVE</code>.<br>
317
However, this depreciated constant is still accepted for backward compatibility
318
but user is advised to replace it with <code>R_CAMEL_CASE_MATCH | R_PREFIX_MATCH</code>
319
</li>
320
</ul>
49
321
50
<h3>Problem Reports Fixed</h3>
322
<h3>Problem Reports Fixed</h3>
51
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=191739">191739</a>
323
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=200400">200400</a>
324
[search] Camel Case match prefix insensitive although spec says prefix sensitive
325
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=124624">124624</a>
326
[search] Camelcase matching routines should support end character
327
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=191739">191739</a>
52
"Duplicate nested type" bogus error on static class of abstract class or interface
328
"Duplicate nested type" bogus error on static class of abstract class or interface
53
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=200931">200931</a>
329
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=200931">200931</a>
54
GENERATED_BY references still exist in some javadoc comments
330
GENERATED_BY references still exist in some javadoc comments
(-)compiler/org/eclipse/jdt/core/compiler/CharOperation.java (-78 / +367 lines)
Lines 58-64 Link Here
58
 * </pre></li>
58
 * </pre></li>
59
 * </ol>
59
 * </ol>
60
 * 
60
 * 
61
 * @param array the array that is concanated with the suffix character
61
 * @param array the array that is concatenated with the suffix character
62
 * @param suffix the suffix character
62
 * @param suffix the suffix character
63
 * @return the new array
63
 * @return the new array
64
 */
64
 */
Lines 72-79 Link Here
72
}
72
}
73
73
74
/**
74
/**
75
 * Append the given subarray to the target array starting at the given index in the target array.
75
 * Append the given sub-array to the target array starting at the given index in the target array.
76
 * The start of the subarray is inclusive, the end is exclusive.
76
 * The start of the sub-array is inclusive, the end is exclusive.
77
 * Answers a new target array if it needs to grow, otherwise answers the same target array.
77
 * Answers a new target array if it needs to grow, otherwise answers the same target array.
78
 * <br>
78
 * <br>
79
 * For example:<br>
79
 * For example:<br>
Lines 178-230 Link Here
178
}
178
}
179
179
180
/**
180
/**
181
 * Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. 
181
 * Answers true if the pattern matches the given name using CamelCase rules, or
182
 * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive.
182
 * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
183
 * <br>
183
 * '*' and '?' and is inherently case sensitive.
184
 * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term.
184
 * <p>
185
 * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized
185
 * CamelCase denotes the convention of writing compound names without spaces,
186
 * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing
186
 * and capitalizing every term. This function recognizes both upper and lower
187
 * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
187
 * CamelCase, depending whether the leading character is capitalized or not.
188
 * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field
188
 * The leading part of an upper CamelCase pattern is assumed to contain a
189
 * names follow the lower CamelCase convention.
189
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
190
 * <br>
190
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
191
 * The pattern may contain lowercase characters, which will be match in a case sensitive way. These characters must
191
 * uses a lowercase first character. In Java, type names follow the upper
192
 * appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION'
192
 * CamelCase convention, whereas method or field names follow the lower
193
 * or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.
193
 * CamelCase convention.
194
 * <br><br>
194
 * <p>
195
 * Examples:
195
 * The pattern may contain lowercase characters, which will be matched in a case
196
 * <ol>
196
 * sensitive way. These characters must appear in sequence in the name.
197
 * <li><pre>
197
 * For instance, 'NPExcep' will match 'NullPointerException', but not
198
 *    pattern = { 'N', 'P', 'E' }
198
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
199
 *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
199
 * 'NoPointerException'.
200
 *    result => true
200
 * <p>
201
 * </pre>
201
 * Digit characters are treated in a special way. They can be used in the pattern
202
 * </li>
202
 * but are not always considered as leading character. For instance, both
203
 * <li><pre>
203
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
204
 *    pattern = { 'N', 'P', 'E' }
204
 * <p>
205
 *    name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
205
 * This method allows prefix match in Camel Case (see
206
 *    result => true
206
 * {@link #camelCaseMatch(char[], char[], boolean)}).
207
 * </pre>
207
 * <p>
208
 * </li>
208
 * <pre>
209
 * <li><pre>
209
 * Examples:<ol>
210
 *    pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
210
 * <li> pattern = { 'N', 'P', 'E' }
211
 *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
211
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
212
 *    result => true
212
 * result => true</li>
213
 * </pre>
213
 * <li> pattern = { 'N', 'P', 'E' }
214
 * </li>
214
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
215
 * <li><pre>
215
 * result => true</li>
216
 *    pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
216
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
217
 *    name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
217
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
218
 *    result => false
218
 * result => true</li>
219
 * </pre>
219
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
220
 * </li>
220
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
221
 * <li><pre>
221
 * result => false</li>
222
 *    pattern = { 'n', p', 'e' }
222
 * <li> pattern = { 'n', p', 'e' }
223
 *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
223
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
224
 *    result => false
224
 * result => false</li>
225
 * </pre>
225
 * <li> pattern = { 'I', 'P', 'L', '3' }
226
 * </li>
226
 * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
227
 * </ol>
227
 * result => true</li>
228
 * <li> pattern = { 'H', M' }
229
 * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
230
 * result => true</li>
231
 * <li>pattern = { 'H', M', 'a', 'p' }
232
 * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
233
 * result => true</li>
234
 * </ol></pre>
228
 * 
235
 * 
229
 * @param pattern the given pattern
236
 * @param pattern the given pattern
230
 * @param name the given name
237
 * @param name the given name
Lines 237-262 Link Here
237
	if (name == null)
244
	if (name == null)
238
		return false; // null name cannot match
245
		return false; // null name cannot match
239
246
240
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length);
247
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, true/*prefix match*/);
241
}
248
}
242
249
243
/**
250
/**
244
 * Answers true if a sub-pattern matches the subpart of the given name using CamelCase rules, or false otherwise.  
251
 * Answers true if the pattern matches the given name using CamelCase rules, or
245
 * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
252
 * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
253
 * '*' and '?' and is inherently case sensitive.
254
 * <p>
255
 * CamelCase denotes the convention of writing compound names without spaces,
256
 * and capitalizing every term. This function recognizes both upper and lower
257
 * CamelCase, depending whether the leading character is capitalized or not.
258
 * The leading part of an upper CamelCase pattern is assumed to contain a
259
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
260
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
261
 * uses a lowercase first character. In Java, type names follow the upper
262
 * CamelCase convention, whereas method or field names follow the lower
263
 * CamelCase convention.
264
 * <p>
265
 * The pattern may contain lowercase characters, which will be matched in a case
266
 * sensitive way. These characters must appear in sequence in the name.
267
 * For instance, 'NPExcep' will match 'NullPointerException', but not
268
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
269
 * 'NoPointerException'.
270
 * <p>
271
 * Digit characters are treated in a special way. They can be used in the pattern
272
 * but are not always considered as leading character. For instance, both
273
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
274
 * <p>
275
 * CamelCase may or may not match prefixes depending on the given parameter.
276
 * When the prefix match parameter is <code>true</code>, the given pattern can
277
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
278
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
279
 * <br>
280
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
281
 * and name must have <b>exactly</b> the same number of parts, and their last
282
 * parts must be identical if they contain lowercase characters.
283
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
284
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
285
 * lowercase characters, then the name may end with lowercase characters.
286
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
287
 * match 'HashMapEntry'.
288
 * <p>
289
 * <pre>
290
 * Examples:<ol>
291
 * <li> pattern = { 'N', 'P', 'E' }
292
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
293
 * result => true</li>
294
 * <li> pattern = { 'N', 'P', 'E' }
295
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
296
 * result => true</li>
297
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
298
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
299
 * result => true</li>
300
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
301
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
302
 * result => false</li>
303
 * <li> pattern = { 'n', p', 'e' }
304
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
305
 * result => false</li>
306
 * <li> pattern = { 'I', 'P', 'L', '3' }
307
 * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
308
 * result => true</li>
309
 * <li> pattern = { 'H', M' }
310
 * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
311
 * result => (prefixMatch == true)</li>
312
 * <li> pattern = { 'H', M', 'a', 'p' }
313
 * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
314
 * result => (prefixMatch == true)</li>
315
 * </ol></pre>
316
 * 
317
 * @param pattern the given pattern
318
 * @param name the given name
319
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
320
 * 	<ul>
321
 * 		<li>For example, when it's <code>true</code>:<br>
322
 * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
323
 * 			  but not 'HashMapEntry'<br>
324
 * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
325
 * 		</li>
326
 * 		<li>and, when it's <code>false</code>:<br>
327
 * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
328
 * 			  and 'HashMapEntry'<br>
329
 * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
330
 * 			  types.
331
 * 		</li>
332
 * 	</ul>
333
 * @return true if the pattern matches the given name, false otherwise
334
 * @since 3.4
335
 */
336
public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean prefixMatch) {
337
	if (pattern == null)
338
		return true; // null pattern is equivalent to '*'
339
	if (name == null)
340
		return false; // null name cannot match
341
342
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, prefixMatch);
343
}
344
345
/**
346
 * Answers true if a sub-pattern matches the sub-part of the given name using
347
 * CamelCase rules, or false otherwise.  char[] CamelCase matching does NOT
348
 * accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
246
 * Can match only subset of name/pattern, considering end positions as non-inclusive.
349
 * Can match only subset of name/pattern, considering end positions as non-inclusive.
247
 * The subpattern is defined by the patternStart and patternEnd positions.
350
 * The sub-pattern is defined by the patternStart and patternEnd positions.
248
 * <br>
351
 * <p>
249
 * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term.
352
 * CamelCase denotes the convention of writing compound names without spaces,
250
 * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized
353
 * and capitalizing every term. This function recognizes both upper and lower
251
 * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing
354
 * CamelCase, depending whether the leading character is capitalized or not.
252
 * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
355
 * The leading part of an upper CamelCase pattern is assumed to contain a
253
 * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field
356
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
254
 * names follow the lower CamelCase convention.
357
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
255
 * <br>
358
 * uses a lowercase first character. In Java, type names follow the upper
256
 * The pattern may contain lowercase characters, which will be match in a case sensitive way. These characters must
359
 * CamelCase convention, whereas method or field names follow the lower
257
 * appear in sequence in the name. For instance, 'NPExcep' will match 'NullPointerException', but not 'NullPointerExCEPTION'
360
 * CamelCase convention.
258
 * or 'NuPoEx' will match 'NullPointerException', but not 'NoPointerException'.
361
 * <p>
259
 * <br><br>
362
 * The pattern may contain lowercase characters, which will be matched in a case
363
 * sensitive way. These characters must appear in sequence in the name.
364
 * For instance, 'NPExcep' will match 'NullPointerException', but not
365
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
366
 * 'NoPointerException'.
367
 * <p>
368
 * Digit characters are treated in a special way. They can be used in the pattern
369
 * but are not always considered as leading character. For instance, both
370
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
371
 * <p>
372
 * Digit characters are treated in a special way. They can be used in the pattern
373
 * but are not always considered as leading character. For instance, both
374
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
375
 * <p>
376
 * This method allows prefix match in Camel Case (see
377
 * {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)}).
378
 * <p>
260
 * Examples:
379
 * Examples:
261
 * <ol>
380
 * <ol>
262
 * <li><pre>
381
 * <li><pre>
Lines 309-314 Link Here
309
 *    result => false
428
 *    result => false
310
 * </pre>
429
 * </pre>
311
 * </li>
430
 * </li>
431
 * <li><pre>
432
 *    pattern = { 'I', 'P', 'L', '3' }
433
 *    patternStart = 0
434
 *    patternEnd = 4
435
 *    name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
436
 *    nameStart = 0
437
 *    nameEnd = 21
438
 *    result => true
439
 * </pre>
440
 * </li>
312
 * </ol>
441
 * </ol>
313
 * 
442
 * 
314
 * @param pattern the given pattern
443
 * @param pattern the given pattern
Lines 317-326 Link Here
317
 * @param name the given name
446
 * @param name the given name
318
 * @param nameStart the start index of the name, inclusive
447
 * @param nameStart the start index of the name, inclusive
319
 * @param nameEnd the end index of the name, exclusive
448
 * @param nameEnd the end index of the name, exclusive
320
 * @return true if a sub-pattern matches the subpart of the given name, false otherwise
449
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
321
 * @since 3.2
450
 * @since 3.2
322
 */
451
 */
323
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) {
452
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) {
453
	return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, true/*prefix match*/);
454
}
455
456
/**
457
 * Answers true if a sub-pattern matches the sub-part of the given name using 
458
 * CamelCase rules, or false otherwise.  char[] CamelCase matching does NOT
459
 * accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
460
 * Can match only subset of name/pattern, considering end positions as
461
 * non-inclusive. The sub-pattern is defined by the patternStart and patternEnd
462
 * positions.
463
 * <p>
464
 * CamelCase denotes the convention of writing compound names without spaces,
465
 * and capitalizing every term. This function recognizes both upper and lower
466
 * CamelCase, depending whether the leading character is capitalized or not.
467
 * The leading part of an upper CamelCase pattern is assumed to contain
468
 * a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
469
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
470
 * uses a lowercase first character. In Java, type names follow the upper
471
 * CamelCase convention, whereas method or field names follow the lower
472
 * CamelCase convention.
473
 * <p>
474
 * The pattern may contain lowercase characters, which will be matched in a case
475
 * sensitive way. These characters must appear in sequence in the name.
476
 * For instance, 'NPExcep' will match 'NullPointerException', but not
477
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
478
 * 'NoPointerException'.
479
 * <p>
480
 * Digit characters are treated in a special way. They can be used in the pattern
481
 * but are not always considered as leading character. For instance, both
482
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
483
 * <p>
484
 * CamelCase may or may not match prefixes depending on the given parameter.
485
 * When the prefix match parameter is <code>true</code>, the given pattern can
486
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
487
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
488
 * <br>
489
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
490
 * and name must have <b>exactly</b> the same number of parts, and their last
491
 * parts must be identical if they contain lowercase characters.
492
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
493
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
494
 * lowercase characters, then the name may end with lowercase characters.
495
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
496
 * match 'HashMapEntry'.
497
 * <p>
498
 * <pre>
499
 * Examples:
500
 * <ol>
501
 * <li> pattern = { 'N', 'P', 'E' }
502
 * patternStart = 0
503
 * patternEnd = 3
504
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
505
 * nameStart = 0
506
 * nameEnd = 20
507
 * result => true</li>
508
 * <li> pattern = { 'N', 'P', 'E' }
509
 * patternStart = 0
510
 * patternEnd = 3
511
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
512
 * nameStart = 0
513
 * nameEnd = 21
514
 * result => true</li>
515
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
516
 * patternStart = 0
517
 * patternEnd = 6
518
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
519
 * nameStart = 0
520
 * nameEnd = 20
521
 * result => true</li>
522
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
523
 * patternStart = 0
524
 * patternEnd = 6
525
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
526
 * nameStart = 0
527
 * nameEnd = 21
528
 * result => false</li>
529
 * <li> pattern = { 'n', p', 'e' }
530
 * patternStart = 0
531
 * patternEnd = 3
532
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
533
 * nameStart = 0
534
 * nameEnd = 20
535
 * result => false</li>
536
 * <li> pattern = { 'I', 'P', 'L', '3' }
537
 * patternStart = 0
538
 * patternEnd = 4
539
 * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
540
 * nameStart = 0
541
 * nameEnd = 21
542
 * result => true</li>
543
 * <li> pattern = { 'H', M' }
544
 * patternStart = 0
545
 * patternEnd = 2
546
 * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
547
 * nameStart = 0
548
 * nameEnd = 12
549
 * result => (exactMode == false)</li>
550
 * <li> pattern = { 'H', M', 'a', 'p' }
551
 * patternStart = 0
552
 * patternEnd = 4
553
 * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
554
 * nameStart = 0
555
 * nameEnd = 9
556
 * result => (exactMode == false)</li>
557
 * </ol>
558
 * </pre>
559
 * 
560
 * @param pattern the given pattern
561
 * @param patternStart the start index of the pattern, inclusive
562
 * @param patternEnd the end index of the pattern, exclusive
563
 * @param name the given name
564
 * @param nameStart the start index of the name, inclusive
565
 * @param nameEnd the end index of the name, exclusive
566
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
567
 * 	<ul>
568
 * 		<li>For example, when it's <code>true</code>:<br>
569
 * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
570
 * 			  but not 'HashMapEntry'<br>
571
 * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
572
 * 		</li>
573
 * 		<li>and, when it's <code>false</code>:<br>
574
 * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
575
 * 			  and 'HashMapEntry'<br>
576
 * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
577
 * 			  types.
578
 * 		</li>
579
 * 	</ul>
580
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
581
 * @since 3.4
582
 */
583
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean prefixMatch) {
324
	if (name == null)
584
	if (name == null)
325
		return false; // null name cannot match
585
		return false; // null name cannot match
326
	if (pattern == null)
586
	if (pattern == null)
Lines 346-354 Link Here
346
		iPattern++;
606
		iPattern++;
347
		iName++;
607
		iName++;
348
608
349
		if (iPattern == patternEnd) {
609
		if (iPattern == patternEnd) { // we have exhausted pattern...
350
			// We have exhausted pattern, so it's a match
610
			// it's a match if not exact mode or name is also exhausted
351
			return true;
611
			if (prefixMatch || iName == nameEnd) return true;
612
613
			// it's not a match if last pattern character is a lowercase
614
			if ((patternChar = pattern[iPattern-1]) < ScannerHelper.MAX_OBVIOUS) {
615
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) {
616
					return false;
617
				}
618
			}
619
			else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) {
620
				return false;
621
			}
622
623
			// it's a match only if name has no more uppercase characters (exact mode)
624
			while (true) {
625
				if (iName == nameEnd) {
626
					// we have exhausted name, so it's a match
627
					return true;
628
				}
629
				nameChar = name[iName];
630
				if (nameChar < ScannerHelper.MAX_OBVIOUS) {
631
					if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) {
632
						// nameChar is uppercase, so it's not a match
633
						return false;
634
					}
635
				}
636
				else if (!Character.isJavaIdentifierPart(nameChar) || Character.isUpperCase(nameChar)) {
637
					return false;
638
				}
639
				iName++;
640
			}
352
		}
641
		}
353
642
354
		if (iName == nameEnd){
643
		if (iName == nameEnd){
Lines 873-879 Link Here
873
 * </ol>
1162
 * </ol>
874
 * 
1163
 * 
875
 * @param prefix the prefix character
1164
 * @param prefix the prefix character
876
 * @param array the array that is concanated with the prefix and suffix characters
1165
 * @param array the array that is concatenated with the prefix and suffix characters
877
 * @param suffix the suffix character
1166
 * @param suffix the suffix character
878
 * @return the new array
1167
 * @return the new array
879
 */
1168
 */
Lines 2700-2706 Link Here
2700
2989
2701
/**
2990
/**
2702
 * Answers a new array removing a given character. Answers the given array if there is
2991
 * Answers a new array removing a given character. Answers the given array if there is
2703
 * no occurence of the character to remove.
2992
 * no occurrence of the character to remove.
2704
 * <br>
2993
 * <br>
2705
 * <br>
2994
 * <br>
2706
 * For example:
2995
 * For example:
Lines 2749-2755 Link Here
2749
}
3038
}
2750
3039
2751
/**
3040
/**
2752
 * Replace all occurrence of the character to be replaced with the remplacement character in the
3041
 * Replace all occurrence of the character to be replaced with the replacement character in the
2753
 * given array.
3042
 * given array.
2754
 * <br>
3043
 * <br>
2755
 * <br>
3044
 * <br>
Lines 2789-2795 Link Here
2789
}
3078
}
2790
3079
2791
/**
3080
/**
2792
 * Replace all occurrences of characters to be replaced with the remplacement character in the
3081
 * Replace all occurrences of characters to be replaced with the replacement character in the
2793
 * given array.
3082
 * given array.
2794
 * <br>
3083
 * <br>
2795
 * <br>
3084
 * <br>
Lines 2815-2821 Link Here
2815
}
3104
}
2816
3105
2817
/**
3106
/**
2818
 * Replace all occurrences of characters to be replaced with the remplacement character in the
3107
 * Replace all occurrences of characters to be replaced with the replacement character in the
2819
 * given array from the start position (inclusive) to the end position (exclusive).
3108
 * given array from the start position (inclusive) to the end position (exclusive).
2820
 * <br>
3109
 * <br>
2821
 * <br>
3110
 * <br>
Lines 2933-2939 Link Here
2933
}
3222
}
2934
3223
2935
/**
3224
/**
2936
 * Replace all occurrence of the character to be replaced with the remplacement character 
3225
 * Replace all occurrence of the character to be replaced with the replacement character 
2937
 * in a copy of the given array. Returns the given array if no occurrences of the character
3226
 * in a copy of the given array. Returns the given array if no occurrences of the character
2938
 * to be replaced are found.
3227
 * to be replaced are found.
2939
 * <br>
3228
 * <br>
Lines 2985-2991 Link Here
2985
}
3274
}
2986
3275
2987
/**
3276
/**
2988
 * Return a new array which is the split of the given array using the given divider and triming each subarray to remove
3277
 * Return a new array which is the split of the given array using the given divider and trimming each subarray to remove
2989
 * whitespaces equals to ' '.
3278
 * whitespaces equals to ' '.
2990
 * <br>
3279
 * <br>
2991
 * <br>
3280
 * <br>
Lines 3019-3025 Link Here
3019
 * 
3308
 * 
3020
 * @param divider the given divider
3309
 * @param divider the given divider
3021
 * @param array the given array
3310
 * @param array the given array
3022
 * @return a new array which is the split of the given array using the given divider and triming each subarray to remove
3311
 * @return a new array which is the split of the given array using the given divider and trimming each subarray to remove
3023
 * whitespaces equals to ' '
3312
 * whitespaces equals to ' '
3024
 */
3313
 */
3025
public static final char[][] splitAndTrimOn(char divider, char[] array) {
3314
public static final char[][] splitAndTrimOn(char divider, char[] array) {
(-)search/org/eclipse/jdt/core/search/SearchPattern.java (-82 / +665 lines)
Lines 32-43 Link Here
32
 * then created (see {@link #getBlankPattern()}). This blank pattern is used as a record as follows.
32
 * then created (see {@link #getBlankPattern()}). This blank pattern is used as a record as follows.
33
 * For each index entry in the given index categories and that starts with the given key, the blank pattern is fed using 
33
 * For each index entry in the given index categories and that starts with the given key, the blank pattern is fed using 
34
 * {@link #decodeIndexKey(char[])}. The original pattern is then asked if it matches the decoded key using
34
 * {@link #decodeIndexKey(char[])}. The original pattern is then asked if it matches the decoded key using
35
 * {@link #matchesDecodedKey(SearchPattern)}. If it matches, a search doument is created for this index entry
35
 * {@link #matchesDecodedKey(SearchPattern)}. If it matches, a search document is created for this index entry
36
 * using {@link SearchParticipant#getDocument(String)}.
36
 * using {@link SearchParticipant#getDocument(String)}.
37
 * 
37
 * 
38
 * </p><p>
38
 * </p><p>
39
 * This class is intended to be subclassed by clients. A default behavior is provided for each of the methods above, that
39
 * This class is intended to be sub-classed by clients. A default behavior is provided for each of the methods above, that
40
 * clients can ovveride if they wish.
40
 * clients can override if they wish.
41
 * </p>
41
 * </p>
42
 * @see #createPattern(org.eclipse.jdt.core.IJavaElement, int)
42
 * @see #createPattern(org.eclipse.jdt.core.IJavaElement, int)
43
 * @see #createPattern(String, int, int, int)
43
 * @see #createPattern(String, int, int, int)
Lines 141-174 Link Here
141
141
142
	/**
142
	/**
143
	 * Match rule: The search pattern contains a Camel Case expression.
143
	 * Match rule: The search pattern contains a Camel Case expression.
144
	 * <br>
144
	 * <p>
145
	 * Examples:
145
	 * Examples:
146
	 * <ul>
146
	 * <ul>
147
	 * 	<li><code>NPE</code> type string pattern will match
147
	 * 	<li>'NPE' type string pattern will match
148
	 * 		<code>NullPointerException</code> and <code>NpPermissionException</code> types,</li>
148
	 * 		'NullPointerException' and 'NoPermissionException' types,</li>
149
	 * 	<li><code>NuPoEx</code> type string pattern will only match
149
	 * 	<li>'NuPoEx' type string pattern will only match
150
	 * 		<code>NullPointerException</code> type.</li>
150
	 * 		'NullPointerException' type.</li>
151
	 * </ul>
151
	 * </ul>
152
	 * @see CharOperation#camelCaseMatch(char[], char[]) for a detailed explanation
152
	 *
153
	 * of Camel Case matching.
153
	 * This Camel Case match rule also accepts both prefix and case insensitive
154
	 *<br>
154
	 * matches. For instance 'HashMap' or 'HASHMAP' pattern using Camel Case rule will match
155
	 * Can be combined to {@link #R_PREFIX_MATCH} match rule. For example,
155
	 * both 'HashMap' and 'HashMapEntry'.
156
	 * when prefix match rule is combined with Camel Case match rule,
156
	 *<p>
157
	 * <code>"nPE"</code> pattern will match <code>nPException</code>.
158
	 *<br>
159
	 * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules
157
	 * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules
160
	 * will not be used simultaneously as they are mutually exclusive.
158
	 * will not be used simultaneously as they are mutually exclusive.
161
	 * Used match rule depends on whether string pattern contains specific pattern 
159
	 * Used match rule depends on whether string pattern contains specific pattern 
162
	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule
160
	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule
163
	 * will be used, otherwise only Camel Case match will be used.
161
	 * will be used, otherwise only Camel Case match will be used.
164
	 * For example, with <code>"NPE"</code> string pattern, search will only use
162
	 * For example, with 'NPE' string pattern, search will only use
165
	 * Camel Case match rule, but with <code>N*P*E*</code> string pattern, it will 
163
	 * Camel Case match rule, but with 'N*P*E*' string pattern, it will 
166
	 * use only Pattern match rule.
164
	 * use only Pattern match rule.
165
	 * <p>
166
	 * @see #camelCaseMatch(String, String) for a detailed explanation of Camel
167
	 * 	Case matching.
167
	 * 
168
	 * 
168
	 * @since 3.2
169
	 * @since 3.2
170
	 * @deprecated Use <code>{@link #R_CAMEL_CASE_MATCH} | 
171
	 * 	{@link #R_PREFIX_MATCH}</code> instead.
169
	 */
172
	 */
170
	public static final int R_CAMELCASE_MATCH = 0x0080;
173
	public static final int R_CAMELCASE_MATCH = 0x0080;
171
174
175
	/**
176
	 * Match rule: The search pattern contains a Camel Case expression with
177
	 * a strict number of parts and preventing automatic prefix matching for the last
178
	 * part (if it consists of multiple letters).
179
	 * <br>
180
	 * Examples:
181
	 * <ul>
182
	 * 	<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
183
	 * 		but not 'HashMapEntry'
184
	 * 	</li>
185
	 * 	<li>'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'.
186
	 * 	</li>
187
	 * </ul>
188
	 *
189
	 * This Camel Case match rule does not allow prefix match but accept insensitive
190
	 * case. For instance, 'HashMap' or 'HASHMAP' patterns using this Camel Case
191
	 * rule will match both 'HashMap' but not 'HashMapEntry'.
192
	 * <p>
193
	 * This rule still can be combined to prefix match to accept prefix matches
194
	 * ('HashMap' pattern matching 'HashMapEntry' name). It can also be combined
195
	 * to case sensitive match to reject case insensitive matches ('HAMA' pattern
196
	 * will not match 'HashMap' name).
197
	 *<p>
198
	 * If {@link #R_PATTERN_MATCH} rule is also combined, then the real used
199
	 * match rule will depend on whether string pattern contains specific pattern
200
	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will
201
	 * be used, otherwise only Camel Case match will be used.<br>
202
	 * For example, with 'NPE' string pattern, search will only use
203
	 * Camel Case match rule, but with 'N*P*E*' string pattern, it will 
204
	 * use only Pattern match rule.
205
	 *<p>
206
	 * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed
207
	 * explanation of Camel Case matching.
208
	 *<p>
209
	 * @since 3.4
210
	 */
211
	public static final int R_CAMEL_CASE_MATCH = 0x0100;
212
172
	private static final int MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH;
213
	private static final int MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH;
173
214
174
	private int matchRule;
215
	private int matchRule;
Lines 178-188 Link Here
178
 * It can be exact match, prefix match, pattern match or regexp match.
219
 * It can be exact match, prefix match, pattern match or regexp match.
179
 * Rule can also be combined with a case sensitivity flag.
220
 * Rule can also be combined with a case sensitivity flag.
180
 * 
221
 * 
181
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH}, {@link #R_PATTERN_MATCH},
222
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH},
182
 * 	{@link #R_REGEXP_MATCH}, {@link #R_CAMELCASE_MATCH} combined with one of following values:
223
 * 	{@link #R_PATTERN_MATCH}, {@link #R_REGEXP_MATCH} combined with
183
 * 	{@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH}.
224
 * 	one of following values: {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH},
184
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
225
 * 	{@link #R_EQUIVALENT_MATCH} or {@link #R_CAMEL_CASE_MATCH}.
185
 *		{@link #R_PREFIX_MATCH} if a prefix non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
226
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact
227
 *		and case sensitive match is requested, {@link #R_PREFIX_MATCH} if a prefix
228
 *		non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
186
 *		if a non case sensitive and erasure match is requested.<br>
229
 *		if a non case sensitive and erasure match is requested.<br>
187
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
230
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
188
 * 	on non-generic types/methods search.<br>
231
 * 	on non-generic types/methods search.<br>
Lines 194-206 Link Here
194
	if ((matchRule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) {
237
	if ((matchRule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) {
195
		this.matchRule |= R_FULL_MATCH;
238
		this.matchRule |= R_FULL_MATCH;
196
	}
239
	}
240
	this.matchRule = updateMatchRule(this.matchRule);
197
}
241
}
198
242
199
/**
243
/**
200
 * Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. 
244
 * Answers true if the pattern matches the given name using CamelCase rules, or
201
 * CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive.
245
 * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
246
 * '*' and '?' and is inherently case sensitive.
247
 * <p>
248
 * CamelCase denotes the convention of writing compound names without spaces,
249
 * and capitalizing every term. This function recognizes both upper and lower
250
 * CamelCase, depending whether the leading character is capitalized or not.
251
 * The leading part of an upper CamelCase pattern is assumed to contain a
252
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
253
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
254
 * uses a lowercase first character. In Java, type names follow the upper
255
 * CamelCase convention, whereas method or field names follow the lower
256
 * CamelCase convention.
257
 * <p>
258
 * The pattern may contain lowercase characters, which will be matched in a case
259
 * sensitive way. These characters must appear in sequence in the name.
260
 * For instance, 'NPExcep' will match 'NullPointerException', but not
261
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
262
 * 'NoPointerException'.
263
 * <p>
264
 * Digit characters are treated in a special way. They can be used in the pattern
265
 * but are not always considered as leading character. For instance, both
266
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
267
 * <p>
268
 * This method allows prefix match in Camel Case (see
269
 * {@link #camelCaseMatch(String, String, boolean)}).
270
 * <p>
271
 * <pre>
272
 * Examples:
273
 * <ol><li>  pattern = "NPE"
274
 *  name = NullPointerException / NoPermissionException
275
 *  result => true</li>
276
 * <li>  pattern = "NuPoEx"
277
 *  name = NullPointerException
278
 *  result => true</li>
279
 * <li>  pattern = "npe"
280
 *  name = NullPointerException
281
 *  result => false</li>
282
 * <li>  pattern = "IPL3"
283
 *  name = "IPerspectiveListener3"
284
 *  result => true</li>
285
 * <li>  pattern = "HM"
286
 *  name = "HashMapEntry"
287
 *  result => true</li>
288
 * <li>  pattern = "HMap"
289
 *  name = "HatMapper"
290
 *  result => true</li>
291
 * </ol></pre>
202
 * 
292
 * 
203
 * @see CharOperation#camelCaseMatch(char[], char[])
293
 * @see #camelCaseMatch(String, int, int, String, int, int, boolean) for algorithm
294
 * implementation
204
 * 
295
 * 
205
 * @param pattern the given pattern
296
 * @param pattern the given pattern
206
 * @param name the given name
297
 * @param name the given name
Lines 213-229 Link Here
213
	if (name == null)
304
	if (name == null)
214
		return false; // null name cannot match
305
		return false; // null name cannot match
215
306
216
	return CharOperation.camelCaseMatch(pattern.toCharArray(), 0, pattern.length(), name.toCharArray(), 0, name.length());
307
	return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), true/*prefix match*/);
217
}
308
}
218
309
219
/**
310
/**
220
 * Answers true if a sub-pattern matches the subpart of the given name using CamelCase rules, or false otherwise.  
311
 * Answers true if the pattern matches the given name using CamelCase rules, or
221
 * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
312
 * false otherwise. char[] CamelCase matching does NOT accept explicit wild-cards
222
 * Can match only subset of name/pattern, considering end positions as non-inclusive.
313
 * '*' and '?' and is inherently case sensitive.
223
 * The subpattern is defined by the patternStart and patternEnd positions.
314
 * <p>
315
 * CamelCase denotes the convention of writing compound names without spaces,
316
 * and capitalizing every term. This function recognizes both upper and lower
317
 * CamelCase, depending whether the leading character is capitalized or not.
318
 * The leading part of an upper CamelCase pattern is assumed to contain a
319
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
320
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
321
 * uses a lowercase first character. In Java, type names follow the upper
322
 * CamelCase convention, whereas method or field names follow the lower
323
 * CamelCase convention.
324
 * <p>
325
 * The pattern may contain lowercase characters, which will be matched in a case
326
 * sensitive way. These characters must appear in sequence in the name.
327
 * For instance, 'NPExcep' will match 'NullPointerException', but not
328
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
329
 * 'NoPointerException'.
330
 * <p>
331
 * Digit characters are treated in a special way. They can be used in the pattern
332
 * but are not always considered as leading character. For instance, both
333
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
334
 * <p>
335
 * CamelCase may or may not match prefixes depending on the given parameter.
336
 * When the prefix match parameter is <code>true</code>, the given pattern can
337
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
338
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
339
 * <br>
340
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
341
 * and name must have <b>exactly</b> the same number of parts, and their last
342
 * parts must be identical if they contain lowercase characters.
343
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
344
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
345
 * lowercase characters, then the name may end with lowercase characters.
346
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
347
 * match 'HashMapEntry'.
348
 * <p>
349
 * <pre>
350
 * Examples:
351
 * <ol><li>  pattern = "NPE"
352
 *  name = NullPointerException / NoPermissionException
353
 *  result => true</li>
354
 * <li>  pattern = "NuPoEx"
355
 *  name = NullPointerException
356
 *  result => true</li>
357
 * <li>  pattern = "npe"
358
 *  name = NullPointerException
359
 *  result => false</li>
360
 * <li>  pattern = "IPL3"
361
 *  name = "IPerspectiveListener3"
362
 *  result => true</li>
363
 * <li>  pattern = "HM"
364
 *  name = "HashMapEntry"
365
 *  result => (prefixMatch == true)</li>
366
 * <li>  pattern = "HMap"
367
 *  name = "HatMapper"
368
 *  result => (prefixMatch == true)</li>
369
 * </ol></pre>
224
 * 
370
 * 
225
 * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int) for specification
371
 * @see #camelCaseMatch(String, int, int, String, int, int, boolean) for algorithm
226
 * and implementation of this algorithm.
372
 * 	implementation
373
 * 
374
 * @param pattern the given pattern
375
 * @param name the given name
376
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
377
 * 	<ul>
378
 * 		<li>For example, when it's <code>true</code>:<br>
379
 * 			- <code>HM</code> type string pattern will match
380
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types,
381
 * 			  but not <code>HashMapEntry</code><br>
382
 * 			- <code>HMap</code> type string pattern will match
383
 * 			  <code>HashMap</code> type but not <code>HtmlMapper</code>.
384
 * 		</li>
385
 * 		<li>and, when it's <code>false</code>:<br>
386
 * 			- <code>HM</code> type string pattern will match both 
387
 * 			  <code>HashMap</code> and <code>HtmlMapper</code>
388
 * 			  and <code>HashMapEntry</code><br>
389
 * 			- <code>HMap</code> type string pattern will match both
390
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types.
391
 * 		</li>
392
 * 	</ul>
393
 * @return true if the pattern matches the given name, false otherwise
394
 * @since 3.4
395
 */
396
public static final boolean camelCaseMatch(String pattern, String name, boolean prefixMatch) {
397
	if (pattern == null)
398
		return true; // null pattern is equivalent to '*'
399
	if (name == null)
400
		return false; // null name cannot match
401
402
	return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), prefixMatch);
403
}
404
405
/**
406
 * Answers true if a sub-pattern matches the sub-part of the given name using
407
 * CamelCase rules, or false otherwise.  char[] CamelCase matching does NOT
408
 * accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
409
 * Can match only subset of name/pattern, considering end positions as non-inclusive.
410
 * The sub-pattern is defined by the patternStart and patternEnd positions.
411
 * <p>
412
 * CamelCase denotes the convention of writing compound names without spaces,
413
 * and capitalizing every term. This function recognizes both upper and lower
414
 * CamelCase, depending whether the leading character is capitalized or not.
415
 * The leading part of an upper CamelCase pattern is assumed to contain a
416
 * sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
417
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
418
 * uses a lowercase first character. In Java, type names follow the upper
419
 * CamelCase convention, whereas method or field names follow the lower
420
 * CamelCase convention.
421
 * <p>
422
 * The pattern may contain lowercase characters, which will be matched in a case
423
 * sensitive way. These characters must appear in sequence in the name.
424
 * For instance, 'NPExcep' will match 'NullPointerException', but not
425
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
426
 * 'NoPointerException'.
427
 * <p>
428
 * Digit characters are treated in a special way. They can be used in the pattern
429
 * but are not always considered as leading character. For instance, both
430
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
431
 * <p>
432
 * Digit characters are treated in a special way. They can be used in the pattern
433
 * but are not always considered as leading character. For instance, both
434
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
435
 * <p>
436
 * This method allows prefix match in Camel Case (see
437
 * {@link #camelCaseMatch(String, int, int, String, int, int, boolean)}).
438
 * <p>
439
 * <pre>Examples:<ol>
440
 * <li>  pattern = "NPE"
441
 *  patternStart = 0
442
 *  patternEnd = 3
443
 *  name = NullPointerException
444
 *  nameStart = 0
445
 *  nameEnd = 20
446
 *  result => true</li>
447
 * <li>  pattern = "NPE"
448
 *  patternStart = 0
449
 *  patternEnd = 3
450
 *  name = NoPermissionException
451
 *  nameStart = 0
452
 *  nameEnd = 21
453
 *  result => true</li>
454
 * <li>  pattern = "NuPoEx"
455
 *  patternStart = 0
456
 *  patternEnd = 6
457
 *  name = NullPointerException
458
 *  nameStart = 0
459
 *  nameEnd = 20
460
 *  result => true</li>
461
 * <li>  pattern = "NuPoEx"
462
 *  patternStart = 0
463
 *  patternEnd = 6
464
 *  name = NoPermissionException
465
 *  nameStart = 0
466
 *  nameEnd = 21
467
 *  result => false</li>
468
 * <li>  pattern = "npe"
469
 *  patternStart = 0
470
 *  patternEnd = 3
471
 *  name = NullPointerException
472
 *  nameStart = 0
473
 *  nameEnd = 20
474
 *  result => false</li>
475
 * <li>  pattern = "IPL3"
476
 *  patternStart = 0
477
 *  patternEnd = 3
478
 *  name = "IPerspectiveListener3"
479
 *  nameStart = 0
480
 *  nameEnd = 21
481
 *  result => true</li>
482
 * <li>  pattern = "HM"
483
 *  patternStart = 0
484
 *  patternEnd = 2
485
 *  name = "HashMapEntry"
486
 *  nameStart = 0
487
 *  nameEnd = 12
488
 *  result => true</li>
489
 * <li>  pattern = "HMap"
490
 *  patternStart = 0
491
 *  patternEnd = 4
492
 *  name = "HatMapper"
493
 *  nameStart = 0
494
 *  nameEnd = 9
495
 *  result => true</li>
496
 * </ol></pre>
227
 * 
497
 * 
228
 * @param pattern the given pattern
498
 * @param pattern the given pattern
229
 * @param patternStart the start index of the pattern, inclusive
499
 * @param patternStart the start index of the pattern, inclusive
Lines 231-241 Link Here
231
 * @param name the given name
501
 * @param name the given name
232
 * @param nameStart the start index of the name, inclusive
502
 * @param nameStart the start index of the name, inclusive
233
 * @param nameEnd the end index of the name, exclusive
503
 * @param nameEnd the end index of the name, exclusive
234
 * @return true if a sub-pattern matches the subpart of the given name, false otherwise
504
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
235
 * @since 3.2
505
 * @since 3.2
236
 */
506
 */
237
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) {
507
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) {
238
	return CharOperation.camelCaseMatch(pattern.toCharArray(), patternStart, patternEnd, name.toCharArray(), nameStart, nameEnd);
508
	return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, true/*prefix match*/);
509
}
510
511
/**
512
 * Answers true if a sub-pattern matches the sub-part of the given name using 
513
 * CamelCase rules, or false otherwise.  char[] CamelCase matching does NOT
514
 * accept explicit wild-cards '*' and '?' and is inherently case sensitive. 
515
 * Can match only subset of name/pattern, considering end positions as
516
 * non-inclusive. The sub-pattern is defined by the patternStart and patternEnd
517
 * positions.
518
 * <p>
519
 * CamelCase denotes the convention of writing compound names without spaces,
520
 * and capitalizing every term. This function recognizes both upper and lower
521
 * CamelCase, depending whether the leading character is capitalized or not.
522
 * The leading part of an upper CamelCase pattern is assumed to contain
523
 * a sequence of capitals which are appearing in the matching name; e.g. 'NPE' will
524
 * match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern
525
 * uses a lowercase first character. In Java, type names follow the upper
526
 * CamelCase convention, whereas method or field names follow the lower
527
 * CamelCase convention.
528
 * <p>
529
 * The pattern may contain lowercase characters, which will be matched in a case
530
 * sensitive way. These characters must appear in sequence in the name.
531
 * For instance, 'NPExcep' will match 'NullPointerException', but not
532
 * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
533
 * 'NoPointerException'.
534
 * <p>
535
 * Digit characters are treated in a special way. They can be used in the pattern
536
 * but are not always considered as leading character. For instance, both
537
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
538
 * <p>
539
 * CamelCase may or may not match prefixes depending on the given parameter.
540
 * When the prefix match parameter is <code>true</code>, the given pattern can
541
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
542
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
543
 * <br>
544
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
545
 * and name must have <b>exactly</b> the same number of parts, and their last
546
 * parts must be identical if they contain lowercase characters.
547
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
548
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
549
 * lowercase characters, then the name may end with lowercase characters.
550
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
551
 * match 'HashMapEntry'.
552
 * <p>
553
 * <pre>Examples:<ol>
554
 * <li>  pattern = "NPE"
555
 *  patternStart = 0
556
 *  patternEnd = 3
557
 *  name = NullPointerException
558
 *  nameStart = 0
559
 *  nameEnd = 20
560
 *  result => true</li>
561
 * <li>  pattern = "NPE"
562
 *  patternStart = 0
563
 *  patternEnd = 3
564
 *  name = NoPermissionException
565
 *  nameStart = 0
566
 *  nameEnd = 21
567
 *  result => true</li>
568
 * <li>  pattern = "NuPoEx"
569
 *  patternStart = 0
570
 *  patternEnd = 6
571
 *  name = NullPointerException
572
 *  nameStart = 0
573
 *  nameEnd = 20
574
 *  result => true</li>
575
 * <li>  pattern = "NuPoEx"
576
 *  patternStart = 0
577
 *  patternEnd = 6
578
 *  name = NoPermissionException
579
 *  nameStart = 0
580
 *  nameEnd = 21
581
 *  result => false</li>
582
 * <li>  pattern = "npe"
583
 *  patternStart = 0
584
 *  patternEnd = 3
585
 *  name = NullPointerException
586
 *  nameStart = 0
587
 *  nameEnd = 20
588
 *  result => false</li>
589
 * <li>  pattern = "IPL3"
590
 *  patternStart = 0
591
 *  patternEnd = 3
592
 *  name = "IPerspectiveListener3"
593
 *  nameStart = 0
594
 *  nameEnd = 21
595
 *  result => true</li>
596
 * <li>  pattern = "HM"
597
 *  patternStart = 0
598
 *  patternEnd = 2
599
 *  name = "HashMapEntry"
600
 *  nameStart = 0
601
 *  nameEnd = 12
602
 *  result => (prefixMatch == true)</li>
603
 * <li>  pattern = "HMap"
604
 *  patternStart = 0
605
 *  patternEnd = 4
606
 *  name = "HatMapper"
607
 *  nameStart = 0
608
 *  nameEnd = 9
609
 *  result => (prefixMatch == true)</li>
610
 * </ol></pre>
611
 * 
612
 * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean)
613
 * 	from which algorithm implementation has been entirely copied.
614
 * 
615
 * @param pattern the given pattern
616
 * @param patternStart the start index of the pattern, inclusive
617
 * @param patternEnd the end index of the pattern, exclusive
618
 * @param name the given name
619
 * @param nameStart the start index of the name, inclusive
620
 * @param nameEnd the end index of the name, exclusive
621
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
622
 * 	<ul>
623
 * 		<li>For example, when it's <code>true</code>:<br>
624
 * 			- <code>HM</code> type string pattern will match
625
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types,
626
 * 			  but not <code>HashMapEntry</code><br>
627
 * 			- <code>HMap</code> type string pattern will match
628
 * 			  <code>HashMap</code> type but not <code>HtmlMapper</code>.
629
 * 		</li>
630
 * 		<li>and, when it's <code>false</code>:<br>
631
 * 			- <code>HM</code> type string pattern will match both 
632
 * 			  <code>HashMap</code> and <code>HtmlMapper</code>
633
 * 			  and <code>HashMapEntry</code><br>
634
 * 			- <code>HMap</code> type string pattern will match both
635
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types.
636
 * 		</li>
637
 * 	</ul>
638
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
639
 * @since 3.4
640
 */
641
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch) {
642
643
	/*
644
	 * The algorithm of this method has been entirely copied from
645
	 * CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean)
646
	 * Array lengths have been replaced with call to {@link String#length()} and
647
	 * array direct access have been replaced with call to {@link String#charAt(int)}.
648
	 * WARNING: Do not change one of these methods without changing the other
649
	 * the same way otherwise behavior differences may appear while using them...
650
	 */
651
652
	if (name == null)
653
		return false; // null name cannot match
654
	if (pattern == null)
655
		return true; // null pattern is equivalent to '*'
656
	if (patternEnd < 0) 	patternEnd = pattern.length();
657
	if (nameEnd < 0) nameEnd = name.length();
658
659
	if (patternEnd <= patternStart) return nameEnd <= nameStart;
660
	if (nameEnd <= nameStart) return false;
661
	// check first pattern char
662
	if (name.charAt(nameStart) != pattern.charAt(patternStart)) {
663
		// first char must strictly match (upper/lower)
664
		return false;
665
	}
666
	
667
	char patternChar, nameChar;
668
	int iPattern = patternStart;
669
	int iName = nameStart;
670
671
	// Main loop is on pattern characters
672
	while (true) {
673
674
		iPattern++;
675
		iName++;
676
677
		if (iPattern == patternEnd) { // we have exhausted pattern...
678
			// it's a match if not exact mode or name is also exhausted
679
			if (prefixMatch || iName == nameEnd) return true;
680
681
			// it's not a match if last pattern character is a lowercase
682
			if ((patternChar = pattern.charAt(iPattern-1)) < ScannerHelper.MAX_OBVIOUS) {
683
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) {
684
					return false;
685
				}
686
			}
687
			else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) {
688
				return false;
689
			}
690
691
			// it's a match only if name has no more uppercase characters (exact mode)
692
			while (true) {
693
				if (iName == nameEnd) {
694
					// we have exhausted name, so it's a match
695
					return true;
696
				}
697
				nameChar = name.charAt(iName);
698
				if (nameChar < ScannerHelper.MAX_OBVIOUS) {
699
					if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) {
700
						// nameChar is uppercase, so it's not a match
701
						return false;
702
					}
703
				}
704
				else if (!Character.isJavaIdentifierPart(nameChar) || Character.isUpperCase(nameChar)) {
705
					return false;
706
				}
707
				iName++;
708
			}
709
		}
710
711
		if (iName == nameEnd){
712
			// We have exhausted name (and not pattern), so it's not a match 
713
			return false;
714
		}
715
716
		// For as long as we're exactly matching, bring it on (even if it's a lower case character)
717
		if ((patternChar = pattern.charAt(iPattern)) == name.charAt(iName)) {
718
			continue;
719
		}
720
721
		// If characters are not equals, then it's not a match if patternChar is lowercase
722
		if (patternChar < ScannerHelper.MAX_OBVIOUS) {
723
			if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) {
724
				return false;
725
			}
726
		}
727
		else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) {
728
			return false;
729
		}
730
731
		// patternChar is uppercase, so let's find the next uppercase in name
732
		while (true) {
733
			if (iName == nameEnd){
734
	            //	We have exhausted name (and not pattern), so it's not a match
735
				return false;
736
			}
737
738
			nameChar = name.charAt(iName);
739
			if (nameChar < ScannerHelper.MAX_OBVIOUS) {
740
				int charNature = ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar];
741
				if ((charNature & (ScannerHelper.C_LOWER_LETTER | ScannerHelper.C_SPECIAL)) != 0) {
742
					// nameChar is lowercase    
743
					iName++;
744
				} else if ((charNature & ScannerHelper.C_DIGIT) != 0) {
745
					// nameChar is digit => break if the digit is current pattern character otherwise consume it
746
					if (patternChar == nameChar) break;
747
					iName++;
748
				// nameChar is uppercase...
749
				} else  if (patternChar != nameChar) {
750
					//.. and it does not match patternChar, so it's not a match
751
					return false;
752
				} else {
753
					//.. and it matched patternChar. Back to the big loop
754
					break;
755
				}
756
			}
757
			// Same tests for non-obvious characters
758
			else if (Character.isJavaIdentifierPart(nameChar) && !Character.isUpperCase(nameChar)) {
759
				iName++;
760
			} else if (Character.isDigit(nameChar)) {
761
				if (patternChar == nameChar) break;
762
				iName++;
763
			} else  if (patternChar != nameChar) {
764
				return false;
765
			} else {
766
				break;
767
			}
768
		}
769
		// At this point, either name has been exhausted, or it is at an uppercase letter.
770
		// Since pattern is also at an uppercase letter
771
	}
239
}	
772
}	
240
773
241
/**
774
/**
Lines 850-856 Link Here
850
 *		<li>{@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type</li>
1383
 *		<li>{@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type</li>
851
 * 	<li>{@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations</li>
1384
 * 	<li>{@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations</li>
852
 *		<li>{@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces</li>
1385
 *		<li>{@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces</li>
853
 * 	<li>{@link IJavaSearchConstants#TYPE}: look for all types (ie. classes, interfaces, enum and annotation types)</li>
1386
 * 	<li>{@link IJavaSearchConstants#TYPE}: look for all types (i.e. classes, interfaces, enum and annotation types)</li>
854
 *		<li>{@link IJavaSearchConstants#FIELD}: look for fields</li>
1387
 *		<li>{@link IJavaSearchConstants#FIELD}: look for fields</li>
855
 *		<li>{@link IJavaSearchConstants#METHOD}: look for methods</li>
1388
 *		<li>{@link IJavaSearchConstants#METHOD}: look for methods</li>
856
 *		<li>{@link IJavaSearchConstants#CONSTRUCTOR}: look for constructors</li>
1389
 *		<li>{@link IJavaSearchConstants#CONSTRUCTOR}: look for constructors</li>
Lines 860-866 Link Here
860
 *	<ul>
1393
 *	<ul>
861
 * 	<li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching
1394
 * 	<li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching
862
 * 			with the corresponding element. In case the element is a method, declarations of matching
1395
 * 			with the corresponding element. In case the element is a method, declarations of matching
863
 * 			methods in subtypes will also be found, allowing to find declarations of abstract methods, etc.<br>
1396
 * 			methods in sub-types will also be found, allowing to find declarations of abstract methods, etc.<br>
864
 * 			Note that additional flags {@link IJavaSearchConstants#IGNORE_DECLARING_TYPE} and
1397
 * 			Note that additional flags {@link IJavaSearchConstants#IGNORE_DECLARING_TYPE} and
865
 * 			{@link IJavaSearchConstants#IGNORE_RETURN_TYPE} are ignored for string patterns.
1398
 * 			{@link IJavaSearchConstants#IGNORE_RETURN_TYPE} are ignored for string patterns.
866
 * 			This is due to the fact that client may omit to define them in string pattern to have same behavior.
1399
 * 			This is due to the fact that client may omit to define them in string pattern to have same behavior.
Lines 875-885 Link Here
875
 *				{@link IJavaSearchConstants#INTERFACE} is respectively used instead of {@link IJavaSearchConstants#TYPE}.
1408
 *				{@link IJavaSearchConstants#INTERFACE} is respectively used instead of {@link IJavaSearchConstants#TYPE}.
876
 *		</li>
1409
 *		</li>
877
 *	</ul>
1410
 *	</ul>
878
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH}, {@link #R_PATTERN_MATCH},
1411
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH},
879
 * 	{@link #R_REGEXP_MATCH}, {@link #R_CAMELCASE_MATCH} combined with one of following values:
1412
 * 	{@link #R_PATTERN_MATCH}, {@link #R_REGEXP_MATCH} combined with
880
 * 	{@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH}.
1413
 * 	one of following values: {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH},
881
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
1414
 * 	{@link #R_EQUIVALENT_MATCH} or {@link #R_CAMEL_CASE_MATCH}.
882
 *		{@link #R_PREFIX_MATCH} if a prefix non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
1415
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact
1416
 *		and case sensitive match is requested, {@link #R_PREFIX_MATCH} if a prefix
1417
 *		non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
883
 *		if a non case sensitive and erasure match is requested.<br>
1418
 *		if a non case sensitive and erasure match is requested.<br>
884
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
1419
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
885
 * 	on non-generic types/methods search.<br>
1420
 * 	on non-generic types/methods search.<br>
Lines 930-936 Link Here
930
 * The pattern is used to trigger the appropriate search.
1465
 * The pattern is used to trigger the appropriate search.
931
 * <br>
1466
 * <br>
932
 * Note that for generic searches, the returned pattern consider {@link #R_ERASURE_MATCH} matches.
1467
 * Note that for generic searches, the returned pattern consider {@link #R_ERASURE_MATCH} matches.
933
 * If other kind of generic matches (ie. {@link #R_EXACT_MATCH} or {@link #R_EQUIVALENT_MATCH})
1468
 * If other kind of generic matches (i.e. {@link #R_EXACT_MATCH} or {@link #R_EQUIVALENT_MATCH})
934
 * are expected, {@link #createPattern(IJavaElement, int, int)} method need to be used instead with
1469
 * are expected, {@link #createPattern(IJavaElement, int, int)} method need to be used instead with
935
 * the explicit match rule specified.
1470
 * the explicit match rule specified.
936
 * <br>
1471
 * <br>
Lines 941-947 Link Here
941
 *	<ul>
1476
 *	<ul>
942
 * 	<li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching
1477
 * 	<li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching
943
 * 			with the corresponding element. In case the element is a method, declarations of matching
1478
 * 			with the corresponding element. In case the element is a method, declarations of matching
944
 * 			methods in subtypes will also be found, allowing to find declarations of abstract methods, etc.
1479
 * 			methods in sub-types will also be found, allowing to find declarations of abstract methods, etc.
945
 *				Some additional flags may be specified while searching declaration:
1480
 *				Some additional flags may be specified while searching declaration:
946
 *				<ul>
1481
 *				<ul>
947
 *					<li>{@link IJavaSearchConstants#IGNORE_DECLARING_TYPE}: declaring type will be ignored
1482
 *					<li>{@link IJavaSearchConstants#IGNORE_DECLARING_TYPE}: declaring type will be ignored
Lines 988-994 Link Here
988
 *	<ul>
1523
 *	<ul>
989
 * 	<li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching
1524
 * 	<li>{@link IJavaSearchConstants#DECLARATIONS}: will search declarations matching
990
 * 			with the corresponding element. In case the element is a method, declarations of matching
1525
 * 			with the corresponding element. In case the element is a method, declarations of matching
991
 * 			methods in subtypes will also be found, allowing to find declarations of abstract methods, etc.
1526
 * 			methods in sub-types will also be found, allowing to find declarations of abstract methods, etc.
992
 *				Some additional flags may be specified while searching declaration:
1527
 *				Some additional flags may be specified while searching declaration:
993
 *				<ul>
1528
 *				<ul>
994
 *					<li>{@link IJavaSearchConstants#IGNORE_DECLARING_TYPE}: declaring type will be ignored
1529
 *					<li>{@link IJavaSearchConstants#IGNORE_DECLARING_TYPE}: declaring type will be ignored
Lines 1020-1034 Link Here
1020
 *				which directly implement/extend a given interface.
1555
 *				which directly implement/extend a given interface.
1021
 *		</li>
1556
 *		</li>
1022
 *	</ul>
1557
 *	</ul>
1023
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH}, {@link #R_PATTERN_MATCH},
1558
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH},
1024
 * 	{@link #R_REGEXP_MATCH}, {@link #R_CAMELCASE_MATCH} combined with one of following values:
1559
 * 	{@link #R_PATTERN_MATCH}, {@link #R_REGEXP_MATCH} combined with
1025
 * 	{@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH}.
1560
 * 	one of following values: {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH},
1026
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
1561
 * 	{@link #R_EQUIVALENT_MATCH} or {@link #R_CAMEL_CASE_MATCH}.
1027
 *		{@link #R_PREFIX_MATCH} if a prefix non case sensitive match is requested or {@link #R_EXACT_MATCH} |{@link #R_ERASURE_MATCH}
1562
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact
1563
 *		and case sensitive match is requested, {@link #R_PREFIX_MATCH} if a prefix
1564
 *		non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
1028
 *		if a non case sensitive and erasure match is requested.<br>
1565
 *		if a non case sensitive and erasure match is requested.<br>
1029
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect on non-generic types
1566
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
1030
 * 	or methods search.<br>
1567
 * 	on non-generic types/methods search.<br>
1031
 * 	Note also that default behavior for generic types or methods is to find exact matches.
1568
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
1032
 * @return a search pattern for a Java element or <code>null</code> if the given element is ill-formed
1569
 * @return a search pattern for a Java element or <code>null</code> if the given element is ill-formed
1033
 * @since 3.1
1570
 * @since 3.1
1034
 */
1571
 */
Lines 1380-1386 Link Here
1380
 * 	and look as follow: '&lt;' { [ '?' {'extends'|'super'} ] type ( ',' [ '?' {'extends'|'super'} ] type )* | '?' } '&gt;'
1917
 * 	and look as follow: '&lt;' { [ '?' {'extends'|'super'} ] type ( ',' [ '?' {'extends'|'super'} ] type )* | '?' } '&gt;'
1381
 * 	Please note that:
1918
 * 	Please note that:
1382
 * 		- '*' is not valid inside type arguments definition &lt;&gt;
1919
 * 		- '*' is not valid inside type arguments definition &lt;&gt;
1383
 * 		- '?' is treated as a wildcard when it is inside &lt;&gt; (ie. it must be put on first position of the type argument)
1920
 * 		- '?' is treated as a wildcard when it is inside &lt;&gt; (i.e. it must be put on first position of the type argument)
1384
 */
1921
 */
1385
private static SearchPattern createTypePattern(String patternString, int limitTo, int matchRule, char indexSuffix) {
1922
private static SearchPattern createTypePattern(String patternString, int limitTo, int matchRule, char indexSuffix) {
1386
	
1923
	
Lines 1601-1626 Link Here
1601
	if (pattern == null) return true; // null is as if it was "*"
2138
	if (pattern == null) return true; // null is as if it was "*"
1602
	if (name != null) {
2139
	if (name != null) {
1603
		boolean isCaseSensitive = (this.matchRule & R_CASE_SENSITIVE) != 0;
2140
		boolean isCaseSensitive = (this.matchRule & R_CASE_SENSITIVE) != 0;
1604
		boolean isCamelCase = (this.matchRule & R_CAMELCASE_MATCH) != 0;
2141
		boolean isCamelCase = (this.matchRule & R_CAMEL_CASE_MATCH) != 0;
1605
		int matchMode = this.matchRule & MODE_MASK;
2142
		int matchMode = this.matchRule & MODE_MASK;
1606
		boolean emptyPattern = pattern.length == 0;
2143
		boolean emptyPattern = pattern.length == 0;
1607
		if (matchMode == R_PREFIX_MATCH && emptyPattern) return true;
2144
		boolean isPrefix = (this.matchRule & R_PREFIX_MATCH) != 0;
2145
		if (isPrefix && emptyPattern) return true;
1608
		boolean sameLength = pattern.length == name.length;
2146
		boolean sameLength = pattern.length == name.length;
1609
		boolean canBePrefix = name.length >= pattern.length;
2147
		boolean canBePrefix = name.length >= pattern.length;
1610
		boolean matchFirstChar = !isCaseSensitive || emptyPattern || (name.length > 0 &&  pattern[0] == name[0]);
2148
		boolean matchFirstChar = !isCaseSensitive || emptyPattern || (name.length > 0 &&  pattern[0] == name[0]);
1611
		if (isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(pattern, name)) {
2149
		if (isCamelCase) {
1612
			return true;
2150
			if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, isPrefix)) {
2151
				return true;
2152
			}
2153
			if (isCaseSensitive) return false;
1613
		}
2154
		}
1614
		switch (matchMode) {
2155
		switch (matchMode) {
1615
			case R_EXACT_MATCH :
2156
			case R_EXACT_MATCH :
1616
			case R_FULL_MATCH :
2157
				if (sameLength && matchFirstChar) {
1617
				if (!isCamelCase) {
2158
					return CharOperation.equals(pattern, name, isCaseSensitive);
1618
					if (sameLength && matchFirstChar) {
1619
						return CharOperation.equals(pattern, name, isCaseSensitive);
1620
					}
1621
					break;
1622
				}
2159
				}
1623
				// fall through next case to match as prefix if camel case failed
2160
				break;
1624
			case R_PREFIX_MATCH :
2161
			case R_PREFIX_MATCH :
1625
				if (canBePrefix && matchFirstChar) {
2162
				if (canBePrefix && matchFirstChar) {
1626
					return CharOperation.prefixEquals(pattern, name, isCaseSensitive);
2163
					return CharOperation.prefixEquals(pattern, name, isCaseSensitive);
Lines 1628-1633 Link Here
1628
				break;
2165
				break;
1629
2166
1630
			case R_PATTERN_MATCH :
2167
			case R_PATTERN_MATCH :
2168
				// TODO_PERFS (frederic) not sure this lowercase was necessary...
1631
				if (!isCaseSensitive)
2169
				if (!isCaseSensitive)
1632
					pattern = CharOperation.toLowerCase(pattern);
2170
					pattern = CharOperation.toLowerCase(pattern);
1633
				return CharOperation.match(pattern, name, isCaseSensitive);
2171
				return CharOperation.match(pattern, name, isCaseSensitive);
Lines 1643-1670 Link Here
1643
/**
2181
/**
1644
 * Validate compatibility between given string pattern and match rule.
2182
 * Validate compatibility between given string pattern and match rule.
1645
 *<br>
2183
 *<br>
1646
 * Optimized (ie. returned match rule is modified) combinations are:
2184
 * Returned match rule is modified, when following combinations are observed in the given parameters:
1647
 * <ul>
2185
 * <ul>
1648
 * 	<li>{@link #R_PATTERN_MATCH} without any '*' or '?' in string pattern:
2186
 * 	<li>{@link #R_PATTERN_MATCH} without any '*' or '?' in string pattern:<br>
1649
 * 		pattern match bit is unset,
2187
 * 		=> <b>pattern match flag is reset</b>,
1650
 * 	</li>
2188
 * 	</li>
1651
 * 	<li>{@link #R_PATTERN_MATCH} and {@link #R_PREFIX_MATCH}  bits simultaneously set:
2189
 * 	<li>{@link #R_PATTERN_MATCH} and {@link #R_PREFIX_MATCH}  flags
1652
 * 		prefix match bit is unset,
2190
 * 		simultaneously set:<br>
2191
 * 		&nbsp;=> <b>prefix match flag is reset</b>,
1653
 * 	</li>
2192
 * 	</li>
1654
 * 	<li>{@link #R_PATTERN_MATCH} and {@link #R_CAMELCASE_MATCH}  bits simultaneously set:
2193
 * 	<li>{@link #R_PATTERN_MATCH} and {@link #R_CAMEL_CASE_MATCH} 
1655
 * 		camel case match bit is unset,
2194
 * 		(or <i>deprecated {@link #R_CAMELCASE_MATCH}</i>) flags simultaneously set:<br>
2195
 * 		&nbsp;=> <b>camel case match flag is reset</b>,
1656
 * 	</li>
2196
 * 	</li>
1657
 * 	<li>{@link #R_CAMELCASE_MATCH} with invalid combination of uppercase and lowercase characters:
2197
 * 	<li>{@link #R_CAMEL_CASE_MATCH} (or <i>deprecated {@link #R_CAMELCASE_MATCH}</i>)
1658
 * 		camel case match bit is unset and replaced with prefix match pattern,
2198
 * 		with invalid combination of uppercase and lowercase characters:<br>
2199
 * 		&nbsp;=> <b>camel case match flag is reset and replaced with prefix match pattern</b>,<br>
1659
 * 	</li>
2200
 * 	</li>
1660
 * 	<li>{@link #R_CAMELCASE_MATCH} combined with {@link #R_PREFIX_MATCH} and {@link #R_CASE_SENSITIVE}
2201
 * 	<li>The <i>deprecated {@link #R_CAMELCASE_MATCH}</i> flag combined with
1661
 * 		bits is reduced to only {@link #R_CAMELCASE_MATCH} as Camel Case search is already prefix and case sensitive,
2202
 * 		{@link #R_PREFIX_MATCH} and {@link #R_CASE_SENSITIVE} flags is
2203
 * 		reduced to <i>deprecated {@link #R_CAMELCASE_MATCH}</i> flag only,
1662
 * 	</li>
2204
 * 	</li>
1663
 * </ul>
2205
 * </ul>
1664
 *<br>
2206
 *<br>
1665
 * Rejected (ie. returned match rule -1) combinations are:
2207
 * Rejected (i.e. returned match rule -1) combinations are:
1666
 * <ul>
2208
 * <ul>
1667
 * 	<li>{@link #R_REGEXP_MATCH} with any other match mode bit set,
2209
 * 	<li>{@link #R_REGEXP_MATCH} with any other match mode flag set,
1668
 * 	</li>
2210
 * 	</li>
1669
 * </ul>
2211
 * </ul>
1670
 *
2212
 *
Lines 1677-1683 Link Here
1677
2219
1678
	// Verify Regexp match rule
2220
	// Verify Regexp match rule
1679
	if ((matchRule & R_REGEXP_MATCH) != 0) {
2221
	if ((matchRule & R_REGEXP_MATCH) != 0) {
1680
		if ((matchRule & R_PATTERN_MATCH) != 0 || (matchRule & R_PREFIX_MATCH) != 0 || (matchRule & R_CAMELCASE_MATCH) != 0) {
2222
		if ((matchRule & R_PATTERN_MATCH) != 0 || (matchRule & R_PREFIX_MATCH) != 0 || 
2223
			(matchRule & R_CAMEL_CASE_MATCH) != 0 || (matchRule & R_CAMELCASE_MATCH) != 0) {
1681
			return -1;
2224
			return -1;
1682
		}
2225
		}
1683
	}
2226
	}
Lines 1686-1705 Link Here
1686
	int starIndex = stringPattern.indexOf('*');
2229
	int starIndex = stringPattern.indexOf('*');
1687
	int questionIndex = stringPattern.indexOf('?');
2230
	int questionIndex = stringPattern.indexOf('?');
1688
	if (starIndex < 0 && questionIndex < 0) {
2231
	if (starIndex < 0 && questionIndex < 0) {
1689
		// reset pattern match bit if any
2232
		// reset pattern match flag if any
1690
		matchRule &= ~R_PATTERN_MATCH;
2233
		matchRule &= ~R_PATTERN_MATCH;
1691
	} else {
2234
	} else {
1692
		// force Pattern rule
2235
		// force Pattern rule
1693
		matchRule |= R_PATTERN_MATCH;
2236
		matchRule |= R_PATTERN_MATCH;
1694
	}
2237
	}
1695
	if ((matchRule & R_PATTERN_MATCH) != 0) {
2238
	if ((matchRule & R_PATTERN_MATCH) != 0) {
1696
		// remove Camel Case and Prefix match bits if any
2239
		// remove Camel Case and Prefix match flags if any
1697
		matchRule &= ~R_CAMELCASE_MATCH;
2240
		matchRule &= ~R_CAMELCASE_MATCH;
2241
		matchRule &= ~R_CAMEL_CASE_MATCH;
1698
		matchRule &= ~R_PREFIX_MATCH;
2242
		matchRule &= ~R_PREFIX_MATCH;
1699
	}
2243
	}
1700
2244
1701
	// Verify Camel Case match rule
2245
	// Verify Camel Case match rule
1702
	if ((matchRule & R_CAMELCASE_MATCH) != 0) {
2246
	if ((matchRule & R_CAMEL_CASE_MATCH) != 0) {
2247
		matchRule &= ~R_CAMELCASE_MATCH; // in case of some user specify both constants
1703
		// Verify sting pattern validity
2248
		// Verify sting pattern validity
1704
		int length = stringPattern.length();
2249
		int length = stringPattern.length();
1705
		boolean validCamelCase = true;
2250
		boolean validCamelCase = true;
Lines 1712-1718 Link Here
1712
			if (!uppercase) uppercase = ScannerHelper.isUpperCase(ch);
2257
			if (!uppercase) uppercase = ScannerHelper.isUpperCase(ch);
1713
		}
2258
		}
1714
		validCamelCase = validCamelCase && uppercase;
2259
		validCamelCase = validCamelCase && uppercase;
1715
		// Verify bits compatibility
2260
		// Verify flags compatibility
2261
		if (!validCamelCase) {
2262
			matchRule &= ~R_CAMEL_CASE_MATCH;
2263
			matchRule |= R_PREFIX_MATCH;
2264
		}
2265
	}
2266
2267
	// Verify deprecated Camel Case match rule for backward compatibility
2268
	else if ((matchRule & R_CAMELCASE_MATCH) != 0) {
2269
		// Verify sting pattern validity
2270
		int length = stringPattern.length();
2271
		boolean validCamelCase = true;
2272
		boolean uppercase = false;
2273
		for (int i=0; i<length && validCamelCase; i++) {
2274
			char ch = stringPattern.charAt(i);
2275
			validCamelCase = i==0 ? ScannerHelper.isJavaIdentifierStart(ch) : ScannerHelper.isJavaIdentifierPart(ch);
2276
			// at least one uppercase character is need in CamelCase pattern
2277
			// (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=136313)
2278
			if (!uppercase) uppercase = ScannerHelper.isUpperCase(ch);
2279
		}
2280
		validCamelCase = validCamelCase && uppercase;
2281
		// Verify flags compatibility
1716
		if (validCamelCase) {
2282
		if (validCamelCase) {
1717
			if ((matchRule & R_PREFIX_MATCH) != 0) {
2283
			if ((matchRule & R_PREFIX_MATCH) != 0) {
1718
				if ((matchRule & R_CASE_SENSITIVE) != 0) {
2284
				if ((matchRule & R_CASE_SENSITIVE) != 0) {
Lines 1733-1738 Link Here
1733
}
2299
}
1734
2300
1735
/**
2301
/**
2302
 * Update depreciated flags if necessary in the given match rule.
2303
 * 
2304
 * @param matchRule The match rule to update
2305
 * @return The updated match rule with the updated flags
2306
 */
2307
static int updateMatchRule(int matchRule) {
2308
	if ((matchRule & R_CAMELCASE_MATCH) != 0) {
2309
		matchRule &= ~R_CAMELCASE_MATCH;
2310
		matchRule |= R_CAMEL_CASE_MATCH;
2311
		if ((matchRule & (R_PREFIX_MATCH | R_CASE_SENSITIVE)) == 0) {
2312
			matchRule |= R_PREFIX_MATCH;
2313
		}
2314
	}
2315
	return matchRule;
2316
}
2317
2318
/**
1736
 * @see java.lang.Object#toString()
2319
 * @see java.lang.Object#toString()
1737
 */
2320
 */
1738
public String toString() {
2321
public String toString() {
(-)search/org/eclipse/jdt/core/search/SearchEngine.java (-7 / +23 lines)
Lines 570-576 Link Here
570
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
570
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
571
	 *			of the searched types.</li>
571
	 *			of the searched types.</li>
572
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
572
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
573
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.</li>
573
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
574
	 * </ul>
574
	 * </ul>
575
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
575
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
576
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
576
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 637-643 Link Here
637
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
637
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
638
	 *			of the searched types.</li>
638
	 *			of the searched types.</li>
639
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
639
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
640
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.</li>
640
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
641
	 * </ul>
641
	 * </ul>
642
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
642
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
643
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
643
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 649-655 Link Here
649
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
649
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
650
	 *			of the searched types.</li>
650
	 *			of the searched types.</li>
651
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
651
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
652
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.</li>
652
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
653
	 * </ul>
653
	 * </ul>
654
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
654
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
655
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
655
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 694-700 Link Here
694
		IProgressMonitor progressMonitor)  throws JavaModelException {
694
		IProgressMonitor progressMonitor)  throws JavaModelException {
695
		
695
		
696
		TypeNameRequestorWrapper requestorWrapper = new TypeNameRequestorWrapper(nameRequestor);
696
		TypeNameRequestorWrapper requestorWrapper = new TypeNameRequestorWrapper(nameRequestor);
697
		this.basicEngine.searchAllTypeNames(packageName, packageMatchRule, typeName, typeMatchRule, searchFor, scope, requestorWrapper, waitingPolicy, progressMonitor);
697
		this.basicEngine.searchAllTypeNames(packageName,
698
			packageMatchRule,
699
			typeName,
700
			SearchPattern.updateMatchRule(typeMatchRule), 
701
			searchFor,
702
			scope,
703
			requestorWrapper,
704
			waitingPolicy,
705
			progressMonitor);
698
	}
706
	}
699
707
700
	/**
708
	/**
Lines 716-722 Link Here
716
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
724
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
717
	 *			of the searched types.</li>
725
	 *			of the searched types.</li>
718
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
726
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
719
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.</li>
727
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
720
	 * </ul>
728
	 * </ul>
721
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
729
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
722
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
730
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 732-738 Link Here
732
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
740
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
733
	 *			of the searched types.</li>
741
	 *			of the searched types.</li>
734
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
742
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
735
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if type name are camel case of the names of the searched types.</li>
743
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
736
	 * </ul>
744
	 * </ul>
737
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
745
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
738
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
746
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 778-784 Link Here
778
		IProgressMonitor progressMonitor)  throws JavaModelException {
786
		IProgressMonitor progressMonitor)  throws JavaModelException {
779
		
787
		
780
		TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper(nameMatchRequestor, scope);
788
		TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper(nameMatchRequestor, scope);
781
		this.basicEngine.searchAllTypeNames(packageName, packageMatchRule, typeName, typeMatchRule, searchFor, scope, requestorWrapper, waitingPolicy, progressMonitor);
789
		this.basicEngine.searchAllTypeNames(packageName, 
790
			packageMatchRule, 
791
			typeName, 
792
			SearchPattern.updateMatchRule(typeMatchRule), 
793
			searchFor, 
794
			scope, 
795
			requestorWrapper, 
796
			waitingPolicy, 
797
			progressMonitor);
782
	}
798
	}
783
799
784
	/**
800
	/**
(-)search/org/eclipse/jdt/internal/core/index/Index.java (-13 / +10 lines)
Lines 47-53 Link Here
47
	SearchPattern.R_PATTERN_MATCH |
47
	SearchPattern.R_PATTERN_MATCH |
48
	SearchPattern.R_REGEXP_MATCH |
48
	SearchPattern.R_REGEXP_MATCH |
49
	SearchPattern.R_CASE_SENSITIVE |
49
	SearchPattern.R_CASE_SENSITIVE |
50
	SearchPattern.R_CAMELCASE_MATCH;
50
	SearchPattern.R_CAMEL_CASE_MATCH;
51
51
52
public static boolean isMatch(char[] pattern, char[] word, int matchRule) {
52
public static boolean isMatch(char[] pattern, char[] word, int matchRule) {
53
	if (pattern == null) return true;
53
	if (pattern == null) return true;
Lines 57-84 Link Here
57
	if (wordLength == 0) return (matchRule & SearchPattern.R_PATTERN_MATCH) != 0 && patternLength == 1 && pattern[0] == '*';
57
	if (wordLength == 0) return (matchRule & SearchPattern.R_PATTERN_MATCH) != 0 && patternLength == 1 && pattern[0] == '*';
58
58
59
	// First test camel case if necessary
59
	// First test camel case if necessary
60
	boolean isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0;
60
	boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
61
	if (isCamelCase &&  pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word)) {
61
	if (isCamelCase) {
62
		return true;
62
		if (pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word, (matchRule & SearchPattern.R_PREFIX_MATCH) != 0)) {
63
			return true;
64
		}
65
		if ((matchRule & SearchPattern.R_CASE_SENSITIVE) != 0) return false;
63
	}
66
	}
64
67
65
	// need to mask some bits of pattern rule (bug 79790)
68
	// need to mask some bits of pattern rule (bug 79790)
66
	matchRule &= ~SearchPattern.R_CAMELCASE_MATCH;
69
	matchRule &= ~SearchPattern.R_CAMEL_CASE_MATCH;
67
	switch(matchRule & MATCH_RULE_INDEX_MASK) {
70
	switch(matchRule & MATCH_RULE_INDEX_MASK) {
68
		case SearchPattern.R_EXACT_MATCH :
71
		case SearchPattern.R_EXACT_MATCH :
69
			if (!isCamelCase) {
72
			return patternLength == wordLength && CharOperation.equals(pattern, word, false);
70
				return patternLength == wordLength && CharOperation.equals(pattern, word, false);
71
			}
72
			// fall through prefix match if camel case failed
73
		case SearchPattern.R_PREFIX_MATCH :
73
		case SearchPattern.R_PREFIX_MATCH :
74
			return patternLength <= wordLength && CharOperation.prefixEquals(pattern, word, false);
74
			return patternLength <= wordLength && CharOperation.prefixEquals(pattern, word, false);
75
		case SearchPattern.R_PATTERN_MATCH :
75
		case SearchPattern.R_PATTERN_MATCH :
76
			return CharOperation.match(pattern, word, false);
76
			return CharOperation.match(pattern, word, false);
77
		case SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE :
77
		case SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE :
78
			if (!isCamelCase) {
78
			return pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word);
79
				return pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word);
80
			}
81
			// fall through prefix match if camel case failed
82
		case SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE :
79
		case SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE :
83
			return pattern[0] == word[0] && patternLength <= wordLength && CharOperation.prefixEquals(pattern, word);
80
			return pattern[0] == word[0] && patternLength <= wordLength && CharOperation.prefixEquals(pattern, word);
84
		case SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE :
81
		case SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE :
(-)model/org/eclipse/jdt/internal/core/SearchableEnvironment.java (-1 / +1 lines)
Lines 380-386 Link Here
380
			};
380
			};
381
			try {
381
			try {
382
				int matchRule = SearchPattern.R_PREFIX_MATCH;
382
				int matchRule = SearchPattern.R_PREFIX_MATCH;
383
				if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH;
383
				if (camelCaseMatch) matchRule |= SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH;
384
				new BasicSearchEngine(this.workingCopies).searchAllTypeNames(
384
				new BasicSearchEngine(this.workingCopies).searchAllTypeNames(
385
					qualification,
385
					qualification,
386
					SearchPattern.R_EXACT_MATCH,
386
					SearchPattern.R_EXACT_MATCH,
(-)search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java (-10 / +13 lines)
Lines 246-252 Link Here
246
			return "R_EXACT_MATCH"; //$NON-NLS-1$
246
			return "R_EXACT_MATCH"; //$NON-NLS-1$
247
		}
247
		}
248
		StringBuffer buffer = new StringBuffer();
248
		StringBuffer buffer = new StringBuffer();
249
		for (int i=1; i<=8; i++) {
249
		for (int i=1; i<=16; i++) {
250
			int bit = matchRule & (1<<(i-1));
250
			int bit = matchRule & (1<<(i-1));
251
			if (bit != 0 && buffer.length()>0) buffer.append(" | "); //$NON-NLS-1$
251
			if (bit != 0 && buffer.length()>0) buffer.append(" | "); //$NON-NLS-1$
252
			switch (bit) {
252
			switch (bit) {
Lines 271-279 Link Here
271
				case SearchPattern.R_REGEXP_MATCH:
271
				case SearchPattern.R_REGEXP_MATCH:
272
					buffer.append("R_REGEXP_MATCH"); //$NON-NLS-1$
272
					buffer.append("R_REGEXP_MATCH"); //$NON-NLS-1$
273
					break;
273
					break;
274
				case SearchPattern.R_CAMELCASE_MATCH:
274
				case 0x0080: // SearchPattern.R_CAMELCASE_MATCH:
275
					buffer.append("R_CAMELCASE_MATCH"); //$NON-NLS-1$
275
					buffer.append("R_CAMELCASE_MATCH"); //$NON-NLS-1$
276
					break;
276
					break;
277
				case SearchPattern.R_CAMEL_CASE_MATCH:
278
					buffer.append("R_CAMEL_CASE_MATCH"); //$NON-NLS-1$
279
					break;
277
			}
280
			}
278
		}
281
		}
279
		return buffer.toString();
282
		return buffer.toString();
Lines 454-474 Link Here
454
				return false;
457
				return false;
455
		
458
		
456
		if (patternTypeName != null) {
459
		if (patternTypeName != null) {
457
			boolean isCamelCase = (matchRule & SearchPattern.R_CAMELCASE_MATCH) != 0;
460
			boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
458
			int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
461
			int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
459
			if (!isCaseSensitive && !isCamelCase) {
462
			if (!isCaseSensitive && !isCamelCase) {
460
				patternTypeName = CharOperation.toLowerCase(patternTypeName);
463
				patternTypeName = CharOperation.toLowerCase(patternTypeName);
461
			}
464
			}
462
			boolean matchFirstChar = !isCaseSensitive || patternTypeName[0] == typeName[0];
465
			boolean matchFirstChar = !isCaseSensitive || patternTypeName[0] == typeName[0];
463
			if (isCamelCase && matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName)) {
466
			if (isCamelCase) {
464
				return true;
467
				if (matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, (matchRule & SearchPattern.R_PREFIX_MATCH) != 0)) {
468
					return true;
469
				}
470
				if (isCaseSensitive) return false;
465
			}
471
			}
466
			switch(matchMode) {
472
			switch(matchMode) {
467
				case SearchPattern.R_EXACT_MATCH :
473
				case SearchPattern.R_EXACT_MATCH :
468
					if (!isCamelCase) {
474
					return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive);
469
						return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive);
470
					}
471
					// fall through next case to match as prefix if camel case failed
472
				case SearchPattern.R_PREFIX_MATCH :
475
				case SearchPattern.R_PREFIX_MATCH :
473
					return matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, isCaseSensitive);
476
					return matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, isCaseSensitive);
474
				case SearchPattern.R_PATTERN_MATCH :
477
				case SearchPattern.R_PATTERN_MATCH :
Lines 842-848 Link Here
842
								}
845
								}
843
								public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) {
846
								public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) {
844
									if (match(typeSuffix, packageName, typeName, typeMatchRule, TypeDeclaration.kind(memberTypeDeclaration.modifiers), packageDeclaration, memberTypeDeclaration.name)) {
847
									if (match(typeSuffix, packageName, typeName, typeMatchRule, TypeDeclaration.kind(memberTypeDeclaration.modifiers), packageDeclaration, memberTypeDeclaration.name)) {
845
										// compute encloising type names
848
										// compute enclosing type names
846
										TypeDeclaration enclosing = memberTypeDeclaration.enclosingType;
849
										TypeDeclaration enclosing = memberTypeDeclaration.enclosingType;
847
										char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
850
										char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
848
										while (enclosing != null) {
851
										while (enclosing != null) {

Return to bug 124624