### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/JavaProject.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v retrieving revision 1.415 diff -u -r1.415 JavaProject.java --- model/org/eclipse/jdt/internal/core/JavaProject.java 26 Sep 2008 09:01:23 -0000 1.415 +++ model/org/eclipse/jdt/internal/core/JavaProject.java 1 Oct 2008 14:57:16 -0000 @@ -2493,12 +2493,12 @@ for (int i = 0; i < length; i++) { IClasspathEntry rawEntry = rawClasspath[i]; + IClasspathEntry resolvedEntry = rawEntry; IPath resolvedPath; switch (rawEntry.getEntryKind()){ case IClasspathEntry.CPE_VARIABLE : - IClasspathEntry resolvedEntry = null; try { resolvedEntry = manager.getResolvedClasspathEntry(rawEntry, usePreviousSession); } catch (ClasspathEntry.AssertionFailedException e) { @@ -2563,15 +2563,15 @@ break; case IClasspathEntry.CPE_LIBRARY: - rawEntry = ((ClasspathEntry) rawEntry).resolvedDotDot(); + resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot(); // $FALL-THROUGH$ use the default code below default : - if (result.rawReverseMap.get(resolvedPath = rawEntry.getPath()) == null) { + if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) { result.rawReverseMap.put(resolvedPath , rawEntry); - result.rootPathToResolvedEntries.put(resolvedPath, rawEntry); + result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry); } - resolvedEntries.add(rawEntry); - if (rawEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) { + resolvedEntries.add(resolvedEntry); + if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) { externalFoldersManager.addFolder(resolvedPath); // no-op if not an external folder or if already registered } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java,v retrieving revision 1.101 diff -u -r1.101 JavaProjectTests.java --- src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java 29 Aug 2008 09:50:32 -0000 1.101 +++ src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java 1 Oct 2008 14:57:18 -0000 @@ -1503,7 +1503,7 @@ /** * Test raw entry inference performance for package fragment root */ -public void testPackageFragmentRootRawEntry() throws CoreException, IOException { +public void testPackageFragmentRootRawEntry1() throws CoreException, IOException { File libDir = null; try { String libPath = getExternalPath() + "lib"; @@ -1540,7 +1540,7 @@ * Test raw entry inference performance for package fragment root in case * original classpath had duplicate entries pointing to it: first raw entry should be found */ -public void testPackageFragmentRootRawEntryWhenDuplicate() throws CoreException, IOException { +public void testPackageFragmentRootRawEntry2() throws CoreException, IOException { File libDir = null; try { String externalPath = getExternalPath(); @@ -1574,7 +1574,7 @@ * @test That a JME is thrown when a classpath entry is no longer on the classpath * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162104" */ -public void testPackageFragmentRootNullRawEntry() throws CoreException, IOException { +public void testPackageFragmentRootRawEntry3() throws CoreException, IOException { File libDir = null; try { String libPath = getExternalPath() + "lib"; @@ -1615,6 +1615,24 @@ JavaCore.removeClasspathVariable("MyVar", null); } } +/** + * Ensures that the ".." raw classpath entry for a root is not resolved + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=249321 ) + */ +public void testPackageFragmentRootRawEntry4() throws CoreException, IOException { + String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString(); + try { + IJavaProject p = createJavaProject("P"); + org.eclipse.jdt.core.tests.util.Util.writeToFile("", externalJarPath); + setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../../external.jar"), null, null)}); + IPackageFragmentRoot root = p.getPackageFragmentRoots()[0]; + IPath path = root.getRawClasspathEntry().getPath(); + assertEquals("Unexpected path for raw classpath entry", "../../external.jar", path.toString()); + } finally { + deleteResource(new File(externalJarPath)); + deleteProject("P"); + } +} /* * Ensures that opening a project update the project references * (regression test for bug 73253 [model] Project references not set on project open)