Buggy code:
public class SearchableEnvironment implements IJavaSearchConstants , ISearchableNameEnvironment { protected NameLookup nameLookup ; protected ICompilationUnit unitToSkip ; public CompilationUnit unitToLookInside ; protected IJavaProject project ; public SearchableEnvironment ( IJavaProject project ) throws JavaModelException { } 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 [ ] [ ] packages ) { } public void findTypes ( char [ ] prefix , final ISearchRequestor storage ) { try { final String excludePath ; if ( ( this . unitToSkip ) != null ) { if ( ! ( ( this . unitToSkip ) instanceof IJavaElement ) ) { findTypes ( new String ( prefix ) , storage , ( ( NameLookup . ACCEPT_CLASSES ) | ( NameLookup . ACCEPT_INTERFACES ) ) ) ; return ; } excludePath = ( ( IJavaElement ) ( this . unitToSkip ) ) . getUnderlyingResource ( ) . getFullPath ( ) . toString ( ) ; } else { excludePath = null ; } int lastDotIndex = CharOperation . lastIndexOf ( '.' , prefix ) ; char [ ] qualification ; char [ ] simpleName ; if ( lastDotIndex < 0 ) { qualification = null ; simpleName = CharOperation . toLowerCase ( prefix ) ; } else { qualification = CharOperation . subarray ( prefix , 0 , lastDotIndex ) ; simpleName = CharOperation . toLowerCase ( CharOperation . subarray ( prefix , ( lastDotIndex + 1 ) , prefix . length ) ) ; } SearchEngine searchEngine = new SearchEngine ( ) ; JavaSearchScope scope = new JavaSearchScope ( ) ; IWorkspaceRoot root = this . project . getUnderlyingResource ( ) . getWorkspace ( ) . getRoot ( ) ; <START_BUG> IClasspathEntry [ ] entries = this . project . getExpandedClasspath ( true ) ; <END_BUG> for ( int i = 0 , length = entries . length ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_LIBRARY : scope . add ( root . getFile ( entry . getPath ( ) ) , false ) ; break ; case IClasspathEntry . CPE_PROJECT : scope . add ( root . getProject ( entry . getPath ( ) . lastSegment ( ) ) , false ) ; break ; case IClasspathEntry . CPE_SOURCE : IPath path = entry . getPath ( ) ; if ( ( path . segmentCount ( ) ) == 1 ) { scope . add ( root . getProject ( path . lastSegment ( ) ) , false ) ; } else { scope . add ( root . getFolder ( path ) , false ) ; } break ; } } 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 ) { } } ; ITypeNameRequestor nameRequestor = new ITypeNameRequestor ( ) { public void acceptClass ( char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) { if ( ( excludePath != null ) && ( excludePath . equals ( path ) ) ) return ; if ( ( enclosingTypeNames != null ) && ( ( enclosingTypeNames . length ) > 0 ) ) return ; storage . acceptClass ( packageName , simpleTypeName , AccPublic ) ; } public void acceptInterface ( char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , String path ) { if ( ( excludePath != null ) && ( excludePath . equals ( path ) ) ) return ; if ( ( enclosingTypeNames != null ) && ( ( enclosingTypeNames . length ) > 0 ) ) return ; storage . acceptInterface ( packageName , simpleTypeName , AccPublic ) ; } } ; try { searchEngine . searchAllTypeNames ( this . project . getUnderlyingResource ( ) . getWorkspace ( ) , qualification , simpleName , IJavaSearchConstants . PREFIX_MATCH , IJavaSearchConstants . CASE_INSENSITIVE , IJavaSearchConstants . TYPE , scope , nameRequestor , IJavaSearchConstants . CANCEL_IF_NOT_READY_TO_SEARCH , progressMonitor ) ; } catch ( OperationCanceledException e ) { findTypes ( new String ( prefix ) , storage , ( ( NameLookup . ACCEPT_CLASSES ) | ( NameLookup . ACCEPT_INTERFACES ) ) ) ; } } catch ( JavaModelException e ) { findTypes ( new String ( prefix ) , storage , ( ( NameLookup . ACCEPT_CLASSES ) | ( NameLookup . ACCEPT_INTERFACES ) ) ) ; } } private void findTypes ( String prefix , ISearchRequestor storage , int type ) { } public boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] subPackageName ) { } protected boolean isQualified ( char [ ] name ) { } public boolean isTopLevelPackage ( char [ ] packageName ) { } protected String toStringChar ( char [ ] name ) { } protected String toStringCharChar ( char [ ] [ ] names ) { } public void reset ( ) { } }

Fix:
IClasspathEntry [ ] entries = ( ( JavaProject ) ( this . project ) ) . getExpandedClasspath ( true ) ;