Bug 35561 - No source found if attached file contains 2 potential root paths
Summary: No source found if attached file contains 2 potential root paths
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal with 1 vote (vote)
Target Milestone: 2.1 RC4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 35510 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-24 06:00 EST by Jerome Lanneluc CLA
Modified: 2003-03-28 06:46 EST (History)
2 users (show)

See Also:


Attachments
test.jar (1.22 KB, application/octet-stream)
2003-03-24 06:01 EST, Jerome Lanneluc CLA
no flags Details
Apply this patch on SourceMapper.java (1.20 KB, patch)
2003-03-24 09:28 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2003-03-24 06:00:33 EST
Build RC3

1. Create Java project 'P'
2. Add 'test.jar' (attached to this bug report) as external jar
3. Edit its source attachement to add also 'test.jar'
4. Open Type... p/X.class
Observe: The source src/p/X.java is not found for p/X.class
Comment 1 Jerome Lanneluc CLA 2003-03-24 06:01:10 EST
Created attachment 4313 [details]
test.jar
Comment 2 Philipe Mulet CLA 2003-03-24 06:10:47 EST
That was supposed to work... Olivier, pls investigate.
Comment 3 Jerome Lanneluc CLA 2003-03-24 07:22:22 EST
Setting the rootpath by editing the .classpath file doesn't work either. This 
used to work in 2.0
Comment 4 Olivier Thomann CLA 2003-03-24 09:17:01 EST
The problem was during the computation of the first level package names. I
didn't check that the entry was a .class file name. Then the src/p/X.java was
considered as an entry and src was considered as a first level package name.
Then the computed root path was always "".
I have a fix for it. I will attach the patch to this PR.
Comment 5 Olivier Thomann CLA 2003-03-24 09:28:13 EST
Created attachment 4319 [details]
Apply this patch on SourceMapper.java

Select the SourceMapper compilation unit and apply the above patch. It should
fix your problem. All existing attach source tests are still green.
Comment 6 Olivier Thomann CLA 2003-03-24 12:15:19 EST
This should be a RC4 fix. It can be considered as a regression since 2.0.
Comment 7 Kevin Klinemeier CLA 2003-03-24 12:24:13 EST
*** Bug 35510 has been marked as a duplicate of this bug. ***
Comment 8 Philipe Mulet CLA 2003-03-25 07:41:23 EST
Olivier - in patch, are you sure you can reuse existing root path set ?

+		if (this.rootPaths == null) {
+			this.rootPaths = new HashSet();
+		}

Shouldn't it be cleared when reused ?
Comment 9 Philipe Mulet CLA 2003-03-25 10:53:34 EST
Candidating for RC4
Comment 10 Darin Wright CLA 2003-03-25 11:13:10 EST
+1
Comment 11 Olivier Thomann CLA 2003-03-25 11:21:24 EST
The roots are computed only once. As far as I know the source mapper is created 
only once when a source is attached to a root. Therefore the rootPaths should 
not be reinitialized if a root has been specified in the constructor, otherwise 
you need to initialize the set.
Comment 12 Philipe Mulet CLA 2003-03-25 11:36:39 EST
Ok, sounds good then.
Comment 13 Dirk Baeumer CLA 2003-03-25 12:14:54 EST
+1
Comment 14 Philipe Mulet CLA 2003-03-25 12:23:50 EST
Released for integration
Comment 15 David Audel CLA 2003-03-28 06:46:24 EST
Verified.