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

(-)src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java (+17 lines)
Lines 961-966 Link Here
961
	}
961
	}
962
}
962
}
963
/*
963
/*
964
 * Ensures that an internal jar referred to with its OS-path is not part of the non-Java resources
965
 */
966
public void testGetNonJavaResources5() throws CoreException {
967
	try {
968
		IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin");
969
		IFile file = createFile("/P/lib.jar", "");
970
		addLibraryEntry(project, file.getLocation(), false/*not exported*/);
971
		assertResourcesEqual(
972
			"Unexpected non-java resources for project",
973
			"/P/.classpath\n" + 
974
			"/P/.project",
975
			project.getNonJavaResources());
976
	} finally {
977
		this.deleteProject("P");
978
	}
979
}
980
/*
964
 * Ensures that getRequiredProjectNames() returns the project names in the classpath order
981
 * Ensures that getRequiredProjectNames() returns the project names in the classpath order
965
 * (regression test for bug 25605 [API] someJavaProject.getRequiredProjectNames(); API should specify that the array is returned in ClassPath order)
982
 * (regression test for bug 25605 [API] someJavaProject.getRequiredProjectNames(); API should specify that the array is returned in ClassPath order)
966
 */
983
 */
(-)model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java (-4 / +6 lines)
Lines 134-140 Link Here
134
							String resName = res.getName();
134
							String resName = res.getName();
135
135
136
							// ignore a jar file on the classpath
136
							// ignore a jar file on the classpath
137
							if (isClasspathResolved && isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput)) {
137
							if (isClasspathResolved && 
138
									isClasspathEntryOrOutputLocation(resFullPath, res.getLocation()/* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=244406 */, classpath, projectOutput)) {
138
								break;
139
								break;
139
							}
140
							}
140
							// ignore .java file if src == project
141
							// ignore .java file if src == project
Lines 164-170 Link Here
164
165
165
							// ignore non-excluded folders on the classpath or that correspond to an output location
166
							// ignore non-excluded folders on the classpath or that correspond to an output location
166
							if ((srcIsProject && !Util.isExcluded(res, inclusionPatterns, exclusionPatterns) && Util.isValidFolderNameForPackage(res.getName(), sourceLevel, complianceLevel))
167
							if ((srcIsProject && !Util.isExcluded(res, inclusionPatterns, exclusionPatterns) && Util.isValidFolderNameForPackage(res.getName(), sourceLevel, complianceLevel))
167
									|| (isClasspathResolved && isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput))) {
168
									|| (isClasspathResolved && isClasspathEntryOrOutputLocation(resFullPath, res.getLocation(), classpath, projectOutput))) {
168
								break;
169
								break;
169
							}
170
							}
170
							// else add non java resource
171
							// else add non java resource
Lines 264-274 Link Here
264
	/*
265
	/*
265
	 * Returns whether the given path is a classpath entry or an output location.
266
	 * Returns whether the given path is a classpath entry or an output location.
266
	 */
267
	 */
267
	private boolean isClasspathEntryOrOutputLocation(IPath path, IClasspathEntry[] resolvedClasspath, IPath projectOutput) {
268
	private boolean isClasspathEntryOrOutputLocation(IPath path, IPath location, IClasspathEntry[] resolvedClasspath, IPath projectOutput) {
268
		if (projectOutput.equals(path)) return true;
269
		if (projectOutput.equals(path)) return true;
269
		for (int i = 0, length = resolvedClasspath.length; i < length; i++) {
270
		for (int i = 0, length = resolvedClasspath.length; i < length; i++) {
270
			IClasspathEntry entry = resolvedClasspath[i];
271
			IClasspathEntry entry = resolvedClasspath[i];
271
			if (entry.getPath().equals(path)) {
272
			IPath entryPath;
273
			if ((entryPath = entry.getPath()).equals(path) || entryPath.equals(location)) {
272
				return true;
274
				return true;
273
			}
275
			}
274
			IPath output;
276
			IPath output;

Return to bug 244406