Bug 73929 - [search][doc] Java search tab documentation is confusing about qualified name
Summary: [search][doc] Java search tab documentation is confusing about qualified name
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-14 17:04 EDT by Gabrio Verratti CLA
Modified: 2005-05-26 21:52 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabrio Verratti CLA 2004-09-14 17:04:26 EDT
Wow, you guys have really got me confused with this feature.  I'm really not 
sure whether this is a bug or my own lack of understanding, but I can never 
get the Java Search to do what I'm wanting it to do.  I strongly believe that 
the usability of this element needs to be evaluated.

Take the field search for instance.  I can't ever find fields that I know 
exist.  Here's what the documentation says...

"Depending on what is searched for, the search string should describe the 
element...
... Field: the fully qualified name of the defining type and the field name 
(e.g. org.eclipse.jdt.internal.core.JavaElement.name)"

So unless I've misunderstood, the search string to use when trying to find a 
field should be the fully qualified name of the field.  Is this a search?  If 
I know exactly where to look for the field, I don't need a search.

My expectation of the Java search for a field is more along the following 
lines.

A search for a field using search string "mypackage.Foo", limiting to 
declarations should result in all field declarations of type "mypackage.Foo".

I'm sure there are ways to combine the search options to make meaningful 
searches, but the search dialog certainly doesn't aid in any appreciable way.
Comment 1 Kent Johnson CLA 2004-09-15 11:30:07 EDT
I suspect it was talking about finding references to a specific field, not its 
declaration.

If you search for references to a field 'foo' you could find many more 
references than 'p1.A.foo'.
Comment 2 Frederic Fusier CLA 2004-10-28 06:20:19 EDT
Unfortunately, I agree that documentation is a little bit confusing here.
It's absolutely not mandatory to specify the fully qualified name to be able to
find a field. Same thing for types, methods and constructors. It should write
for field:
"the field name and eventually the fully qualified name of the defining type
(eg. name or org.eclipse.jdt.internal.core.JavaElement.name)"

The difference is in the fact that if you do not specify the fully qualified
name, you could get several different matches.
Imagine you're looking for field "foo" declaration and your project contains 2
classes X and Y both defining a field foo. The result of your search without
qualified named will report the two declarations although a fully qualified one
would report only one or zero (if the qualification matches neither X nor Y)...

But this for search from Java Search tab in Search dialog. If you use the search
from popup-menu directly from Hierarchy or Outline views, Editor, or Package
Explorer, then you won't have any question about the search. It will work
automatically :-)

Just select the element you want to search (field in your example) and select
Search->Declarations->Workspace in popup-menu and you'll see it appearing in
Search View without having specified the fully qualified name...
Comment 3 Frederic Fusier CLA 2005-05-16 07:40:22 EDT
Fixed and released in HEAD.

Also added examples to show qualified and non-qualified strings...
Comment 4 Olivier Thomann CLA 2005-05-26 21:52:44 EDT
Verified in I20050526-2000