Bug 10207 - findMember should always return null for paths with device
Summary: findMember should always return null for paths with device
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 17209 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-02-25 15:53 EST by Nick Edgar CLA
Modified: 2003-07-24 14:26 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2002-02-25 15:53:55 EST
Build 20020214

While tracing through some code, I noticed that JavaModel.getTarget(...) calls 
IContainer.findMember(IPath), often with a filesystem path referring to an 
external jar, e.g. "d:/ibm-sdk-n130p-sr10a/jre/lib/rt.jar".
In this case, Core appends the path of the container to the given path (e.g. 
if container is workspace root: "/ibm-sdk-n130p-sr10a/jre/lib/rt.jar"), and 
therefore doesn't notice that this is an external path.
This would conflict if I actually had a project called "ibm-sdk-n130p-sr10a" 
and corresponding children.

For paths with a device set, findMember should always return null.

There might be other Core APIs with the same problem.
Comment 1 John Arthorne CLA 2002-02-27 16:53:42 EST
Isn't it a bug that the java model is looking in the workspace for an external 
jar?

The device is never interesting for workspace-relative paths, so it is always 
ignored.  The current approach is at least consistent.  It would be difficult to 
consistently fail for paths that contain a device.  For example, 
IContainer#getFile(IPath) cannot return null, so it would have to accept a path 
with a device in this case.
Comment 2 Philipe Mulet CLA 2002-02-28 05:48:32 EST
A classpath entry unfortunately doesn't remember whether it is external or not. 
The way we get the information is by looking it up first inside the workspace, 
and if unsuccessfull then we look for a File at the same location.

Comment 3 John Arthorne CLA 2002-02-28 10:00:47 EST
You can find out if the entry is external by checking for a device on the path.  
If the path has a device, then it must be external and you don't need to check 
in the workspace.

I'm still flip-flopping on how findMember should behave, I can see arguments for 
both sides...
Comment 4 DJ Houghton CLA 2002-05-02 18:54:04 EDT
Adding Jeem to CC for comments on API behaviour.
Comment 5 Darin Wright CLA 2002-05-03 08:44:16 EDT
A device does not make the resource external - i.e. if I ask a resource for its 
location, it will contain a device. I should be able to map back to the 
resource from an absolute path.
Comment 6 DJ Houghton CLA 2002-05-23 15:06:21 EDT
Investigate for 2.0. (may require clarification in spec)

I'm leaning towards the current behaviour. Current spec says that the given 
path (be it relative or absolute) is determined to be relative to the 
receiver. In the case of a path with a device, this would mean dropping the 
device.
Comment 7 John Arthorne CLA 2002-05-28 17:44:36 EDT
I think you should use IWorkspaceRoot.getFileForLocation(IPath).  This method 
maps from a filesystem path back to the corresponding workspace resource, if 
any.  This is more appropriate, because it expects a file-system path, wherease 
IContainer.findMember expects a workspace path.
Comment 8 John Arthorne CLA 2002-05-31 12:02:40 EDT
*** Bug 17209 has been marked as a duplicate of this bug. ***
Comment 9 John Arthorne CLA 2003-07-24 14:26:41 EDT
Not planning to fix.  Method is arguably behaving as spec'd.