Bug 27236

Summary: search: references to constructors - a subclass constructor reported
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 226151    
Bug Blocks: 24713    

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.