Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » SearchEngine doesn't find multiple field declarations?
SearchEngine doesn't find multiple field declarations? [message #176247] Wed, 01 September 2004 13:23 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Source attachment to jar, using variable prefix
Next Topic:Tomcat 5.5 with Eclipse JDT Java Compiler
Goto Forum:
  


Current Time: Sun Jun 08 19:56:14 EDT 2025

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

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

Back to the top