Buggy code:
class JavaProjectElementInfo extends OpenableElementInfo { static final IPackageFragmentRoot [ ] NO_ROOTS = new IPackageFragmentRoot [ 0 ] ; static class ProjectCache { ProjectCache ( IPackageFragmentRoot [ ] allPkgFragmentRootsCache , Map rootToResolvedEntries , Map pkgFragmentsCaches ) { } public IPackageFragmentRoot [ ] allPkgFragmentRootsCache ; public HashtableOfArrayToObject allPkgFragmentsCache ; public Map pkgFragmentsCaches ; public Map rootToResolvedEntries ; } private Object [ ] nonJavaResources ; JavaProjectElementInfo . ProjectCache projectCache ; static void addSuperPackageNames ( String [ ] pkgName , HashtableOfArrayToObject packageFragments ) { } public JavaProjectElementInfo ( ) { } private Object [ ] computeNonJavaResources ( JavaProject project ) { IPath projectPath = project . getProject ( ) . getFullPath ( ) ; boolean srcIsProject = false ; boolean binIsProject = false ; char [ ] [ ] inclusionPatterns = null ; char [ ] [ ] exclusionPatterns = null ; IPath projectOutput = null ; boolean isClasspathResolved = true ; try { IClasspathEntry entry = project . getClasspathEntryFor ( projectPath ) ; if ( entry != null ) { srcIsProject = true ; inclusionPatterns = ( ( ClasspathEntry ) ( entry ) ) . fullInclusionPatternChars ( ) ; exclusionPatterns = ( ( ClasspathEntry ) ( entry ) ) . fullExclusionPatternChars ( ) ; } projectOutput = project . getOutputLocation ( ) ; binIsProject = projectPath . equals ( projectOutput ) ; } catch ( JavaModelException e ) { isClasspathResolved = false ; } Object [ ] resources = new IResource [ 5 ] ; int resourcesCounter = 0 ; try { IResource [ ] members = ( ( IContainer ) ( project . getResource ( ) ) ) . members ( ) ; int length = members . length ; if ( length > 0 ) { String sourceLevel = project . getOption ( JavaCore . COMPILER_SOURCE , true ) ; String complianceLevel = project . getOption ( JavaCore . COMPILER_COMPLIANCE , true ) ; IClasspathEntry [ ] classpath = project . getResolvedClasspath ( ) ; for ( int i = 0 ; i < length ; i ++ ) { IResource res = members [ i ] ; switch ( res . getType ( ) ) { case IResource . FILE : IPath resFullPath = res . getFullPath ( ) ; String resName = res . getName ( ) ; if ( isClasspathResolved && ( isClasspathEntryOrOutputLocation ( resFullPath , classpath , projectOutput ) ) ) { break ; } if ( ( srcIsProject && ( Util . isValidCompilationUnitName ( resName , sourceLevel , complianceLevel ) ) ) && ( ! ( Util . isExcluded ( res , inclusionPatterns , exclusionPatterns ) ) ) ) { break ; } if ( binIsProject && ( Util . isValidClassFileName ( resName , sourceLevel , complianceLevel ) ) ) { break ; } if ( ( resources . length ) == resourcesCounter ) { System . arraycopy ( resources , 0 , ( resources = new IResource [ resourcesCounter * 2 ] ) , 0 , resourcesCounter ) ; } resources [ ( resourcesCounter ++ ) ] = res ; break ; case IResource . FOLDER : resFullPath = res . getFullPath ( ) ; <START_BUG> if ( ( ( srcIsProject && ( ! ( Util . isExcluded ( res , inclusionPatterns , exclusionPatterns ) ) ) ) && ( Util . isValidFolderNameForPackage ( res . getName ( ) , sourceLevel , complianceLevel ) ) ) || ( isClasspathResolved && ( this . isClasspathEntryOrOutputLocation ( resFullPath , classpath , projectOutput ) ) ) ) { <END_BUG> break ; } if ( ( resources . length ) == resourcesCounter ) { System . arraycopy ( resources , 0 , ( resources = new IResource [ resourcesCounter * 2 ] ) , 0 , resourcesCounter ) ; } resources [ ( resourcesCounter ++ ) ] = res ; } } } if ( ( resources . length ) != resourcesCounter ) { System . arraycopy ( resources , 0 , ( resources = new IResource [ resourcesCounter ] ) , 0 , resourcesCounter ) ; } } catch ( CoreException e ) { resources = JavaElementInfo . NO_NON_JAVA_RESOURCES ; resourcesCounter = 0 ; } return resources ; } JavaProjectElementInfo . ProjectCache getProjectCache ( JavaProject project ) { } Object [ ] getNonJavaResources ( JavaProject project ) { } private void initializePackageNames ( IPackageFragmentRoot root , HashSetOfArray fragmentsCache ) { } private boolean isClasspathEntryOrOutputLocation ( IPath path , IClasspathEntry [ ] resolvedClasspath , IPath projectOutput ) { } NameLookup newNameLookup ( JavaProject project , ICompilationUnit [ ] workingCopies ) { } void resetCaches ( ) { } void setNonJavaResources ( Object [ ] resources ) { } }

Fix:
if ( ( ( srcIsProject && ( ! ( Util . isExcluded ( res , inclusionPatterns , exclusionPatterns ) ) ) ) && ( Util . isValidFolderNameForPackage ( res . getName ( ) , sourceLevel , complianceLevel ) ) ) || ( isClasspathResolved && ( isClasspathEntryOrOutputLocation ( resFullPath , classpath , projectOutput ) ) ) ) {