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

(-)model/org/eclipse/jdt/internal/core/JavaProject.java (-6 / +6 lines)
Lines 2493-2504 Link Here
2493
		for (int i = 0; i < length; i++) {
2493
		for (int i = 0; i < length; i++) {
2494
2494
2495
			IClasspathEntry rawEntry = rawClasspath[i];
2495
			IClasspathEntry rawEntry = rawClasspath[i];
2496
			IClasspathEntry resolvedEntry = rawEntry;
2496
			IPath resolvedPath;
2497
			IPath resolvedPath;
2497
2498
2498
			switch (rawEntry.getEntryKind()){
2499
			switch (rawEntry.getEntryKind()){
2499
2500
2500
				case IClasspathEntry.CPE_VARIABLE :
2501
				case IClasspathEntry.CPE_VARIABLE :
2501
					IClasspathEntry resolvedEntry = null;
2502
					try {
2502
					try {
2503
						resolvedEntry = manager.getResolvedClasspathEntry(rawEntry, usePreviousSession);
2503
						resolvedEntry = manager.getResolvedClasspathEntry(rawEntry, usePreviousSession);
2504
					} catch (ClasspathEntry.AssertionFailedException e) {
2504
					} catch (ClasspathEntry.AssertionFailedException e) {
Lines 2563-2577 Link Here
2563
					break;
2563
					break;
2564
2564
2565
				case IClasspathEntry.CPE_LIBRARY:
2565
				case IClasspathEntry.CPE_LIBRARY:
2566
					rawEntry = ((ClasspathEntry) rawEntry).resolvedDotDot();
2566
					resolvedEntry = ((ClasspathEntry) rawEntry).resolvedDotDot();
2567
					// $FALL-THROUGH$ use the default code below
2567
					// $FALL-THROUGH$ use the default code below
2568
				default :
2568
				default :
2569
					if (result.rawReverseMap.get(resolvedPath = rawEntry.getPath()) == null) {
2569
					if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) {
2570
						result.rawReverseMap.put(resolvedPath , rawEntry);
2570
						result.rawReverseMap.put(resolvedPath , rawEntry);
2571
						result.rootPathToResolvedEntries.put(resolvedPath, rawEntry);
2571
						result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry);
2572
					}
2572
					}
2573
					resolvedEntries.add(rawEntry);
2573
					resolvedEntries.add(resolvedEntry);
2574
					if (rawEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) {
2574
					if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) {
2575
						externalFoldersManager.addFolder(resolvedPath); // no-op if not an external folder or if already registered
2575
						externalFoldersManager.addFolder(resolvedPath); // no-op if not an external folder or if already registered
2576
					}
2576
					}
2577
2577
(-)src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java (-3 / +21 lines)
Lines 1503-1509 Link Here
1503
/**
1503
/**
1504
 * Test raw entry inference performance for package fragment root
1504
 * Test raw entry inference performance for package fragment root
1505
 */
1505
 */
1506
public void testPackageFragmentRootRawEntry() throws CoreException, IOException {
1506
public void testPackageFragmentRootRawEntry1() throws CoreException, IOException {
1507
	File libDir = null;
1507
	File libDir = null;
1508
	try {
1508
	try {
1509
		String libPath = getExternalPath() + "lib";
1509
		String libPath = getExternalPath() + "lib";
Lines 1540-1546 Link Here
1540
 * Test raw entry inference performance for package fragment root in case
1540
 * Test raw entry inference performance for package fragment root in case
1541
 * original classpath had duplicate entries pointing to it: first raw entry should be found
1541
 * original classpath had duplicate entries pointing to it: first raw entry should be found
1542
 */
1542
 */
1543
public void testPackageFragmentRootRawEntryWhenDuplicate() throws CoreException, IOException {
1543
public void testPackageFragmentRootRawEntry2() throws CoreException, IOException {
1544
	File libDir = null;
1544
	File libDir = null;
1545
	try {
1545
	try {
1546
		String externalPath = getExternalPath();
1546
		String externalPath = getExternalPath();
Lines 1574-1580 Link Here
1574
 * @test That a JME is thrown when a classpath entry is no longer on the classpath
1574
 * @test That a JME is thrown when a classpath entry is no longer on the classpath
1575
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162104"
1575
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162104"
1576
 */
1576
 */
1577
public void testPackageFragmentRootNullRawEntry() throws CoreException, IOException {
1577
public void testPackageFragmentRootRawEntry3() throws CoreException, IOException {
1578
	File libDir = null;
1578
	File libDir = null;
1579
	try {
1579
	try {
1580
		String libPath = getExternalPath() + "lib";
1580
		String libPath = getExternalPath() + "lib";
Lines 1615-1620 Link Here
1615
		JavaCore.removeClasspathVariable("MyVar", null);
1615
		JavaCore.removeClasspathVariable("MyVar", null);
1616
	}
1616
	}
1617
}
1617
}
1618
/**
1619
 * Ensures that the ".." raw classpath entry for a root is not resolved
1620
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=249321 )
1621
 */
1622
public void testPackageFragmentRootRawEntry4() throws CoreException, IOException {
1623
	String externalJarPath = getWorkspaceRoot().getLocation().removeLastSegments(1).append("external.jar").toOSString();
1624
	try {
1625
		IJavaProject p = createJavaProject("P");
1626
		org.eclipse.jdt.core.tests.util.Util.writeToFile("", externalJarPath);
1627
		setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../../external.jar"), null, null)});
1628
		IPackageFragmentRoot root = p.getPackageFragmentRoots()[0];
1629
		IPath path = root.getRawClasspathEntry().getPath();
1630
		assertEquals("Unexpected path for raw classpath entry", "../../external.jar", path.toString());
1631
	} finally {
1632
		deleteResource(new File(externalJarPath));
1633
		deleteProject("P");
1634
	}
1635
}
1618
/*
1636
/*
1619
 * Ensures that opening a project update the project references
1637
 * Ensures that opening a project update the project references
1620
 * (regression test for bug 73253 [model] Project references not set on project open)
1638
 * (regression test for bug 73253 [model] Project references not set on project open)

Return to bug 249321