Buggy code:
public class SearchableEnvironment implements IJavaSearchConstants , INameEnvironment { public NameLookup nameLookup ; protected ICompilationUnit unitToSkip ; protected org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies ; protected JavaProject project ; protected IJavaSearchScope searchScope ; protected boolean checkAccessRestrictions ; public SearchableEnvironment ( JavaProject project , org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies ) throws JavaModelException { } public SearchableEnvironment ( JavaProject project , WorkingCopyOwner owner ) throws JavaModelException { } private static int convertSearchFilterToModelFilter ( int searchFilter ) { } protected NameEnvironmentAnswer find ( String typeName , String packageName ) { } public void findPackages ( char [ ] prefix , ISearchRequestor requestor ) { } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) { } public NameEnvironmentAnswer findType ( char [ ] name , char [ ] [ ] packageName ) { } public void findTypes ( char [ ] prefix , final boolean findMembers , boolean camelCaseMatch , int searchFor , final ISearchRequestor storage ) { try { final String excludePath ; if ( ( this . unitToSkip ) != null ) { if ( ! ( ( this . unitToSkip ) instanceof IJavaElement ) ) { findTypes ( new String ( prefix ) , storage , SearchableEnvironment . convertSearchFilterToModelFilter ( searchFor ) ) ; return ; } excludePath = ( ( IJavaElement ) ( this . unitToSkip ) ) . getPath ( ) . toString ( ) ; } else { excludePath = null ; } int lastDotIndex = CharOperation . lastIndexOf ( '.' , prefix ) ; char [ ] qualification ; char [ ] simpleName ; if ( lastDotIndex < 0 ) { qualification = null ; if ( camelCaseMatch ) { simpleName = prefix ; } else { simpleName = CharOperation . toLowerCase ( prefix ) ; } } else { qualification = CharOperation . subarray ( prefix , 0 , lastDotIndex ) ; if ( camelCaseMatch ) { simpleName = CharOperation . subarray ( prefix , ( lastDotIndex + 1 ) , prefix . length ) ; } else { simpleName = CharOperation . toLowerCase ( CharOperation . subarray ( prefix , ( lastDotIndex + 1 ) , prefix . length ) ) ; } } IProgressMonitor progressMonitor = new IProgressMonitor ( ) { boolean isCanceled = false ; public void beginTask ( String name , int totalWork ) { } public void done ( ) { } public void internalWorked ( double work ) { } public boolean isCanceled ( ) { return isCanceled ; } public void setCanceled ( boolean value ) { isCanceled = value ; } public void setTaskName ( String name ) { } public void subTask ( String name ) { } public void worked ( int work ) { } } ; IRestrictedAccessTypeRequestor typeRequestor = new IRestrictedAccessTypeRequestor ( ) { public void acceptType ( int modifiers , char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path , AccessRestriction access ) { if ( ( excludePath != null ) && ( excludePath . equals ( path ) ) ) return ; if ( ( ( ! findMembers ) && ( enclosingTypeNames != null ) ) && ( ( enclosingTypeNames . length ) > 0 ) ) return ; storage . acceptType ( packageName , simpleTypeName , enclosingTypeNames , modifiers , access ) ; } } ; try { int matchRule = SearchPattern . R_PREFIX_MATCH ; if ( camelCaseMatch ) matchRule |= SearchPattern . R_CAMELCASE_MATCH ; <START_BUG> new BasicSearchEngine ( this . workingCopies ) . searchAllTypeNames ( qualification , SearchPattern . R_EXACT_MATCH , ( ( simpleName . length ) == 0 ? null : simpleName ) , matchRule , searchFor , this . searchScope , typeRequestor , IJavaSearchConstants . CANCEL_IF_NOT_READY_TO_SEARCH , progressMonitor ) ; <END_BUG> } catch ( OperationCanceledException e ) { findTypes ( new String ( prefix ) , storage , SearchableEnvironment . convertSearchFilterToModelFilter ( searchFor ) ) ; } } catch ( JavaModelException e ) { findTypes ( new String ( prefix ) , storage , SearchableEnvironment . convertSearchFilterToModelFilter ( searchFor ) ) ; } } private void findTypes ( String prefix , ISearchRequestor storage , int type ) { } public boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] subPackageName ) { } protected String toStringChar ( char [ ] name ) { } protected String toStringCharChar ( char [ ] [ ] names ) { } public void cleanup ( ) { } }

Fix:
new BasicSearchEngine ( this . workingCopies ) . searchAllTypeNames ( qualification , SearchPattern . R_EXACT_MATCH , simpleName , matchRule , searchFor , this . searchScope , typeRequestor , IJavaSearchConstants . CANCEL_IF_NOT_READY_TO_SEARCH , progressMonitor ) ;