Bug 27236 - search: references to constructors - a subclass constructor reported
Summary: search: references to constructors - a subclass constructor reported
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 226151
Blocks: 24713
  Show dependency tree
 
Reported: 2002-11-27 09:34 EST by Adam Kiezun CLA
Modified: 2008-04-08 12:37 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 Adam Kiezun CLA 2002-11-27 09:34:55 EST
20021126
package p;
class A{
    A(){
    }
}
class B extends A{
    B(){
    }
}
search for references to A's constructor - you'll find B's construcotr
i guess that's because of the implicit call to super()
Comment 1 Adam Kiezun CLA 2002-11-27 10:10:39 EST
even worse here:
package p;
class A{
    A(){
    }
}
class B extends A{
}

class B is reported as a reference to A
Comment 2 Jerome Lanneluc CLA 2002-11-28 06:48:44 EST
This works as designed. What is the problem?
Comment 3 Jerome Lanneluc CLA 2002-11-28 07:23:07 EST
Actually, this is a good feature for refactor: when refactoring A() to A(int i) 
in the second test case, you want to add a B(int i) constructor.
Comment 4 Jerome Lanneluc CLA 2002-12-05 07:32:39 EST
No response. Closing since it works as designed.
Comment 5 Adam Kiezun CLA 2002-12-05 08:54:50 EST
(sorry for not replying so long)

are you sure?
reporting a class as a reference to a construcotr is incorrect i think.
also construcotrs are statically bounnd - reporting them as if there were a 
hierarchy of them is incorrect as well.

in my code i had to put a rather nasty workaround for this bug.
Comment 6 Jerome Lanneluc CLA 2002-12-05 11:44:36 EST
> are you sure?
Yes, I'm sure it was a design choice :-) (see JDT Core build notes and the 'New 
and noteworthy' notes for M2)

>reporting a class as a reference to a construcotr is incorrect i think.
If we want to report them, and the class as no constructor, this is the only 
IJavaElement we can provide.

>also construcotrs are statically bounnd - reporting them as if there were a 
>hierarchy of them is incorrect as well.
Not sure I understand this. What hierarchy?

>in my code i had to put a rather nasty workaround for this bug.
I'm sorry about that, but I think it is good to have it when doing a regular 
search. For example, a uses case would be: Before I delete a constructor I want 
to know what other constructors/classes will be impacted.