Bug 232880 - [select] Navigate to classes in workspace even if not on classpath
Summary: [select] Navigate to classes in workspace even if not on classpath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows Vista
: P3 enhancement (vote)
Target Milestone: 3.5 M3   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-19 20:21 EDT by Jeff McAffer CLA
Modified: 2008-10-27 08:51 EDT (History)
5 users (show)

See Also:


Attachments
Proposed fix (40.05 KB, patch)
2008-10-09 04:38 EDT, David Audel CLA
no flags Details | Diff
Additional patch (3.93 KB, patch)
2008-10-09 09:15 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2008-05-19 20:21:48 EDT
in RC1

- import as binary a bundle that is not in your target.  
- open some type in the new project and attach source
- select some type in the source and hit F3 (or ctrl-click)
- notice that nothing happens

I have verified that I am able to open type on the type that is selected and I am able to select the type name, hit ctrl-shift-T and have the open type dialog prepopulated with the type name.  But just navigating directly does not work.
Comment 1 Jeff McAffer CLA 2008-05-19 20:36:38 EDT
Even just opening a type from the target does not allow you to navigate. Basically is seems that if the type open is binary it is treated as a complete second class citizen.  Half of me is suspecting that this is a long standing issue though it is also hard for me to understand if that is true, what I've been doing in the past that made it all ok.  I tried adding everything to Java search and that addressed the issue of navigation.  While clearly this is a long standing issue, I thought we had made some progress on it.  Is there an option that could be used in this situation?  Novice (and not so novice) users are very confused when they can see a type referenced in Java and they cannot navigate to it though they can open type on it and it clearly is there.
Comment 2 Martin Aeschlimann CLA 2008-05-20 04:00:37 EDT
Code resolve works on the project's classpath. The project classpath is defined for the sources. All the dependencies of your JAR's are normally not on the classpath and you also don't want to put them there.
I assume this is the discussion from bug 73957 and the cure would be bug 110176.
Comment 3 Jerome Lanneluc CLA 2008-05-20 07:14:13 EDT
To reproduce:
1. New workspace
2. Import 'org.eclipse.core.resources'
3. Create a Java project 'P'
4. Add 'org.eclipse.jdt.core_3.4.0_v865.jar' as an external library to 'P'
5. Attach the corresponding source 'org.eclipse.jdt.core.source_3.4.0.v_865.jar'
6. Open 'IJavaElement'
7. Go to 'getResource()'
8. Select 'IResource'
9. Press F3
Observe: 'IResource' in 'org.eclipse.core.resources' is not opened
Comment 4 Jerome Lanneluc CLA 2008-05-20 07:15:04 EDT
If we fail to resolve a type referenced in a source attachment, we could use the search all type names (as Ctrl+Shift+T does) on the selection. 

Note I believe this scenario has never worked. Thus marking as enhancement.
Comment 5 Jerome Lanneluc CLA 2008-08-22 11:30:40 EDT
(In reply to comment #4)
Renaming title accordingly
Comment 6 Jerome Lanneluc CLA 2008-09-11 10:16:42 EDT
David, please look at this for M3
Comment 7 David Audel CLA 2008-10-09 04:38:44 EDT
Created attachment 114643 [details]
Proposed fix

With this patch if no types are found in the current project scope then types are searched in the workspace.

SelectionEngine use a searchAllTypeNames() request to find quickly the selected type.
Comment 8 David Audel CLA 2008-10-09 04:46:06 EDT
Released for 3.5M3.

Tests added
  ResolveTests2#testBug232880a() -> testBug232880i()
Comment 9 Markus Keller CLA 2008-10-09 06:30:06 EDT
Could you make the search case-sensitive? Normal resolution is also case-sensitive.

In HEAD, I now get hovers for every second word in a normal Javadoc description. E.g. Javadoc for java.lang.annotation.Retention:
- CLASS wrongly matches java.lang.Class
- member wrongly matches java.lang.reflect.Member
- ...
Comment 10 Dani Megert CLA 2008-10-09 07:37:26 EDT
>In HEAD, I now get hovers for every second word in a normal Javadoc
>description.
Agree, this is not good.
Comment 11 David Audel CLA 2008-10-09 09:15:38 EDT
Created attachment 114672 [details]
Additional patch

As said in previous comments, my patch is not good because the search must be case-sensitive. With this additional patch the search is case-sensitive.

It also add a regression test
  ResolveTests2#testBug3232880j()
Comment 12 David Audel CLA 2008-10-09 09:16:13 EDT
The additional fix is released
Comment 13 Jerome Lanneluc CLA 2008-10-27 08:51:19 EDT
Verified for 3.5M3 using I20081026-2000