Bug 35965 - Source not found in source attachment
Summary: Source not found in source attachment
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 2.1.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-02 05:28 EST by Robert Schröder CLA
Modified: 2005-12-16 06:23 EST (History)
0 users

See Also:


Attachments
sss (99.25 KB, application/x-zip-compressed)
2005-12-16 06:23 EST, keit kivisild CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Schröder CLA 2003-04-02 05:28:41 EST
I defined a Classpath Variable which points to a directory.
In my project I extended this Variable to a subfolder of the defined directory where a lot of jar-files with compiled code exist.
I associated these class-jar-files with the corresponding source-jar-files - every source-jar contains all sources and only the sources of the class-jar related with it.
When I try to open the declaration of a class contained in one of these jars, Eclipse replies:
"Source not found
The source attachment does not contain the source for the file Foo.class.
You can change the source attachment by clicking Change Attached Source below:"
But even if I re-attach the right source-jar Eclipse won't find the source.

Since behaviour occurs since RC2. RC1 worked fine.

OS: Windows NT 4.0 Service Pack 6
Standard java (found in PATH-Variable)
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

used for compiling and running in Eclipse (with compiler compliance level 1.3):
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
Comment 1 Olivier Thomann CLA 2003-04-04 16:26:49 EST
I could not reproduce with a simple test case.
Please attach one of your binary jars and its corresponding source jar with
exact steps to reproduce.
Comment 2 Olivier Thomann CLA 2003-04-08 16:14:05 EDT
Without steps to reproduce, I will close this bug. I could not reproduce it with
a simple example. So there is something specific about your jar files. Could you
please attach one of each kind (source and binary)? Thanks.
Comment 3 Jiri Osmera CLA 2003-04-14 01:39:17 EDT
The same behavior occurs by me after the installation of version 2.1.
M4 works well.
Wrong source and bin jar can not probably cause this problem, because it 
doesn't work with all of them (commercial or my own).
Comment 4 Olivier Thomann CLA 2003-04-14 08:05:51 EDT
Could you please point me to where I could get such jar files? I tried to 
reproduce it and I could not. So without steps to reproduce, I cannot do 
anything on this PR.
Comment 5 Robert Schröder CLA 2003-04-14 09:35:47 EDT
In this project, the developed sources are under the package
DE.company_name.lots_of_subpackages.
At my local disk are only the source-files (*.java) checked out, which I need.
The rest of the project's sources are provided as compiled binaries at 107
jar-files and as 107 jar-files with the source-files (it's a big project).
The packages in these jar-files also start with DE.company_name.* .

I thought, the reason could be a malformed .classpath-file, but I reformatted
the .classpath-file and checked with RC1 (fine)
and 2.1 (didn't worked). (I attached a screenshot of the part of the
.classpath-file I thought of to be broken.)

My first eclipse-version was the M3 of 2.1. I created my project with this
eclipse-version.
I installed also the next eclipse-stable-builds: I deleted all directories
beneath my eclipse-folder except the workspace-folder. 
Then I extracted the eclipse-zip-file.

I added the jar-files to my project:
- Window | Preference | Java | Classpath Variables | New
Name: PCS_LIBS
Path: Folder : /src (see structure in folder_index.txt).
- myProject | right-mouse-click | Properties | Java Build Path | Tab Libraries
- Add Variable--> I selected the Classpath Variable PCS_LIBS --> Extend --> I
selected all jars under the lib directory
(clicked on the first jar, pressed and hold SHIFT and clicked on the last jar).
- I selected on the jars, choose Source Attachment and clicked on the button Edit:
Variable: PCS_LIBS
Extension: bst/src/<corresponding soource-jar>
- Some of the sources I added this way.
- But most of the sources I added by editing the .classpath-file at the root of
my project-folder. 
And after the next eclipse start, all the jar-files were shown with their
corresponding source-jar-files.
With RC1 this worked fine - all the sources were found.

I tested with this behaviour with a smaller number of source-attached jars 
(I only tested with a Classpath Variable with only 1 jar + attached source):
2.1 correctly showed the expected source.
This was an external jar
(http://www.jGoodies.com/download/commons/animation-nc-1_0_7.zip)

Another test with one with our jar-files showed the (at my computer) typical
behaviour:
"The source attachment does not contain..."

The jar-files are compiled under java  version 
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

Maybe this problem correlates with the number of the jar-files?

I send a zip with jars to your mail-address.
Comment 6 Olivier Thomann CLA 2003-04-14 10:07:10 EDT
I reproduced the problem. It comes from the fact that you are using package 
names that don't follow the conventions. If you rename 'DE' to 'de', it should 
work fine.
I will fix this problem since it is legal to define a package name starting 
with an capitalized letter even if this doesn't follow the conventions.
Comment 7 Olivier Thomann CLA 2003-04-14 10:45:10 EDT
Fixed and released in HEAD stream.
Regression test added.
Comment 8 Philipe Mulet CLA 2003-04-14 11:01:36 EDT
Olivier - please backport to 2.1 maintenance stream.
Comment 9 Olivier Thomann CLA 2003-04-14 12:28:20 EDT
Backported to 2.1 maintenance stream.
Comment 10 Jerome Lanneluc CLA 2003-04-15 10:46:13 EDT
Fixed in 2.2 stream as well.
Comment 11 David Audel CLA 2003-06-02 08:08:02 EDT
Verified.
Comment 12 David Audel CLA 2003-06-10 10:24:01 EDT
Verified for 3.0M1.
Comment 13 George CLA 2004-10-09 00:47:53 EDT
"the source attachment does not contain the source"

this is from the latest release of eclipse!
Is there a fix?
Thanks,
George
Comment 14 Olivier Thomann CLA 2004-10-09 14:12:14 EDT
This might be a new problem.
Please open a new bug report with steps to reproduce.
Comment 15 keit kivisild CLA 2005-12-16 06:23:22 EST
Created attachment 31863 [details]
sss