Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 113999 Details for
Bug 249321
IPackagerFragmentRoot#getRawClasspathEntry() returns resolved ".." path
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
249321.txt (text/plain), 5.00 KB, created by
Jerome Lanneluc
on 2008-10-01 10:58:30 EDT
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-10-01 10:58:30 EDT
Size:
5.00 KB
patch
obsolete
>### 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)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 249321
: 113999