Bug 43967 - Search for references on local variable finds all occurances of variables of that type not just that variable.
Summary: Search for references on local variable finds all occurances of variables of ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 6015 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-01 04:39 EDT by Rob Jones CLA
Modified: 2003-11-21 12:04 EST (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 Rob Jones CLA 2003-10-01 04:39:15 EDT
When I do a search for references on a local variable I 
would expect the serach to be limited to the references of
that variable within the function (or code loop) where it
it has scope.
Unfortunately for some reason eclipse finds all the references
to variables of that type. Eg if the local variable is a String
all the 1,000s of references to String variables are found.

Eg. Create a new class
public class testc
{
	public void test()
	{
		String aString = null;
			
	}
}

Highlight the variable name 'aString'
and then right click
choose search | references | project
or     serach | references | workspace

There really is only one reference.
However 1,000s of Strings are found.

Go on, try it. If it dont work ask me for me details.
Comment 1 Dani Megert CLA 2003-10-01 04:44:30 EDT
The problem is that J Core returns the type instead of the local variable (for
which we do not have a model element) when doing code assist. Besides searching
there are other side effects e.g. F3 does not go to the declaration but opens
the type.

Moving to J Core for comments.
Comment 2 Philipe Mulet CLA 2003-10-12 05:00:47 EDT
Support for local variable elements is planned for M5
Comment 3 Jerome Lanneluc CLA 2003-10-23 11:49:25 EDT
JDT/Core now supports searching for references to and declarations of local 
variables. UI side needs to be fixed (see 45448)
Comment 4 Jerome Lanneluc CLA 2003-10-30 09:26:21 EST
*** Bug 6015 has been marked as a duplicate of this bug. ***
Comment 5 David Audel CLA 2003-11-21 12:04:46 EST
Verified