View | Details | Raw Unified | Return to bug 194185
Collapse All | Expand All

(-)buildnotes_jdt-core.html (-1 / +3 lines)
Lines 53-59 Link Here
53
<h2>What's new in this drop</h2>
53
<h2>What's new in this drop</h2>
54
54
55
<h3>Problem Reports Fixed</h3>
55
<h3>Problem Reports Fixed</h3>
56
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=191908">191908</a>
56
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=194185">194185</a>
57
[search] for package declarations finds also subpackages
58
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=191908">191908</a>
57
[1.5][compiler] Missing strike through for deprecated declaration fragment
59
[1.5][compiler] Missing strike through for deprecated declaration fragment
58
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=192285">192285</a>
60
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=192285">192285</a>
59
[formatter] Java source formatter not working if class has annotation on single line multiple fields declaration.
61
[formatter] Java source formatter not working if class has annotation on single line multiple fields declaration.
(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-1 / +1 lines)
Lines 1255-1261 Link Here
1255
			}
1255
			}
1256
			// Get all project package fragment names
1256
			// Get all project package fragment names
1257
			this.nameLookup = ((JavaProject) projects[i]).newNameLookup(this.workingCopies);
1257
			this.nameLookup = ((JavaProject) projects[i]).newNameLookup(this.workingCopies);
1258
			IPackageFragment[] packageFragments = this.nameLookup.findPackageFragments(new String(pkgPattern.pkgName), true, true);
1258
			IPackageFragment[] packageFragments = this.nameLookup.findPackageFragments(new String(pkgPattern.pkgName), false, true);
1259
			int pLength = packageFragments == null ? 0 : packageFragments.length;
1259
			int pLength = packageFragments == null ? 0 : packageFragments.length;
1260
			// Report matches avoiding duplicate names
1260
			// Report matches avoiding duplicate names
1261
			for (int p=0; p<pLength; p++) {
1261
			for (int p=0; p<pLength; p++) {
(-)model/org/eclipse/jdt/internal/core/util/Util.java (-2 / +2 lines)
Lines 1934-1940 Link Here
1934
	 * Returns true if the n first elements of the prefix are equals and the last element of the 
1934
	 * Returns true if the n first elements of the prefix are equals and the last element of the 
1935
	 * prefix is a prefix of the corresponding element in the compound name.
1935
	 * prefix is a prefix of the corresponding element in the compound name.
1936
	 */
1936
	 */
1937
	public static boolean startsWithIgnoreCase(String[] compoundName, String[] prefix) {
1937
	public static boolean startsWithIgnoreCase(String[] compoundName, String[] prefix, boolean partialMatch) {
1938
		int prefixLength = prefix.length;
1938
		int prefixLength = prefix.length;
1939
		int nameLength = compoundName.length;
1939
		int nameLength = compoundName.length;
1940
		if (prefixLength > nameLength) return false;
1940
		if (prefixLength > nameLength) return false;
Lines 1942-1948 Link Here
1942
			if (!compoundName[i].equalsIgnoreCase(prefix[i]))
1942
			if (!compoundName[i].equalsIgnoreCase(prefix[i]))
1943
				return false;
1943
				return false;
1944
		}
1944
		}
1945
		return compoundName[prefixLength-1].toLowerCase().startsWith(prefix[prefixLength-1].toLowerCase());
1945
		return (partialMatch || prefixLength == nameLength) && compoundName[prefixLength-1].toLowerCase().startsWith(prefix[prefixLength-1].toLowerCase());
1946
	}
1946
	}
1947
1947
1948
	/*
1948
	/*
(-)model/org/eclipse/jdt/internal/core/NameLookup.java (-2 / +2 lines)
Lines 491-497 Link Here
491
				if (pkgName != null) {
491
				if (pkgName != null) {
492
					boolean match = hasPatternChars
492
					boolean match = hasPatternChars
493
						? Util.matchesWithIgnoreCase(pkgName, name)
493
						? Util.matchesWithIgnoreCase(pkgName, name)
494
						: Util.startsWithIgnoreCase(pkgName, splittedName);
494
						: Util.startsWithIgnoreCase(pkgName, splittedName, partialMatch);
495
					if (match) {
495
					if (match) {
496
						Object value = this.packageFragments.valueTable[i];
496
						Object value = this.packageFragments.valueTable[i];
497
						if (value instanceof PackageFragmentRoot) {
497
						if (value instanceof PackageFragmentRoot) {
Lines 857-863 Link Here
857
				if (requestor.isCanceled())
857
				if (requestor.isCanceled())
858
					return;
858
					return;
859
				String[] pkgName = (String[]) keys[i];
859
				String[] pkgName = (String[]) keys[i];
860
				if (pkgName != null && Util.startsWithIgnoreCase(pkgName, splittedName)) {
860
				if (pkgName != null && Util.startsWithIgnoreCase(pkgName, splittedName, partialMatch)) {
861
					Object value = this.packageFragments.valueTable[i];
861
					Object value = this.packageFragments.valueTable[i];
862
					if (value instanceof PackageFragmentRoot) {
862
					if (value instanceof PackageFragmentRoot) {
863
						PackageFragmentRoot root = (PackageFragmentRoot) value;
863
						PackageFragmentRoot root = (PackageFragmentRoot) value;
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (+18 lines)
Lines 7996-7999 Link Here
7996
		packageCollector);
7996
		packageCollector);
7997
}
7997
}
7998
7998
7999
/**
8000
 * @bug 194185 [search] for package declarations finds also subpackages
8001
 * @test Ensure that exact package is found when no 
8002
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=194185"
8003
 */
8004
public void testBug194185() throws CoreException {
8005
	JavaSearchResultCollector packageCollector = new JavaSearchResultCollector(true);
8006
	search(
8007
		"java", 
8008
		PACKAGE,
8009
		DECLARATIONS, 
8010
		SearchEngine.createWorkspaceScope(), 
8011
		packageCollector);
8012
	assertSearchResults(
8013
		""+ getExternalJCLPathString("1.5") + " java",
8014
		packageCollector);
8015
}
8016
7999
}
8017
}

Return to bug 194185