Unexpected results from SearchEngine#search [message #881279] |
Mon, 04 June 2012 05:13  |
Eclipse User |
|
|
|
Hi JDT gurus,
I'd like to find all constructors that are available in 'java.lang'.
Therefore I do the following:
IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new
IJavaElement[] { javaProject });
SearchRequestor searchRequestor = new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
Object element = match.getElement();
if (element instanceof IMethod) {
System.out.println(((IMethod) element).getElementName());
} else if (element instanceof IType) {
System.err.print("IType ??? ");
System.err.println(((IType) element).getElementName());
}
}
};
doSearch(searchScope, searchRequestor);
with
public void doSearch(IJavaSearchScope searchScope, SearchRequestor
searchRequestor) throws CoreException {
SearchPattern pattern = new
ConstructorDeclarationPattern("java.lang".toCharArray(), null,
SearchPattern.R_PREFIX_MATCH);
new SearchEngine().search(pattern,
SearchUtils.getDefaultSearchParticipants(), searchScope,
searchRequestor, new NullProgressMonitor());
}
I can see e.g. these entries in the dump (among others which follow a
similar pattern). Where do they come from and what am I doing wrong to
get constructor declarations instead of ITypes?
// CNFE has 3 constructors but is listed 5 times
IType ??? ClassNotFoundException
IType ??? ClassNotFoundException
IType ??? ClassNotFoundException
IType ??? ClassNotFoundException
IType ??? ClassNotFoundException
// huh? results from an interface
IType ??? CharSequence
IType ??? CharSequence
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
|
|
Re: Unexpected results from SearchEngine#search [message #881408 is a reply to message #881402] |
Mon, 04 June 2012 09:48  |
Eclipse User |
|
|
|
Ticket filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=381567
Regards,
Sebastian
Am 04.06.12 15:30, schrieb Sebastian Zarnekow:
> Am 04.06.12 14:14, schrieb Satyam Kandula:
>> This is a bug. Looks like javadoc processing is causing this problem.
>> Disabling the javadoc fixes the issue. Please file a bug for this. BTW,
>> you may get some IType's as elements to indicate default constructor
>> that is not in the source code.
>
> Thanks for the fast response. I expected some IType matches due to
> default constructors in source types, yes. But CharSequence and multiple
> reported classes were confusing.
>
> Regards,
> Sebastian
|
|
|
Powered by
FUDForum. Page generated in 0.04489 seconds