Buggy code:
public class IndexSelector { IJavaSearchScope searchScope ; SearchPattern pattern ; IPath [ ] indexLocations ; public IndexSelector ( IJavaSearchScope searchScope , SearchPattern pattern ) { } public static boolean canSeeFocus ( IJavaElement focus , boolean isPolymorphicSearch , IPath projectOrJarPath ) { } public static boolean canSeeFocus ( IJavaElement focus , JavaProject javaProject , IClasspathEntry [ ] focusEntriesForPolymorphicSearch ) { } private void initializeIndexLocations ( ) { IPath [ ] projectsAndJars = this . searchScope . enclosingProjectsAndJars ( ) ; <START_BUG> IndexManager manager = JavaModelManager . getJavaModelManager ( ) . getIndexManager ( ) ; <END_BUG> SimpleSet locations = new SimpleSet ( ) ; IJavaElement focus = MatchLocator . projectOrJarFocus ( this . pattern ) ; if ( focus == null ) { for ( int i = 0 ; i < ( projectsAndJars . length ) ; i ++ ) locations . add ( manager . computeIndexLocation ( projectsAndJars [ i ] ) ) ; } else { try { int length = projectsAndJars . length ; JavaProject [ ] projectsCanSeeFocus = new JavaProject [ length ] ; SimpleSet visitedProjects = new SimpleSet ( length ) ; int projectIndex = 0 ; SimpleSet jarsToCheck = new SimpleSet ( length ) ; IClasspathEntry [ ] focusEntries = null ; if ( ( this . pattern ) instanceof MethodPattern ) { JavaProject focusProject = ( focus instanceof JarPackageFragmentRoot ) ? ( ( JavaProject ) ( focus . getParent ( ) ) ) : ( ( JavaProject ) ( focus ) ) ; focusEntries = focusProject . getExpandedClasspath ( ) ; } IJavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; for ( int i = 0 ; i < length ; i ++ ) { IPath path = projectsAndJars [ i ] ; JavaProject project = ( ( JavaProject ) ( IndexSelector . getJavaProject ( path , model ) ) ) ; if ( project != null ) { visitedProjects . add ( project ) ; if ( IndexSelector . canSeeFocus ( focus , project , focusEntries ) ) { locations . add ( manager . computeIndexLocation ( path ) ) ; projectsCanSeeFocus [ ( projectIndex ++ ) ] = project ; } } else { jarsToCheck . add ( path ) ; } } for ( int i = 0 ; ( i < projectIndex ) && ( ( jarsToCheck . elementSize ) > 0 ) ; i ++ ) { IClasspathEntry [ ] entries = projectsCanSeeFocus [ i ] . getResolvedClasspath ( ) ; for ( int j = entries . length ; ( -- j ) >= 0 ; ) { IClasspathEntry entry = entries [ j ] ; if ( ( entry . getEntryKind ( ) ) == ( IClasspathEntry . CPE_LIBRARY ) ) { IPath path = entry . getPath ( ) ; if ( jarsToCheck . includes ( path ) ) { locations . add ( manager . computeIndexLocation ( entry . getPath ( ) ) ) ; jarsToCheck . remove ( path ) ; } } } } if ( ( jarsToCheck . elementSize ) > 0 ) { IJavaProject [ ] allProjects = model . getJavaProjects ( ) ; for ( int i = 0 , l = allProjects . length ; ( i < l ) && ( ( jarsToCheck . elementSize ) > 0 ) ; i ++ ) { JavaProject project = ( ( JavaProject ) ( allProjects [ i ] ) ) ; if ( ! ( visitedProjects . includes ( project ) ) ) { IClasspathEntry [ ] entries = project . getResolvedClasspath ( ) ; for ( int j = entries . length ; ( -- j ) >= 0 ; ) { IClasspathEntry entry = entries [ j ] ; if ( ( entry . getEntryKind ( ) ) == ( IClasspathEntry . CPE_LIBRARY ) ) { IPath path = entry . getPath ( ) ; if ( jarsToCheck . includes ( path ) ) { locations . add ( manager . computeIndexLocation ( entry . getPath ( ) ) ) ; jarsToCheck . remove ( path ) ; } } } } } } } catch ( JavaModelException e ) { } } this . indexLocations = new IPath [ locations . elementSize ] ; Object [ ] values = locations . values ; int count = 0 ; for ( int i = values . length ; ( -- i ) >= 0 ; ) if ( ( values [ i ] ) != null ) this . indexLocations [ ( count ++ ) ] = ( ( IPath ) ( values [ i ] ) ) ; } public IPath [ ] getIndexLocations ( ) { } private static IJavaProject getJavaProject ( IPath path , IJavaModel model ) { } }

Fix:
IndexManager manager = JavaModelManager . getIndexManager ( ) ;