Bug 110291

Summary: [search] BasicSearchEngine return constructor declarations that doesn't exist in source
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.2 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.