Bug 242029 - Multiple source attachment paths don't work when source attachment path points to a folder
Summary: Multiple source attachment paths don't work when source attachment path point...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 3.5 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-24 16:47 EDT by fred carter CLA
Modified: 2008-09-15 12:42 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix (1.89 KB, patch)
2008-08-29 14:38 EDT, Olivier Thomann CLA
no flags Details | Diff
Project reproducing the problem (1.57 KB, application/binary)
2008-09-15 12:42 EDT, Jerome Lanneluc CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description fred carter CLA 2008-07-24 16:47:11 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Use jar file build from some directory foo
      foo contains both foo/src and foo/tests which are
      source locations
2. create .classpath entry::

       <classpathentry exported="true" kind="var" 
           path="PATH_ROOT/buildlib/local/something.jar" 
           sourcepath="PATH_ROOT/something"/>
    where most of the code in something.jar is actually
    found in PATH_ROOT/something/src, but there may be some
    in PATH_ROOT/something/otherSrc

3. Attempt to examine source attached to that jar file (via
   Navigate->open type or in the debugger or the java editor

Result:  Source not found --
    In Europa, this resolved OK -- finding source in
    PATH_ROOT/something/src/com/myplace/whatever/foo.java

If you change the source attachment (sourcepath in above example) to PATH_ROOT/something/src , it works correctly.  However, this is 1) a change from Europa, and 2) doesn't work if the source files in a jar file come from two (or more) different subdirectories.

More information:
In my case, PATH_ROOT is a variable, as noted above.

In my case, this mechanism is used to allow work using eclipse on projects with large amounts of code, where each module within PATH_ROOT generates, during a normal (ant) build, a jar file.  As we generally do not work with thousands of .class files around, this mechanism is superior here.  Europa did this fine, Ganymede seems to struggle.

If wild cards worked (..."sourcepath=PATH_ROOT/something/*" ), that might be a reasonable workaround/solution.

(Running atop JDK 1.5.0_08-b03, for what it's worth)
Comment 1 Brian Anderson CLA 2008-07-24 17:21:16 EDT
This exact problem came up in 3.0 and was reported as a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=96670.

I get the exact same problem under Linux using both java 1.5 and 1.6.  I reproduce the error by doing the following:

add a jar that is build with sources from rooted at two locations.  Open the jar and try and examine a function.  The "source not found" screen will appear so click "attach source".  Choosing the parent of the two source locations will not find the source for the function, only choosing the root of the source for the function will work.

As noted by the original reporter,  this worked fine in 3.3.1.  Is there a new way to specify multiple source locations or is this a regression?
Comment 2 Olivier Thomann CLA 2008-08-29 14:38:34 EDT
I could not get it working in 3.3.2, but I could reproduce this issue.
Working on a fix for 3.5.
Comment 3 Olivier Thomann CLA 2008-08-29 14:38:53 EDT
Created attachment 111322 [details]
Proposed fix
Comment 4 Olivier Thomann CLA 2008-08-29 14:54:01 EDT
Released for 3.5M2.
Regression test added in org.eclipse.jdt.core.tests.model.AttachSourceTests#testRootPath13
Comment 5 Jerome Lanneluc CLA 2008-09-15 12:42:17 EDT
Created attachment 112558 [details]
Project reproducing the problem

To reproduce in I20080617-2000:
1. Import the attached project in workspace
2. Ctrl+Shift+T
3. Type TestforX then Enter
Observe: The source is not shown.
Comment 6 Jerome Lanneluc CLA 2008-09-15 12:42:43 EDT
Verified for 3.5M2 using I20080914-2000