Buggy code:
public class IndexBasedHierarchyBuilder extends HierarchyBuilder implements SuffixConstants { public static final int MAXTICKS = 800 ; protected Map cuToHandle ; protected Map handleToWorkingCopy ; protected IJavaSearchScope scope ; protected Map binariesFromIndexMatches ; private static class Queue { public char [ ] [ ] names = new char [ 10 ] [ ] ; public int start = 0 ; public int end = - 1 ; public void add ( char [ ] name ) { } public char [ ] retrieve ( ) { } public String toString ( ) { } } public IndexBasedHierarchyBuilder ( TypeHierarchy hierarchy , IJavaSearchScope scope ) throws JavaModelException { } private void addInfoFromBinaryIndexMatch ( Openable handle , HierarchyBinaryType binaryType , ArrayList infos ) throws JavaModelException { } protected void addInfoFromClosedElement ( Openable handle , ArrayList infos , ArrayList units , String resourcePath ) throws JavaModelException { } private void addInfosFromType ( IType type , ArrayList infos ) throws JavaModelException { } public void build ( boolean computeSubtypes ) throws CoreException , JavaModelException { } private void buildForProject ( JavaProject project , ArrayList infos , ArrayList units , IWorkingCopy [ ] workingCopies , IProgressMonitor monitor ) throws JavaModelException { } private void buildFromPotentialSubtypes ( String [ ] allPotentialSubTypes , IProgressMonitor monitor ) { IType focusType = this . getType ( ) ; HashMap wcPaths = new HashMap ( ) ; int wcLength ; <START_BUG> IWorkingCopy [ ] workingCopies = this . getWokingCopies ( ) ; <END_BUG> if ( ( workingCopies != null ) && ( ( wcLength = workingCopies . length ) > 0 ) ) { String [ ] newPaths = new String [ wcLength ] ; for ( int i = 0 ; i < wcLength ; i ++ ) { IWorkingCopy workingCopy = workingCopies [ i ] ; String path = workingCopy . getOriginalElement ( ) . getPath ( ) . toString ( ) ; wcPaths . put ( path , workingCopy ) ; newPaths [ i ] = path ; } int potentialSubtypesLength = allPotentialSubTypes . length ; System . arraycopy ( allPotentialSubTypes , 0 , ( allPotentialSubTypes = new String [ potentialSubtypesLength + wcLength ] ) , 0 , potentialSubtypesLength ) ; System . arraycopy ( newPaths , 0 , allPotentialSubTypes , potentialSubtypesLength , wcLength ) ; } int length = allPotentialSubTypes . length ; Openable focusCU = ( ( Openable ) ( focusType . getCompilationUnit ( ) ) ) ; String focusPath = null ; if ( focusCU != null ) { focusPath = focusCU . getPath ( ) . toString ( ) ; if ( length > 0 ) { System . arraycopy ( allPotentialSubTypes , 0 , ( allPotentialSubTypes = new String [ length + 1 ] ) , 0 , length ) ; allPotentialSubTypes [ length ] = focusPath ; } else { allPotentialSubTypes = new String [ ] { focusPath } ; } length ++ ; } Util . sortReverseOrder ( allPotentialSubTypes ) ; ArrayList infos = new ArrayList ( ) ; ArrayList units = new ArrayList ( ) ; try { HandleFactory factory = new HandleFactory ( ResourcesPlugin . getWorkspace ( ) ) ; IJavaProject currentProject = null ; if ( monitor != null ) monitor . beginTask ( "" , ( length * 2 ) ) ; for ( int i = 0 ; i < length ; i ++ ) { try { String resourcePath = allPotentialSubTypes [ i ] ; if ( ( i > 0 ) && ( resourcePath . equals ( allPotentialSubTypes [ ( i - 1 ) ] ) ) ) continue ; Openable handle ; IWorkingCopy workingCopy = ( ( IWorkingCopy ) ( wcPaths . get ( resourcePath ) ) ) ; if ( workingCopy != null ) { handle = ( ( Openable ) ( workingCopy ) ) ; } else { handle = ( resourcePath . equals ( focusPath ) ) ? focusCU : factory . createOpenable ( resourcePath , this . scope ) ; if ( handle == null ) continue ; } IJavaProject project = handle . getJavaProject ( ) ; if ( currentProject == null ) { currentProject = project ; infos = new ArrayList ( 5 ) ; units = new ArrayList ( 5 ) ; } else if ( ! ( currentProject . equals ( project ) ) ) { this . buildForProject ( ( ( JavaProject ) ( currentProject ) ) , infos , units , workingCopies , monitor ) ; currentProject = project ; infos = new ArrayList ( 5 ) ; units = new ArrayList ( 5 ) ; } this . addInfoFromElement ( handle , infos , units , resourcePath ) ; } catch ( JavaModelException e ) { continue ; } } try { if ( currentProject == null ) { currentProject = focusType . getJavaProject ( ) ; this . addInfosFromType ( focusType , infos ) ; } this . buildForProject ( ( ( JavaProject ) ( currentProject ) ) , infos , units , workingCopies , monitor ) ; } catch ( JavaModelException e ) { } if ( ! ( this . hierarchy . contains ( focusType ) ) ) { try { currentProject = focusType . getJavaProject ( ) ; infos = new ArrayList ( ) ; units = new ArrayList ( ) ; this . addInfosFromType ( focusType , infos ) ; this . buildForProject ( ( ( JavaProject ) ( currentProject ) ) , infos , units , workingCopies , monitor ) ; } catch ( JavaModelException e ) { } } if ( ! ( this . hierarchy . contains ( focusType ) ) ) { this . hierarchy . addRootClass ( focusType ) ; } } finally { if ( monitor != null ) monitor . done ( ) ; } } protected ICompilationUnit createCompilationUnitFromPath ( Openable handle , String osPath ) throws JavaModelException { } private String [ ] determinePossibleSubTypes ( IProgressMonitor monitor ) throws CoreException , JavaModelException { }

Fix:
IWorkingCopy [ ] workingCopies = this . hierarchy . workingCopies ;