Bug 91615 - Wrong class opened by debugger/"Open Type"
Summary: Wrong class opened by debugger/"Open Type"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-15 17:22 EDT by Danny Yates CLA
Modified: 2005-05-27 04:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Danny Yates CLA 2005-04-15 17:22:41 EDT
1) Create a new project in a blank workspace
2) Open the "Open Type" dialogue
3) Enter "ORB"
4) From the list, select org.omg.CORBA.ORB (not CORBA_2_3, or any of the Sun 
implemenation classes)
5) Actual class opened is com.sun.corba.se.org.omg.CORBA
Comment 1 Danny Yates CLA 2005-04-16 04:56:57 EDT
Forgot to mention that this is on 3.1M6 with Sun JDK 1.4.2_06
Comment 2 Danny Yates CLA 2005-04-22 06:33:50 EDT
Sorry guys, I've upped this to "blocker" because doing any serious development 
in 3.1M6 is not possible whilst this bug exists. :-(
Comment 3 John Wiegand CLA 2005-05-10 20:43:20 EDT
Looks to be a problem with the source attachment.  The outline shows the 
correct class, however, the source is incorrect.  (Correct source is in 
src.zip)
Comment 4 John Wiegand CLA 2005-05-13 19:59:35 EDT
Proposed fix idea: sort the rootPaths by number of segments (no segments 
first, most segments last).  This will avoid the current problem of getting a 
false hit on a compilation unit which matches a subset of another path name 
(in the case below: opens com.sun.corba.se.xxx instead of xxx 
(xxx=org.omg.CORBA.ORB).  

This will let us find the correct root more quickly by starting with the most 
likely candidates so we will do fewer probes.
Comment 5 Olivier Thomann CLA 2005-05-17 12:00:21 EDT
I think the bug is that there are too many root paths found in this case.
In this case, only the empty path should be the root path.
Once the root path detection is fixed, only the right source should be displayed.
Comment 6 Olivier Thomann CLA 2005-05-17 13:23:52 EDT
Right now the root path detection finds:

root[0]=com/sun
root[1]=com/sun/corba/se/internal
root[2]=com
root[3]=org/omg/stub
root[4]=com/sun/corba/se
root[5]=

I would expect only the last one.
Comment 7 Olivier Thomann CLA 2005-05-17 16:26:40 EDT
I propose another way to retrieve the source.

First we don't compute any root. We consider that the default root ("") is the
right one.
When looking for a source, we check the default. If we find a matching source,
we return it.

If not, we compute the roots sorting them by segment length and then we iterate
them. If we find more than one match, we can either:
- return the shortest path
- open the corresponding source and check the package declaration to find out if
one of them is the best match.

Doing this, it should solve this issue and speed up the source mapping for rt.jar.

John, any thought?
Comment 8 John Wiegand CLA 2005-05-17 16:32:59 EDT
just sorting by segment length ("" will be first) addresses the problem 
reported and I believe suffices.  I don't believe the further analysis is 
required (checking by segment length guarantees that you don't get the false 
hit UNLESS the src.zip is in error)
Comment 9 Olivier Thomann CLA 2005-05-17 16:35:46 EDT
Ok, but I still believe that checking first the default root prior to any
computation can be an improvement. If there is a match, this should be the right
one, right?
Comment 10 John Wiegand CLA 2005-05-17 17:38:49 EDT
Yes: checking "" first is a good optimization
Comment 11 Olivier Thomann CLA 2005-05-17 23:08:31 EDT
Fixed and released in HEAD.
Comment 12 Frederic Fusier CLA 2005-05-27 04:52:56 EDT
Verified for 3.1 RC1 with build I20050527-0010.