Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 54948

Summary: Search for references to class reports constructor calls but not javadoc references
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: philippe_mulet
Version: 3.0   
Target Milestone: 3.0 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 148804    

Description Markus Keller CLA 2004-03-16 04:51:18 EST
I20040310

Search for references to class AA. In "new AA()", "AA" is found.
In "@see AA#AA()", only the class reference (first "AA") is found, but not the
constructor (second "AA").

Either both constructors should be found or none of them.

/**
 * @see AA#AA()
 */
public class AA{
	AA( ){
		new AA();
	};
}
Comment 1 Markus Keller CLA 2004-03-16 09:20:20 EST
jdt-ui reminder: Disabled failing (new) test RenameTypeTests#test50().
Comment 2 Frederic Fusier CLA 2004-05-16 08:32:11 EDT
The second "AA" in @see AA#AA() is not an instance of class AA, it's a 
constructor reference. So it's normal that it is not found while searching to 
class reference. In fact this search does not found the "AA" of AA() {..} for 
the same reason and it does not hurt you...
If I write this example in different manner, I'm sure it will be more obvious:
/**
 * @see AA#AA(String)
 */
public class AA{
	AA(String str){
		new AA("test");
	};
}

Isn't it?
Comment 3 Frederic Fusier CLA 2004-05-19 13:02:06 EDT
Reopen after having talked about this with Philippe: the constructor reference
should include Type binding instead of constructor binding.
So, it should match the type reference...
Comment 4 Frederic Fusier CLA 2004-05-19 13:05:35 EDT
Olivier, Philippe told me that you were investigating a similar problem.
Perhaps it is a duplicate ?
Comment 5 Frederic Fusier CLA 2004-05-19 15:25:34 EDT
*** Bug 63044 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2004-05-19 15:30:46 EDT
The other PR is bug 62605.
Comment 7 Frederic Fusier CLA 2004-05-19 15:56:43 EDT
*** Bug 62650 has been marked as a duplicate of this bug. ***
Comment 8 Frederic Fusier CLA 2004-05-23 12:06:39 EDT
Forget all duplicate and reopening of this bug. I have mixed DOM and Compiler
AST nodes bindings...
So, resolved as invalid again as comment 2 arguments were definetely correct.
Comment 9 Markus Keller CLA 2006-06-30 07:05:11 EDT
This bug causes bug 148804.

From comment 2:
> In fact this search does not found the "AA" of AA() {..} for 
> the same reason and it does not hurt you...

It does hurt us, but not as much as the missing constructor references in javadoc. We already rename constructors manually, but doing a second search just to find constructor references in javadocs would be too much.
Comment 10 Frederic Fusier CLA 2006-06-30 09:57:11 EDT
(In reply to comment #9)
> This bug causes bug 148804.
> 
> It does hurt us, but not as much as the missing constructor references in
> javadoc. We already rename constructors manually, but doing a second search
> just to find constructor references in javadocs would be too much.
> 
I'm really interesting to know how do you rename constructor references in code?
Comment 11 Markus Keller CLA 2006-06-30 10:06:52 EDT
> I'm really interesting to know how do you rename constructor references in
> code?

Super-easy: we get them from the search engine. Every search for references to a class also reports the names in constructor invocations.

Just the names in constructor declarations and those in javadoc references to constructors are missing. The former are cheap to update manually; the latter would require another search.
Comment 12 Markus Keller CLA 2008-07-24 12:46:57 EDT
(In reply to comment #2)
> /**
>  * @see AA#AA(String)
>  */
> public class AA{
> 	AA(String str){
> 		new AA("test");
> 	};
> }

So why does a search for references to type AA find the reference to the constructor in 'new AA("test")', but not the reference to the same constructor in '#AA(String)'?

Together with comment 9, I think this should be enough justification to reopen and finally fix this bug.