Community
Participate
Working Groups
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)
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?
I could not get it working in 3.3.2, but I could reproduce this issue. Working on a fix for 3.5.
Created attachment 111322 [details] Proposed fix
Released for 3.5M2. Regression test added in org.eclipse.jdt.core.tests.model.AttachSourceTests#testRootPath13
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.
Verified for 3.5M2 using I20080914-2000