Buggy code:
public class NameEnvironment implements INameEnvironment { boolean isIncrementalBuild ; ClasspathMultiDirectory [ ] sourceLocations ; ClasspathLocation [ ] binaryLocations ; String [ ] initialTypeNames ; SourceFile [ ] 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 { IClasspathEntry [ ] classpathEntries = javaProject . getExpandedClasspath ( true , true ) ; 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 ) ; } 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 . fullExclusionPatternChars ( ) ) ) ; continue nextEntry ; case IClasspathEntry . CPE_PROJECT : if ( ! ( target instanceof IProject ) ) continue nextEntry ; IProject prereqProject = ( ( IProject ) ( target ) ) ; <START_BUG> if ( ! ( prereqProject . isAccessible ( ) ) ) <END_BUG> continue nextEntry ; JavaProject prereqJavaProject = ( ( JavaProject ) ( JavaCore . create ( prereqProject ) ) ) ; IClasspathEntry [ ] prereqClasspathEntries = prereqJavaProject . getExpandedClasspath ( true , true ) ; ArrayList seen = new ArrayList ( ) ; for ( int j = 0 , m = prereqClasspathEntries . length ; j < m ; j ++ ) { ClasspathEntry e = ( ( ClasspathEntry ) ( prereqClasspathEntries [ j ] ) ) ; Object t = JavaModel . getTarget ( root , e . getPath ( ) , true ) ; if ( ( t instanceof IContainer ) && ( ( e . getEntryKind ( ) ) == ( IClasspathEntry . CPE_SOURCE ) ) ) { IPath prereqOutputPath = ( ( e . getOutputLocation ( ) ) != null ) ? e . 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 ) ; 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 ) { String extension = path . getFileExtension ( ) ; if ( ! ( ( JAR_EXTENSION . equalsIgnoreCase ( extension ) ) || ( ZIP_EXTENSION . equalsIgnoreCase ( extension ) ) ) ) continue nextEntry ; bLocation = ClasspathLocation . forLibrary ( ( ( IFile ) ( resource ) ) ) ; } else if ( resource instanceof IContainer ) { bLocation = ClasspathLocation . forBinaryFolder ( ( ( IContainer ) ( target ) ) , false ) ; } bLocations . add ( bLocation ) ; if ( binaryLocationsPerProject != null ) { IProject p = resource . getProject ( ) ; ClasspathLocation [ ] existingLocations = ( ( ClasspathLocation [ ] ) ( binaryLocationsPerProject . get ( p ) ) ) ; 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 ; }

Fix:
if ( ! ( JavaProject . hasJavaNature ( prereqProject ) ) )