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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/ClasspathEntry.java (-25 / +11 lines)
Lines 1002-1035 Link Here
1002
	/*
1002
	/*
1003
	 * Resolves the ".." in the given path. Returns the given path if it contains no ".." segment.
1003
	 * Resolves the ".." in the given path. Returns the given path if it contains no ".." segment.
1004
	 */
1004
	 */
1005
	public static IPath resolveDotDot(IPath path) {
1005
	public static IPath resolveDotDot(IPath root, IPath path) {
1006
		IPath newPath = null;
1006
		IPath newPath = null;
1007
		IPath workspaceLocation = null;
1008
		for (int i = 0, length = path.segmentCount(); i < length; i++) {
1007
		for (int i = 0, length = path.segmentCount(); i < length; i++) {
1009
			String segment = path.segment(i);
1008
			String segment = path.segment(i);
1010
			if (DOT_DOT.equals(segment)) {
1009
			if (DOT_DOT.equals(segment)) {
1011
				if (newPath == null) {
1010
				if (newPath == null){
1012
					if (i == 0) {
1011
					newPath = root;
1013
						workspaceLocation = workspaceRoot.getLocation();
1014
						newPath = workspaceLocation;
1015
					} else {
1016
						newPath = path.removeFirstSegments(i);
1017
					}
1018
				} else {
1019
					if (newPath.segmentCount() > 0) {
1020
						newPath = newPath.removeLastSegments(1);
1021
					} else {
1022
						workspaceLocation = workspaceRoot.getLocation();
1023
						newPath = workspaceLocation;
1024
					}
1025
				}
1012
				}
1013
				if (newPath.segmentCount() > 0) {
1014
					newPath = newPath.removeLastSegments(1);
1015
 				}
1026
			} else if (newPath != null) {
1016
			} else if (newPath != null) {
1027
				if (newPath.equals(workspaceLocation) && workspaceRoot.getProject(segment).isAccessible()) {
1017
				newPath = newPath.append(segment);
1028
					newPath = new Path(segment).makeAbsolute();
1018
 			}
1029
				} else {
1030
					newPath = newPath.append(segment);
1031
				}
1032
			}
1033
		}
1019
		}
1034
		if (newPath == null)
1020
		if (newPath == null)
1035
			return path;
1021
			return path;
Lines 1419-1426 Link Here
1419
		return buffer.toString();
1405
		return buffer.toString();
1420
	}
1406
	}
1421
	
1407
	
1422
	public ClasspathEntry resolvedDotDot() {
1408
	public ClasspathEntry resolvedDotDot(IPath root) {
1423
		IPath resolvedPath = resolveDotDot(this.path);
1409
		IPath resolvedPath = resolveDotDot(root, this.path);
1424
		if (resolvedPath == this.path)
1410
		if (resolvedPath == this.path)
1425
			return this;
1411
			return this;
1426
		return new ClasspathEntry(
1412
		return new ClasspathEntry(
Lines 1919-1925 Link Here
1919
1905
1920
			// library entry check
1906
			// library entry check
1921
			case IClasspathEntry.CPE_LIBRARY :
1907
			case IClasspathEntry.CPE_LIBRARY :
1922
				path = ClasspathEntry.resolveDotDot(path);
1908
				path = ClasspathEntry.resolveDotDot(project.getProject().getLocation(), path);
1923
				
1909
				
1924
				// do not validate entries from Class-Path: in manifest
1910
				// do not validate entries from Class-Path: in manifest
1925
				// (these entries are considered optional since the user cannot act on them)
1911
				// (these entries are considered optional since the user cannot act on them)
(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (-1 / +1 lines)
Lines 2417-2423 Link Here
2417
		IPath resolvedPath = getResolvedVariablePath(entry.getPath(), usePreviousSession);
2417
		IPath resolvedPath = getResolvedVariablePath(entry.getPath(), usePreviousSession);
2418
		if (resolvedPath == null)
2418
		if (resolvedPath == null)
2419
			return null;
2419
			return null;
2420
		resolvedPath = ClasspathEntry.resolveDotDot(resolvedPath);
2420
		resolvedPath = ClasspathEntry.resolveDotDot(ResourcesPlugin.getWorkspace().getRoot().getLocation(), resolvedPath);
2421
2421
2422
		Object target = JavaModel.getTarget(resolvedPath, false);
2422
		Object target = JavaModel.getTarget(resolvedPath, false);
2423
		if (target == null)
2423
		if (target == null)
(-)model/org/eclipse/jdt/internal/core/JavaProject.java (-3 / +3 lines)
Lines 2588-2594 Link Here
2588
			for (int index = 0; index < rawClasspath.length; index++) {
2588
			for (int index = 0; index < rawClasspath.length; index++) {
2589
				IClasspathEntry currentEntry = rawClasspath[index]; 
2589
				IClasspathEntry currentEntry = rawClasspath[index]; 
2590
				if (currentEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
2590
				if (currentEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
2591
					rawLibrariesPath.add(ClasspathEntry.resolveDotDot(currentEntry.getPath()));
2591
					rawLibrariesPath.add(ClasspathEntry.resolveDotDot(getProject().getLocation(), currentEntry.getPath()));
2592
				}
2592
				}
2593
			}
2593
			}
2594
			if (referencedEntries != null) {
2594
			if (referencedEntries != null) {
Lines 2676-2682 Link Here
2676
						
2676
						
2677
						if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
2677
						if (cEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
2678
							// resolve ".." in library path
2678
							// resolve ".." in library path
2679
							cEntry = cEntry.resolvedDotDot();
2679
							cEntry = cEntry.resolvedDotDot(getProject().getLocation());
2680
							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965
2680
							// https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965
2681
							// Do not resolve if the system attribute is set to false	
2681
							// Do not resolve if the system attribute is set to false	
2682
							if (resolveChainedLibraries
2682
							if (resolveChainedLibraries
Lines 2697-2703 Link Here
2697
2697
2698
				case IClasspathEntry.CPE_LIBRARY:
2698
				case IClasspathEntry.CPE_LIBRARY:
2699
					// resolve ".." in library path
2699
					// resolve ".." in library path
2700
					resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot();
2700
					resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot(getProject().getLocation());
2701
					
2701
					
2702
					if (resolveChainedLibraries && result.rawReverseMap.get(resolvedEntry.getPath()) == null) {
2702
					if (resolveChainedLibraries && result.rawReverseMap.get(resolvedEntry.getPath()) == null) {
2703
						// resolve Class-Path: in manifest
2703
						// resolve Class-Path: in manifest

Return to bug 274737