Buggy code:
public class JavaSearchScope extends AbstractSearchScope { private ArrayList elements ; private String [ ] paths ; private boolean [ ] pathWithSubFolders ; protected AccessRuleSet [ ] pathRestrictions ; private String [ ] containerPaths ; private int pathsCount ; private int threshold ; private IPath [ ] enclosingProjectsAndJars ; public static final AccessRuleSet NOT_ENCLOSED = new AccessRuleSet ( null ) ; public JavaSearchScope ( ) { } private JavaSearchScope ( int size ) { } private void addEnclosingProjectOrJar ( IPath path ) { } public void add ( JavaProject project , int includeMask , HashSet visitedProject ) throws JavaModelException { } void add ( JavaProject javaProject , IPath pathToAdd , int includeMask , HashSet visitedProjects , IClasspathEntry referringEntry ) throws JavaModelException { IProject project = javaProject . getProject ( ) ; if ( ( ! ( project . isAccessible ( ) ) ) || ( ! ( visitedProjects . add ( project ) ) ) ) return ; IPath projectPath = project . getFullPath ( ) ; String projectPathString = projectPath . toString ( ) ; this . addEnclosingProjectOrJar ( projectPath ) ; IClasspathEntry [ ] entries = javaProject . getResolvedClasspath ( true , false , false ) ; IJavaModel model = javaProject . getJavaModel ( ) ; JavaModelManager . PerProjectInfo perProjectInfo = javaProject . getPerProjectInfo ( ) ; for ( int i = 0 , length = entries . length ; i < length ; i ++ ) { IClasspathEntry entry = entries [ i ] ; IClasspathEntry rawEntry = null ; if ( ( perProjectInfo != null ) && ( ( perProjectInfo . resolvedPathToRawEntries ) != null ) ) { rawEntry = ( ( IClasspathEntry ) ( perProjectInfo . resolvedPathToRawEntries . get ( entry . getPath ( ) ) ) ) ; } if ( rawEntry == null ) continue ; AccessRuleSet access = null ; ClasspathEntry cpEntry = ( ( ClasspathEntry ) ( rawEntry ) ) ; if ( referringEntry != null ) { <START_BUG> if ( ( ! ( rawEntry . isExported ( ) ) ) && ( ( rawEntry . getEntryKind ( ) ) != ( IClasspathEntry . CPE_SOURCE ) ) ) <END_BUG> continue ; cpEntry = cpEntry . combineWith ( ( ( ClasspathEntry ) ( referringEntry ) ) ) ; } access = cpEntry . getAccessRuleSet ( ) ; switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_LIBRARY : switch ( rawEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_LIBRARY : case IClasspathEntry . CPE_VARIABLE : if ( ( includeMask & ( IJavaSearchScope . APPLICATION_LIBRARIES ) ) != 0 ) { IPath path = entry . getPath ( ) ; if ( ( pathToAdd == null ) || ( pathToAdd . equals ( path ) ) ) { add ( "" , path . toString ( ) , true , access ) ; addEnclosingProjectOrJar ( path ) ; } } break ; case IClasspathEntry . CPE_CONTAINER : IClasspathContainer container = JavaCore . getClasspathContainer ( rawEntry . getPath ( ) , javaProject ) ; if ( container == null ) break ; if ( ( ( ( container . getKind ( ) ) == ( IClasspathContainer . K_APPLICATION ) ) && ( ( includeMask & ( IJavaSearchScope . APPLICATION_LIBRARIES ) ) != 0 ) ) || ( ( includeMask & ( IJavaSearchScope . SYSTEM_LIBRARIES ) ) != 0 ) ) { IPath path = entry . getPath ( ) ; if ( ( pathToAdd == null ) || ( pathToAdd . equals ( path ) ) ) { add ( "" , path . toString ( ) , true , access ) ; addEnclosingProjectOrJar ( path ) ; } } break ; } break ; case IClasspathEntry . CPE_PROJECT : if ( ( includeMask & ( IJavaSearchScope . REFERENCED_PROJECTS ) ) != 0 ) { IPath path = entry . getPath ( ) ; if ( ( pathToAdd == null ) || ( pathToAdd . equals ( path ) ) ) { add ( ( ( JavaProject ) ( model . getJavaProject ( entry . getPath ( ) . lastSegment ( ) ) ) ) , null , includeMask , visitedProjects , cpEntry ) ; } } break ; case IClasspathEntry . CPE_SOURCE : if ( ( includeMask & ( IJavaSearchScope . SOURCES ) ) != 0 ) { IPath path = entry . getPath ( ) ; if ( ( pathToAdd == null ) || ( pathToAdd . equals ( path ) ) ) { add ( Util . relativePath ( path , 1 ) , projectPathString , true , access ) ; } } break ; } } } public void add ( IJavaElement element ) throws JavaModelException { } private void add ( String relativePath , String containerPath , boolean withSubFolders , AccessRuleSet access ) { } public boolean encloses ( String resourcePathString ) { } private int indexOf ( String relativePath , String containerPath ) { } private boolean encloses ( String scopePath , String path , int index ) { } public boolean encloses ( IJavaElement element ) { } public IPath [ ] enclosingProjectsAndJars ( ) { } private IPath getPath ( IJavaElement element , boolean relativeToRoot ) { } public AccessRuleSet getAccessRuleSet ( String relativePath , String containerPath ) { } protected void initialize ( int size ) { } public void processDelta ( IJavaElementDelta delta ) { } private void rehash ( ) { } public String toString ( ) { } }

Fix:
if ( ( ! ( entry . isExported ( ) ) ) && ( ( entry . getEntryKind ( ) ) != ( IClasspathEntry . CPE_SOURCE ) ) )