Buggy code:
public class NameEnvironment implements INameEnvironment , SuffixConstants { boolean isIncrementalBuild ; ClasspathMultiDirectory [ ] sourceLocations ; ClasspathLocation [ ] binaryLocations ; SimpleSet initialTypeNames ; SimpleLookupTable additionalUnits ; NameEnvironment ( IWorkspaceRoot root , JavaProject javaProject , SimpleLookupTable binaryLocationsPerProject ) throws CoreException { } public NameEnvironment ( IJavaProject javaProject ) { } private void computeClasspathLocations ( IWorkspaceRoot root , JavaProject javaProject , SimpleLookupTable binaryLocationsPerProject ) throws CoreException { IMarker cycleMarker = javaProject . getCycleMarker ( ) ; if ( cycleMarker != null ) { int severity = ( JavaCore . ERROR . equals ( javaProject . getOption ( JavaCore . CORE_CIRCULAR_CLASSPATH , true ) ) ) ? IMarker . SEVERITY_ERROR : IMarker . SEVERITY_WARNING ; if ( severity != ( ( ( Integer ) ( cycleMarker . getAttribute ( IMarker . SEVERITY ) ) ) . intValue ( ) ) ) cycleMarker . setAttribute ( IMarker . SEVERITY , severity ) ; } <START_BUG> IClasspathEntry [ ] classpathEntries = javaProject . getExpandedClasspath ( true , false , null , null ) ; <END_BUG> ArrayList sLocations = new ArrayList ( classpathEntries . length ) ; ArrayList bLocations = new ArrayList ( classpathEntries . length ) ; nextEntry : for ( int i = 0 , l = classpathEntries . length ; i < l ; i ++ ) { ClasspathEntry entry = ( ( ClasspathEntry ) ( classpathEntries [ i ] ) ) ; IPath path = entry . getPath ( ) ; Object target = JavaModel . getTarget ( root , path , true ) ; if ( target == null ) continue nextEntry ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : if ( ! ( target instanceof IContainer ) ) continue nextEntry ; IPath outputPath = ( ( entry . getOutputLocation ( ) ) != null ) ? entry . getOutputLocation ( ) : javaProject . getOutputLocation ( ) ; IContainer outputFolder ; if ( ( outputPath . segmentCount ( ) ) == 1 ) { outputFolder = javaProject . getProject ( ) ; } else { outputFolder = root . getFolder ( outputPath ) ; if ( ! ( outputFolder . exists ( ) ) ) createFolder ( outputFolder ) ; } sLocations . add ( ClasspathLocation . forSourceFolder ( ( ( IContainer ) ( target ) ) , outputFolder , entry . fullInclusionPatternChars ( ) , entry . fullExclusionPatternChars ( ) ) ) ; continue nextEntry ; case IClasspathEntry . CPE_PROJECT : if ( ! ( target instanceof IProject ) ) continue nextEntry ; IProject prereqProject = ( ( IProject ) ( target ) ) ; if ( ! ( JavaProject . hasJavaNature ( prereqProject ) ) ) continue nextEntry ; JavaProject prereqJavaProject = ( ( JavaProject ) ( JavaCore . create ( prereqProject ) ) ) ; IClasspathEntry [ ] prereqClasspathEntries = prereqJavaProject . getRawClasspath ( ) ; ArrayList seen = new ArrayList ( ) ; nextPrereqEntry : for ( int j = 0 , m = prereqClasspathEntries . length ; j < m ; j ++ ) { IClasspathEntry prereqEntry = prereqClasspathEntries [ j ] ; if ( ( prereqEntry . getEntryKind ( ) ) == ( IClasspathEntry . CPE_SOURCE ) ) { Object prereqTarget = JavaModel . getTarget ( root , prereqEntry . getPath ( ) , true ) ; if ( ! ( prereqTarget instanceof IContainer ) ) continue nextPrereqEntry ; IPath prereqOutputPath = ( ( prereqEntry . getOutputLocation ( ) ) != null ) ? prereqEntry . getOutputLocation ( ) : prereqJavaProject . getOutputLocation ( ) ; IContainer binaryFolder = ( ( prereqOutputPath . segmentCount ( ) ) == 1 ) ? ( ( IContainer ) ( prereqProject ) ) : ( ( IContainer ) ( root . getFolder ( prereqOutputPath ) ) ) ; if ( ( binaryFolder . exists ( ) ) && ( ! ( seen . contains ( binaryFolder ) ) ) ) { seen . add ( binaryFolder ) ; ClasspathLocation bLocation = ClasspathLocation . forBinaryFolder ( binaryFolder , true , entry . getAccessRuleSet ( ) ) ; bLocations . add ( bLocation ) ; if ( binaryLocationsPerProject != null ) { ClasspathLocation [ ] existingLocations = ( ( ClasspathLocation [ ] ) ( binaryLocationsPerProject . get ( prereqProject ) ) ) ; if ( existingLocations == null ) { existingLocations = new ClasspathLocation [ ] { bLocation } ; } else { int size = existingLocations . length ; System . arraycopy ( existingLocations , 0 , ( existingLocations = new ClasspathLocation [ size + 1 ] ) , 0 , size ) ; existingLocations [ size ] = bLocation ; } binaryLocationsPerProject . put ( prereqProject , existingLocations ) ; } } } } continue nextEntry ; case IClasspathEntry . CPE_LIBRARY : if ( target instanceof IResource ) { IResource resource = ( ( IResource ) ( target ) ) ; ClasspathLocation bLocation = null ; if ( resource instanceof IFile ) { if ( ! ( org . eclipse . jdt . internal . compiler . util . Util . isArchiveFileName ( path . lastSegment ( ) ) ) ) continue nextEntry ; AccessRuleSet accessRuleSet = ( ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) ) && ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ) ) ? null : entry . getAccessRuleSet ( ) ; bLocation = ClasspathLocation . forLibrary ( ( ( IFile ) ( resource ) ) , accessRuleSet ) ; } else if ( resource instanceof IContainer ) { AccessRuleSet accessRuleSet = ( ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_FORBIDDEN_REFERENCE , true ) ) ) && ( JavaCore . IGNORE . equals ( javaProject . getOption ( JavaCore . COMPILER_PB_DISCOURAGED_REFERENCE , true ) ) ) ) ? null : entry . getAccessRuleSet ( ) ;

Fix:
IClasspathEntry [ ] classpathEntries = javaProject . getExpandedClasspath ( ) ;