Bug 110291 - [search] BasicSearchEngine return constructor declarations that doesn't exist in source
Summary: [search] BasicSearchEngine return constructor declarations that doesn't exist...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-22 05:09 EDT by David Audel CLA
Modified: 2005-12-13 09:27 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2005-09-22 05:09:23 EDT
1) create VectXX.java
public class VectXX {
  public class VectYY {
  }
}

2) if you use the following search request with VectXX in your workspace, one of
the result is the VectYY() constructor. But this methods doesn't exist.

SearchRequestor searchRequestor = new SearchRequestor() {
  public void acceptSearchMatch(SearchMatch match) throws CoreException {
    IJavaElement element = (IJavaElement) match.getElement();
    if(!element.exists()) {
      System.out.println(element);
    }
  }
};

new BasicSearchEngine(workingCopies).search(
  SearchPattern.createPattern(
    String.valueOf("Vect"),
    IJavaSearchConstants.CONSTRUCTOR,
    IJavaSearchConstants.DECLARATIONS,
    SearchPattern.R_PREFIX_MATCH)),	
  new SearchParticipant[]{BasicSearchEngine.getDefaultSearchParticipant()},
  aScope,
  searchRequestor,
  null);
Comment 1 Frederic Fusier CLA 2005-12-08 11:30:12 EST
Fixed and released in HEAD.

Changes done in MatchLocator reportMatching(AbstractMethodDeclaration,...) to use type instead of method for match associated element as default constructor does not exist in source...

Test case added in JavaSearchBugsTests
Comment 2 Olivier Thomann CLA 2005-12-13 09:27:23 EST
Verified for 3.2M4 in I20051212-2000.