This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 132571 - Find Usages does not find variable declaration
Summary: Find Usages does not find variable declaration
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-10 19:53 UTC by Alexander Pepin
Modified: 2008-05-20 05:16 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pepin 2008-04-10 19:53:18 UTC
Steps to reproduce:
- create Args sample
- open args.c
- right-click on "i" variable and call Find Usages for it
Result: FindUsages finds all occurences of "i" in the source file except its declaration (int i;).
Comment 1 soldatov 2008-04-10 20:23:31 UTC
But 'Find Usages' works same in Java pack. Is it bug? P2?
Comment 2 Vladimir Voskresensky 2008-04-10 20:35:05 UTC
This is expected behavior. To be consistent with Java.
Declaration is not Usages.
Comment 3 Alexander Pepin 2008-04-11 11:14:42 UTC
I believe that Java also behaves wrongly and we should file an issue against Find Usages in Java because in both C/C++
and Java a variable can be initialized within the declaration statement, e.g. int i = 0; or even int i = getVal(); where
getVal() is a function returning int value. 
Comment 4 Vladimir Voskresensky 2008-04-11 22:22:26 UTC
I agree, that in Java you always have only one declaration and easily navigate to it by Ctrl-Click.
In C/C++ there are could be a lot of declarations of the same function and it could be valid query to show all
declarations as well.
I think, we can introduce additional search criteria like:
...
[ ] Find Usages
[ ] Find Declarations
...
Comment 5 Vladimir Voskresensky 2008-05-16 13:59:38 UTC
fixed. You are right for C++ the declaration is quite important, because they could be multiple or contains important
initialization information.

log:
 http://hg.netbeans.org/main?cmd=changeset;node=0002582302b4
Comment 6 Quality Engineering 2008-05-20 05:16:54 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #206 build
Changeset: http://hg.netbeans.org/main/rev/0002582302b4
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed IZ#132571: Find Usages does not find variable declaration
- Show C++ the declaration in Find Usages