Buggy code:
public class IndexSelector { IJavaSearchScope searchScope ; SearchPattern pattern ; IPath [ ] indexLocations ; public IndexSelector ( IJavaSearchScope searchScope , SearchPattern pattern ) { } public static boolean canSeeFocus ( SearchPattern pattern , IPath projectOrJarPath ) { } private static boolean canSeeFocus ( IJavaElement [ ] focuses , JavaProject javaProject , char [ ] [ ] focusQualifiedName ) { } private static boolean canSeeFocus ( IJavaElement focus , JavaProject javaProject , char [ ] [ ] focusQualifiedName ) { } private static IJavaElement [ ] getFocusedElements ( SearchPattern pattern , IJavaElement focusElement ) throws JavaModelException { } private void initializeIndexLocations ( ) { IPath [ ] projectsAndJars = this . searchScope . enclosingProjectsAndJars ( ) ; IndexManager manager = JavaModelManager . getIndexManager ( ) ; SimpleSet locations = new SimpleSet ( ) ; IJavaElement focus = MatchLocator . projectOrJarFocus ( this . pattern ) ; if ( focus == null ) { for ( int i = 0 ; i < ( projectsAndJars . length ) ; i ++ ) { IPath path = projectsAndJars [ i ] ; Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) ( target ) ) . getFullPath ( ) ; locations . add ( manager . computeIndexLocation ( path ) ) ; } } else { try { boolean isAutoBuilding = ResourcesPlugin . getWorkspace ( ) . getDescription ( ) . isAutoBuilding ( ) ; char [ ] [ ] focusQualifiedName = null ; if ( isAutoBuilding && ( focus instanceof IJavaProject ) ) { IJavaElement javaElement = this . pattern . focus ; while ( ( javaElement != null ) && ( ! ( javaElement instanceof ITypeRoot ) ) ) { javaElement = javaElement . getParent ( ) ; } if ( javaElement != null ) { IType primaryType = ( ( ITypeRoot ) ( javaElement ) ) . findPrimaryType ( ) ; if ( primaryType != null ) { char [ ] [ ] qualifiedName = CharOperation . splitOn ( '.' , primaryType . getFullyQualifiedName ( ) . toCharArray ( ) ) ; char [ ] [ ] [ ] qualifiedNames = ReferenceCollection . internQualifiedNames ( new char [ ] [ ] [ ] { qualifiedName } ) ; <START_BUG> focusQualifiedName = qualifiedNames [ 0 ] ; <END_BUG> } } } int length = projectsAndJars . length ; JavaProject [ ] projectsCanSeeFocus = new JavaProject [ length ] ; SimpleSet visitedProjects = new SimpleSet ( length ) ; int projectIndex = 0 ; SimpleSet externalLibsToCheck = new SimpleSet ( length ) ; IJavaElement [ ] focuses = IndexSelector . getFocusedElements ( this . pattern , focus ) ; 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 ( focuses , project , focusQualifiedName ) ) { locations . add ( manager . computeIndexLocation ( path ) ) ; projectsCanSeeFocus [ ( projectIndex ++ ) ] = project ; } } else { externalLibsToCheck . add ( path ) ; } } for ( int i = 0 ; ( i < projectIndex ) && ( ( externalLibsToCheck . 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 ( ( externalLibsToCheck . remove ( path ) ) != null ) { Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) ( target ) ) . getFullPath ( ) ; locations . add ( manager . computeIndexLocation ( path ) ) ; } } } } if ( ( externalLibsToCheck . elementSize ) > 0 ) { IJavaProject [ ] allProjects = model . getJavaProjects ( ) ; for ( int i = 0 , l = allProjects . length ; ( i < l ) && ( ( externalLibsToCheck . 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 ( ( externalLibsToCheck . remove ( path ) ) != null ) { Object target = JavaModel . getTarget ( path , false ) ; if ( target instanceof IFolder ) path = ( ( IFolder ) ( target ) ) . getFullPath ( ) ; locations . add ( manager . computeIndexLocation ( path ) ) ; } } } } } } } catch ( JavaModelException e ) { } } this . indexLocations = new IPath [ locations . elementSize ] ; Object [ ] values = locations . values ; int count = 0 ; for ( int i = values . length ; ( -- i ) >= 0 ;

Fix:
focusQualifiedName = ( ( qualifiedNames . length ) == 0 ) ? qualifiedName : qualifiedNames [ 0 ] ;