Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Unexpected results from SearchEngine#search
Unexpected results from SearchEngine#search [message #881279] Mon, 04 June 2012 09:13 Go to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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 #881364 is a reply to message #881279] Mon, 04 June 2012 12:14 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
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.
Re: Unexpected results from SearchEngine#search [message #881402 is a reply to message #881364] Mon, 04 June 2012 13:30 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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
--
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 13:48 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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
Previous Topic:Can C, python, fortran, java languages be highlighted in one document of Eclipse?
Next Topic:Eclipse doesn't refresh the images to load, nor misses them, nor nothing
Goto Forum:
  


Current Time: Thu Apr 25 04:22:33 GMT 2024

Powered by FUDForum. Page generated in 0.03280 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top