Bug 43276 - How to search for implicit constructors
Summary: How to search for implicit constructors
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-18 06:03 EDT by Dirk Baeumer CLA
Modified: 2003-09-24 09:17 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 Dirk Baeumer CLA 2003-09-18 06:03:33 EDT
I20030917

In the following example:

package p;

class A{
	class Inner{
	}
}
class B extends A.Inner{
	B(){
		new A().super();
	}
}

Searching for the implicit constructor Inner using the string 
pattern "p.A.Inner.Inner()" will result in no match. How do we search for 
implicit constructors in this case.
Comment 1 Philipe Mulet CLA 2003-09-18 08:58:59 EDT
Default constructors are not existing in source, thus you can neither find them 
in sources nor get access to these when navigating through the JavaModel.

What kind of an element would you expect ? Since you cannot see it in the 
outliner anyway... 
Comment 2 Dirk Baeumer CLA 2003-09-18 11:53:40 EDT
But you can reference them in source. So there should be a way to find all 
references of a default constructor even if it doesn't exist in source.

IMO, the search result contains the enclosing element and the positions not 
the element itself, which is fine when searching for references. 
Comment 3 Philipe Mulet CLA 2003-09-24 03:52:49 EDT
References should work I agree, but declaration matches should not as they 
don't exist in the source.
Comment 4 Dirk Baeumer CLA 2003-09-24 04:45:42 EDT
Agree, that we can't expect to find declarations for default constructors.
Comment 5 Philipe Mulet CLA 2003-09-24 07:50:17 EDT
Searching for ""p.A.Inner()" works.
Comment 6 Philipe Mulet CLA 2003-09-24 07:57:20 EDT
See the spec on SearchEngine:

 *  	<li>search for case sensitive references to exact <code>Object()</code> 
constructor:
 *			<code>createSearchPattern("java.lang.Object()", 
CONSTRUCTOR, REFERENCES, true);</code></li>

Closing.
Comment 7 Dirk Baeumer CLA 2003-09-24 09:07:31 EDT
Thanks.

Why is this inconsistent to methods:  p.A.Inner.foo() is the pattern for 
method foo but p.A.Inner.Inner() isn't the pattern for default constructors.
Comment 8 Philipe Mulet CLA 2003-09-24 09:17:49 EDT
Invoking a constructor doesn't require you to type new X.X() either...