Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 201064
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (-1 / +80 lines)
Lines 8502-8507 Link Here
8502
		"src/b137984 b137984\n" +
8502
		"src/b137984 b137984\n" +
8503
		"src/b142044 b142044\n" +
8503
		"src/b142044 b142044\n" +
8504
		"src/b163984 b163984\n" +
8504
		"src/b163984 b163984\n" +
8505
		"src/b201064 b201064\n" +
8505
		"src/b81556 b81556\n" +
8506
		"src/b81556 b81556\n" +
8506
		"src/b81556/a b81556.a\n" +
8507
		"src/b81556/a b81556.a\n" +
8507
		"src/b86380 b86380\n" +
8508
		"src/b86380 b86380\n" +
Lines 8510-8516 Link Here
8510
}
8511
}
8511
8512
8512
/**
8513
/**
8513
 * @bug 194185 [search] for package declarations finds also subpackages
8514
 * @bug 194185 [search] for package declarations finds also sub-packages
8514
 * @test Ensure that exact package is found when no
8515
 * @test Ensure that exact package is found when no
8515
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=194185"
8516
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=194185"
8516
 */
8517
 */
Lines 8838-8841 Link Here
8838
	);
8839
	);
8839
}
8840
}
8840
8841
8842
/**
8843
 * @bug 201064: [search] SearchEngine.searchAllTypeNames(..) does not find CamelCase match
8844
 * @test Ensure that indexing still works properly after close/restart
8845
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=201064"
8846
 */
8847
public void testBug201064() throws CoreException {
8848
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8849
	searchAllTypeNames("CCase", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8850
	assertSearchResults(
8851
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8852
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8853
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8854
		collector
8855
	);
8856
}
8857
public void testBug201064b() throws CoreException {
8858
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8859
	searchAllTypeNames("CaCase", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8860
	assertSearchResults(
8861
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8862
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8863
		collector
8864
	);
8865
}
8866
public void testBug201064c() throws CoreException {
8867
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8868
	searchAllTypeNames("CamelCase", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8869
	assertSearchResults(
8870
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8871
		collector
8872
	);
8873
}
8874
public void testBug201064d() throws CoreException {
8875
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8876
	searchAllTypeNames("CC", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8877
	assertSearchResults(
8878
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8879
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8880
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8881
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8882
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8883
		collector
8884
	);
8885
}
8886
public void testBug201064e() throws CoreException {
8887
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8888
	searchAllTypeNames("CaC", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8889
	assertSearchResults(
8890
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8891
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8892
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8893
		collector
8894
	);
8895
}
8896
public void testBug201064f() throws CoreException {
8897
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8898
	searchAllTypeNames("CamelC", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8899
	assertSearchResults(
8900
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8901
		collector
8902
	);
8903
}
8904
public void testBug201064g() throws CoreException {
8905
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8906
	searchAllTypeNames("CCa", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8907
	assertSearchResults("", collector);
8908
}
8909
public void testBug201064h() throws CoreException {
8910
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8911
	searchAllTypeNames("CaCa", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8912
	assertSearchResults("", collector);
8913
}
8914
public void testBug201064i() throws CoreException {
8915
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8916
	searchAllTypeNames("CamelCa", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8917
	assertSearchResults("", collector);
8918
}
8919
8841
}
8920
}
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java (+13 lines)
Lines 658-663 Link Here
658
			null
658
			null
659
		);
659
		);
660
	}
660
	}
661
	protected void searchAllTypeNames(String pattern, int matchRule, TypeNameMatchCollector collector) throws JavaModelException {
662
		new SearchEngine(this.workingCopies).searchAllTypeNames(
663
			null,
664
			SearchPattern.R_EXACT_MATCH,
665
			pattern.toCharArray(),
666
			matchRule,
667
			TYPE,
668
			getJavaSearchScope(),
669
			collector,
670
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
671
			null
672
		);
673
	}
661
	protected void searchDeclarationsOfAccessedFields(IJavaElement enclosingElement, SearchRequestor requestor) throws JavaModelException {
674
	protected void searchDeclarationsOfAccessedFields(IJavaElement enclosingElement, SearchRequestor requestor) throws JavaModelException {
662
		new SearchEngine().searchDeclarationsOfAccessedFields(enclosingElement, requestor, null);
675
		new SearchEngine().searchDeclarationsOfAccessedFields(enclosingElement, requestor, null);
663
	}
676
	}
(-)workspace/JavaSearchBugs/src/b201064/CamelCase.java (+9 lines)
Added Link Here
1
package b201064;
2
public class CamelCase {}
3
class CatCase {}
4
class CatCasexx {}
5
class CxxCase {}
6
class CxxxxCasexx {}
7
class CamelCaseEntry {}
8
class CamelCasexxEntry {}
9
	
(-)buildnotes_jdt-core.html (-1 / +3 lines)
Lines 320-326 Link Here
320
</ul>
320
</ul>
321
321
322
<h3>Problem Reports Fixed</h3>
322
<h3>Problem Reports Fixed</h3>
323
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=183117">183117</a>
323
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=201064">201064</a>
324
[search] SearchEngine.searchAllTypeNames(..) does not find CamelCase match
325
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=183117">183117</a>
324
User Library Lost
326
User Library Lost
325
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=200400">200400</a>
327
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=200400">200400</a>
326
[search] Camel Case match prefix insensitive although spec says prefix sensitive
328
[search] Camel Case match prefix insensitive although spec says prefix sensitive
(-)search/org/eclipse/jdt/internal/core/index/Index.java (-1 / +3 lines)
Lines 59-65 Link Here
59
	// First test camel case if necessary
59
	// First test camel case if necessary
60
	boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
60
	boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
61
	if (isCamelCase) {
61
	if (isCamelCase) {
62
		if (pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word, (matchRule & SearchPattern.R_PREFIX_MATCH) != 0)) {
62
		// prefix is always needed as index key got characters after type simple name
63
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=201064
64
		if (pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word, true/*prefix match*/)) {
63
			return true;
65
			return true;
64
		}
66
		}
65
		if ((matchRule & SearchPattern.R_CASE_SENSITIVE) != 0) return false;
67
		if ((matchRule & SearchPattern.R_CASE_SENSITIVE) != 0) return false;

Return to bug 201064