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 223032

Summary: Find usages: constructors usages are not properly found and marked in the source code
Product: cnd Reporter: crimcat <crimcat>
Component: Code ModelAssignee: petrk
Status: NEW ---    
Severity: normal CC: der-muell, tbrunhoff
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description crimcat 2012-11-30 08:49:51 UTC
Let's consider the following code;
------------------
class class_a {
public:
    explicit class_a(int a) : _a(a) { }
    class_a(int a, int b): _a(a), _b(b) { }
    class_a(int a, int b, int c) : _a(c), _b(b), _c(c) { }
    virtual ~class_a() { }
    
private:
    int _a;
    int _b;
    int _c;
};

class class_b: public class_a {
public:
    class_b(int a, int b, int c, int d, int e): class_a(a, b, c), _a(d), _b(e) { }
    explicit class_b(int a): class_a(a, 0, 0), _a(-1), _b(-1) { }
    class_b(int a, int c): class_a(a, c), _a(0), _b(0) { }
    virtual ~class_b() { }
    
private:
    int _a;
    int _b;
};
------------------
If I select any constructor of, say, class_a in the editor I see all usages of this constructor marked in the editor window. If I use 'Find Usages' from the right-click context menu - I would see the same result.
Now I select exactly the class name - so I navigate the cursor to the class_a name in the declaration of the class:
class class_a {
Then the editor highlights me all usages of this class name (identifier). And this is correct. But, when I select 'Find Usages' from the right-click context menu I have in the result list along with the all constructor calls in the initialization lists, which is wrong, because I did not search for a constructor usages.
And then just add implicit constructors below this code:
------------------
int
main(int argc, char** argv) {
    
    class_b b_obj1(1, 2, 3, 4, 5);
    class_b b_obj2(7);
    class_b b_obj3(0, 0);
    
    class_a a_obj1(100);
    class_a a_obj2(1, 2, 3);

    return 0;
}
------------------
These constructors are not highlighted in the editor if selected, and not present in the results of the 'Find Usages'. It seems also to be wrong.
Comment 1 Egor Ushakov 2013-08-02 15:09:18 UTC
*** Bug 228290 has been marked as a duplicate of this bug. ***
Comment 2 Egor Ushakov 2013-08-02 15:09:42 UTC
See more examples in the Bug 228290
Comment 3 Vladimir Voskresensky 2014-11-20 11:05:15 UTC
*** Bug 220977 has been marked as a duplicate of this bug. ***