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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (-1 / +1 lines)
Lines 2226-2232 Link Here
2226
		IPath resolvedPath = getResolvedVariablePath(entry.getPath(), usePreviousSession);
2226
		IPath resolvedPath = getResolvedVariablePath(entry.getPath(), usePreviousSession);
2227
		if (resolvedPath == null)
2227
		if (resolvedPath == null)
2228
			return null;
2228
			return null;
2229
		resolvedPath = ClasspathEntry.resolveDotDot(resolvedPath);
2229
		resolvedPath = ClasspathEntry.resolveDotDot(ResourcesPlugin.getWorkspace().getRoot().getLocation(), resolvedPath);
2230
2230
2231
		Object target = JavaModel.getTarget(resolvedPath, false);
2231
		Object target = JavaModel.getTarget(resolvedPath, false);
2232
		if (target == null)
2232
		if (target == null)
(-)model/org/eclipse/jdt/internal/core/ClasspathEntry.java (-25 / +10 lines)
Lines 954-987 Link Here
954
	/*
954
	/*
955
	 * Resolves the ".." in the given path. Returns the given path if it contains no ".." segment.
955
	 * Resolves the ".." in the given path. Returns the given path if it contains no ".." segment.
956
	 */
956
	 */
957
	public static IPath resolveDotDot(IPath path) {
957
	public static IPath resolveDotDot(IPath root, IPath path) {
958
		IPath newPath = null;
958
		IPath newPath = null;
959
		IWorkspaceRoot root = null;
960
		IPath workspaceLocation = null;
961
		for (int i = 0, length = path.segmentCount(); i < length; i++) {
959
		for (int i = 0, length = path.segmentCount(); i < length; i++) {
962
			String segment = path.segment(i);
960
			String segment = path.segment(i);
963
			if (DOT_DOT.equals(segment)) {
961
			if (DOT_DOT.equals(segment)) {
964
				if (newPath == null) {
962
				if (newPath == null){
965
					if (i == 0) {
963
					newPath = root;
966
						workspaceLocation = (root = ResourcesPlugin.getWorkspace().getRoot()).getLocation();
967
						newPath = workspaceLocation;
968
					} else {
969
						newPath = path.removeFirstSegments(i);
970
					}
971
				} else {
972
					if (newPath.segmentCount() > 0) {
973
						newPath = newPath.removeLastSegments(1);
974
					} else {
975
						workspaceLocation = (root = ResourcesPlugin.getWorkspace().getRoot()).getLocation();
976
						newPath = workspaceLocation;
977
					}
978
				}
964
				}
979
			} else if (newPath != null) {
965
				if (newPath.segmentCount() > 0) {
980
				if (newPath.equals(workspaceLocation) && root.getProject(segment).isAccessible()) {
966
					newPath = newPath.removeLastSegments(1);
981
					newPath = new Path(segment).makeAbsolute();
982
				} else {
983
					newPath = newPath.append(segment);
984
				}
967
				}
968
			} else if (newPath != null) {
969
				newPath = newPath.append(segment);
985
			}
970
			}
986
		}
971
		}
987
		if (newPath == null)
972
		if (newPath == null)
Lines 1367-1374 Link Here
1367
		return buffer.toString();
1352
		return buffer.toString();
1368
	}
1353
	}
1369
	
1354
	
1370
	public ClasspathEntry resolvedDotDot() {
1355
	public ClasspathEntry resolvedDotDot(IPath root) {
1371
		IPath resolvedPath = resolveDotDot(this.path);
1356
		IPath resolvedPath = resolveDotDot(root, this.path);
1372
		if (resolvedPath == this.path)
1357
		if (resolvedPath == this.path)
1373
			return this;
1358
			return this;
1374
		return new ClasspathEntry(
1359
		return new ClasspathEntry(
Lines 1861-1867 Link Here
1861
1846
1862
			// library entry check
1847
			// library entry check
1863
			case IClasspathEntry.CPE_LIBRARY :
1848
			case IClasspathEntry.CPE_LIBRARY :
1864
				path = ClasspathEntry.resolveDotDot(path);
1849
				path = ClasspathEntry.resolveDotDot(project.getProject().getLocation(), path);
1865
				
1850
				
1866
				// do not validate entries from Class-Path: in manifest
1851
				// do not validate entries from Class-Path: in manifest
1867
				// (these entries are considered optional since the user cannot act on them)
1852
				// (these entries are considered optional since the user cannot act on them)
(-)model/org/eclipse/jdt/internal/core/JavaProject.java (-2 / +2 lines)
Lines 2586-2592 Link Here
2586
						
2586
						
2587
						if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
2587
						if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
2588
							// resolve ".." in library path
2588
							// resolve ".." in library path
2589
							cEntry = cEntry.resolvedDotDot();
2589
							cEntry = cEntry.resolvedDotDot(getProject().getLocation());
2590
							
2590
							
2591
							if (resolveChainedLibraries) {
2591
							if (resolveChainedLibraries) {
2592
								// resolve Class-Path: in manifest
2592
								// resolve Class-Path: in manifest
Lines 2602-2608 Link Here
2602
2602
2603
				case IClasspathEntry.CPE_LIBRARY:
2603
				case IClasspathEntry.CPE_LIBRARY:
2604
					// resolve ".." in library path
2604
					// resolve ".." in library path
2605
					resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot();
2605
					resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot(getProject().getLocation());
2606
					
2606
					
2607
					if (resolveChainedLibraries) {
2607
					if (resolveChainedLibraries) {
2608
						// resolve Class-Path: in manifest
2608
						// resolve Class-Path: in manifest

Return to bug 274737