SearchEngine doesn't find multiple field declarations? [message #176247] |
Wed, 01 September 2004 13:23  |
Eclipse User |
|
|
|
Originally posted by: emerson.cse.ogi.edu
Howdy,
I'm having a bit of trouble - it appears that the SearchEngine can't
find all fields in multiple field declarations. For example, take the
compiled method from the class:
--------
public class TestCase {
int field1, field2, field3;
int field4;
public void method(){}
}
--------
when you run the following code (a pretty vanilla search):
--------
final List searchResults = new ArrayList();
SearchRequestor collector = new SearchRequestor(){
public void acceptSearchMatch(SearchMatch match) throws
CoreException {
searchResults.add(match);
}
};
SearchPattern pattern = SearchPattern.createPattern("*",
IJavaSearchConstants.FIELD,
IJavaSearchConstants.DECLARATIONS,
SearchPattern.R_PATTERN_MATCH);
SearchParticipant[] participants = new SearchParticipant[]
{SearchEngine.getDefaultSearchParticipant()};
JavaSearchScope scope = new JavaSearchScope();
scope.add(unit);
new SearchEngine().search(pattern,participants,scope,collector,m onitor);
--------
searchResults only contains two elements - field1 and field4. I would
expect field1, field2, field3, and field4.
Anyone have an explanation? A bug perhaps?
Thanks!
e
|
|
|
Re: SearchEngine doesn't find multiple field declarations? [message #176313 is a reply to message #176247] |
Wed, 01 September 2004 18:25  |
Eclipse User |
|
|
|
It sounds like a bug. Please enter a bug report against JDT Core.
Jerome
"Emerson Murphy-Hill" <emerson@cse.ogi.edu> wrote in message
news:ch50dk$8j2$1@eclipse.org...
> Howdy,
>
> I'm having a bit of trouble - it appears that the SearchEngine can't
> find all fields in multiple field declarations. For example, take the
> compiled method from the class:
>
> --------
>
> public class TestCase {
>
> int field1, field2, field3;
> int field4;
>
> public void method(){}
> }
>
> --------
>
> when you run the following code (a pretty vanilla search):
>
> --------
>
> final List searchResults = new ArrayList();
> SearchRequestor collector = new SearchRequestor(){
> public void acceptSearchMatch(SearchMatch match) throws
> CoreException {
> searchResults.add(match);
> }
> };
>
> SearchPattern pattern = SearchPattern.createPattern("*",
> IJavaSearchConstants.FIELD,
> IJavaSearchConstants.DECLARATIONS,
> SearchPattern.R_PATTERN_MATCH);
>
> SearchParticipant[] participants = new SearchParticipant[]
> {SearchEngine.getDefaultSearchParticipant()};
> JavaSearchScope scope = new JavaSearchScope();
> scope.add(unit);
>
> new SearchEngine().search(pattern,participants,scope,collector,m onitor);
>
> --------
>
> searchResults only contains two elements - field1 and field4. I would
> expect field1, field2, field3, and field4.
>
> Anyone have an explanation? A bug perhaps?
>
> Thanks!
>
> e
|
|
|
Powered by
FUDForum. Page generated in 0.03730 seconds