Buggy code:
CompilationUnitDeclaration [ ] parsedUnits = new CompilationUnitDeclaration [ openablesLength ] ; boolean [ ] hasLocalType = new boolean [ openablesLength ] ; org . eclipse . jdt . core . ICompilationUnit [ ] cus = new org . eclipse . jdt . core . ICompilationUnit [ openablesLength ] ; int unitsIndex = 0 ; CompilationUnitDeclaration focusUnit = null ; BinaryTypeBinding focusBinaryBinding = null ; IType focus = this . requestor . getType ( ) ; Openable focusOpenable = null ; if ( focus != null ) { if ( focus . isBinary ( ) ) { focusOpenable = ( ( Openable ) ( focus . getClassFile ( ) ) ) ; } else { focusOpenable = ( ( Openable ) ( focus . getCompilationUnit ( ) ) ) ; } } Parser parser = new Parser ( this . lookupEnvironment . problemReporter , true ) ; for ( int i = 0 ; i < openablesLength ; i ++ ) { Openable openable = openables [ i ] ; if ( openable instanceof org . eclipse . jdt . core . ICompilationUnit ) { org . eclipse . jdt . core . ICompilationUnit cu = ( ( org . eclipse . jdt . core . ICompilationUnit ) ( openable ) ) ; boolean containsLocalType = false ; if ( localTypes == null ) { containsLocalType = true ; } else { IPath path = cu . getPath ( ) ; containsLocalType = localTypes . contains ( path . toString ( ) ) ; } CompilationUnitDeclaration parsedUnit = null ; if ( cu . isOpen ( ) ) { CompilationResult result = new CompilationResult ( ( ( ICompilationUnit ) ( cu ) ) . getFileName ( ) , i , openablesLength , this . options . maxProblemsPerUnit ) ; SourceTypeElementInfo [ ] typeInfos = null ; try { IType [ ] topLevelTypes = cu . getTypes ( ) ; int topLevelLength = topLevelTypes . length ; typeInfos = new SourceTypeElementInfo [ topLevelLength ] ; for ( int j = 0 ; j < topLevelLength ; j ++ ) { IType topLevelType = topLevelTypes [ j ] ; typeInfos [ j ] = ( ( SourceTypeElementInfo ) ( ( ( JavaElement ) ( topLevelType ) ) . getElementInfo ( ) ) ) ; } } catch ( JavaModelException e ) { } if ( ! containsLocalType ) { parsedUnit = SourceTypeConverter . buildCompilationUnit ( typeInfos , SourceTypeConverter . MEMBER_TYPE , this . lookupEnvironment . problemReporter , result ) ; } else { parsedUnit = ElementInfoConverter . buildCompilationUnit ( typeInfos , true , this . lookupEnvironment . problemReporter , result ) ; parsedUnit . bits |= ASTNode . HasAllMethodBodies ; } } else { IResource file = cu . getResource ( ) ; String osPath = file . getLocation ( ) . toOSString ( ) ; ICompilationUnit sourceUnit = this . requestor . createCompilationUnitFromPath ( openable , osPath ) ; CompilationResult unitResult = new CompilationResult ( sourceUnit , i , openablesLength , this . options . maxProblemsPerUnit ) ; parsedUnit = parser . dietParse ( sourceUnit , unitResult ) ; } if ( parsedUnit != null ) { hasLocalType [ unitsIndex ] = containsLocalType ; cus [ unitsIndex ] = cu ; parsedUnits [ ( unitsIndex ++ ) ] = parsedUnit ; try { this . lookupEnvironment . buildTypeBindings ( parsedUnit ) ; if ( openable . equals ( focusOpenable ) ) { focusUnit = parsedUnit ; } } catch ( AbortCompilation e ) { } } } else { ClassFile classFile = ( ( ClassFile ) ( openable ) ) ; IBinaryType binaryType = null ; if ( classFile . isOpen ( ) ) { IType type = classFile . getType ( ) ; try { binaryType = ( ( IBinaryType ) ( ( ( JavaElement ) ( type ) ) . getElementInfo ( ) ) ) ; } catch ( JavaModelException e ) { } } else { if ( classFile . getPackageFragmentRoot ( ) . isArchive ( ) ) { binaryType = this . requestor . createInfoFromClassFileInJar ( classFile ) ; } else { IResource file = classFile . getResource ( ) ; String osPath = file . getLocation ( ) . toOSString ( ) ; binaryType = this . requestor . createInfoFromClassFile ( classFile , osPath ) ; } } if ( binaryType != null ) { try { <START_BUG> BinaryTypeBinding binaryTypeBinding = this . lookupEnvironment . cacheBinaryType ( binaryType , false ) ; <END_BUG> remember ( binaryType , binaryTypeBinding ) ; if ( openable . equals ( focusOpenable ) ) { focusBinaryBinding = binaryTypeBinding ; } } catch ( AbortCompilation e ) { } } } } for ( int i = 0 ; i < unitsIndex ; i ++ ) { CompilationUnitDeclaration parsedUnit = parsedUnits [ i ] ; if ( parsedUnit != null ) { try { boolean containsLocalType = hasLocalType [ i ] ; if ( containsLocalType ) { parser . getMethodBodies ( parsedUnit ) ; } this . lookupEnvironment . completeTypeBindings ( parsedUnit , true ) ; } catch ( AbortCompilation e ) { } } worked ( monitor , 1 ) ; } for ( int i = 0 ; i < unitsIndex ; i ++ ) { CompilationUnitDeclaration parsedUnit = parsedUnits [ i ] ; if ( parsedUnit != null ) { boolean containsLocalType = hasLocalType [ i ] ; if ( containsLocalType ) { parsedUnit . scope . faultInTypes ( ) ; parsedUnit . scope . verifyMethods ( this . lookupEnvironment . methodVerifier ( ) ) ; parsedUnit . resolve ( ) ; } rememberAllTypes ( parsedUnit , cus [ i ] , containsLocalType ) ; } } reportHierarchy ( focus , focusUnit , focusBinaryBinding ) ; } catch ( ClassCastException e ) { } catch ( AbortCompilation e ) { } finally { reset ( ) ; }

Fix:
BinaryTypeBinding binaryTypeBinding = this . lookupEnvironment . cacheBinaryType ( binaryType ) ;