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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (+40 lines)
Lines 13672-13675 Link Here
13672
	}
13672
	}
13673
}
13673
}
13674
13674
13675
// Ensure that results for jar are reported after the source projects
13676
public void testBug345807() throws CoreException {
13677
	try {
13678
		// Create a project depending on the jar
13679
		IJavaProject p1 = createJavaProject("P1", new String[] {}, new String[] {"/P1/01b345807.jar"}, "");		
13680
		createJar(new String[] {
13681
			"inlib/P345807Test.java",
13682
			"package inlib;\n" +
13683
			"public class P345807Test {\n" +
13684
			"}"
13685
		}, p1.getProject().getLocation().append("01b345807.jar").toOSString());
13686
		refresh(p1);
13687
		
13688
		// Create another project with the same class name
13689
		createJavaProject("Project2", new String[] {""}, new String[] {}, "");
13690
		createFile("/Project2/P345807Test.java",
13691
				"public class P345807Test {\n" + 
13692
				"}\n");
13693
		
13694
		waitUntilIndexesReady();
13695
		SearchTests.SearchTypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
13696
		new SearchEngine().searchAllTypeNames(
13697
				null,
13698
				SearchPattern.R_EXACT_MATCH, // case insensitive
13699
				"P345807Test".toCharArray(),
13700
				SearchPattern.R_EXACT_MATCH, // case insensitive
13701
				TYPE,
13702
				SearchEngine.createWorkspaceScope(),
13703
				requestor,
13704
				IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
13705
				null
13706
			);
13707
		assertEquals("Results not in proper order", "P345807Test\ninlib.P345807Test", requestor.unsortedString());
13708
	} catch (IOException e) {
13709
		assertTrue(false); // report a failure
13710
	} finally {
13711
		deleteProject("P1");
13712
		deleteProject("Project2");
13713
	}
13714
}
13675
}
13715
}
(-)src/org/eclipse/jdt/core/tests/model/SearchTests.java (+13 lines)
Lines 97-102 Link Here
97
			}
97
			}
98
			return buffer.toString();
98
			return buffer.toString();
99
		}
99
		}
100
		public String unsortedString() {
101
			int length = this.results.size();
102
			String[] strings = new String[length];
103
			this.results.toArray(strings);
104
			StringBuffer buffer = new StringBuffer(100);
105
			for (int i = 0; i < length; i++){
106
				buffer.append(strings[i]);
107
				if (i != length-1) {
108
					buffer.append('\n');
109
				}
110
			}
111
			return buffer.toString();
112
		}
100
		public int size() {
113
		public int size() {
101
			return this.results.size();
114
			return this.results.size();
102
		}
115
		}

Return to bug 348507