Community
Participate
Working Groups
Build ID: I20080409-1425 Steps To Reproduce: The problem seems to occur when I have any Java editors that are open and dirty (and the class it is editing also contains annotations). These dirty editors are editing classes outside of the current project for which I obtain the package fragment roots. Here's the code, (arEls contains 2 PackageFragmentRoot objects, 1 is the single package in the src folder, and the other is the package in the '.apt_generated' folder, both from the same project). scope = SearchEngine.createJavaSearchScope(arEls); SearchPattern pattern = SearchPattern.createPattern("*", IJavaSearchConstants.ANNOTATION_TYPE, IJavaSearchConstants.ANNOTATION_TYPE_REFERENCE, SearchPattern.R_PATTERN_MATCH); //$NON-NLS-1$ if(pattern!=null) { try { searchEngine.search(pattern, participats, scope, requestor, null); } catch(Exception e) { e.printStackTrace(); } } The above search is returning even those modified classes outside of the two package fragments as matches in the acceptSearchMatch() api in my searchrequestor class. I noticed there was code BasicSearchEngine.findMatches() at line 216 where working copies are added: SearchDocument[] matches = MatchLocator.addWorkingCopies(pattern, indexMatches, getWorkingCopies(), participant); Does the code in addWorkingCopies limit the working copies added to those that are also part of the search scope?
Created attachment 98974 [details] Proposed fix and regression test
Frederic, could you please review?
Patch looks good to me: +1
Fix and test released for 3.4RC1
Verified for 3.4RC1 using I20080510-2000