Buggy code:
public IPackageFragmentRoot [ ] getAllPackageFragmentRoots ( ) throws JavaModelException { } public IPackageFragmentRoot [ ] getBuilderRoots ( IResourceDelta delta ) throws JavaModelException { } protected String getClasspathAsXMLString ( IClasspathEntry [ ] classpath , IPath outputLocation ) throws JavaModelException { } public IClasspathEntry getClasspathEntryFor ( IPath path ) throws JavaModelException { } public QualifiedName getClasspathPropertyName ( ) { } protected static Element getEntryAsXMLElement ( Document document , IClasspathEntry entry , IPath prefixPath ) throws JavaModelException { } protected char getHandleMementoDelimiter ( ) { } private ICommand getJavaCommand ( IProjectDescription description ) throws CoreException { } public IJavaProject getJavaProject ( ) { } protected JavaProjectElementInfo getJavaProjectElementInfo ( ) throws JavaModelException { } public NameLookup getNameLookup ( ) throws JavaModelException { } public Object [ ] getNonJavaResources ( ) throws JavaModelException { } public IPath getOutputLocation ( ) throws JavaModelException { } public IPackageFragmentRoot getPackageFragmentRoot ( String jarPath ) { } public IPackageFragmentRoot getPackageFragmentRoot ( IResource resource ) { } public IPackageFragmentRoot getPackageFragmentRoot ( IPath path ) { } public IPackageFragmentRoot [ ] getPackageFragmentRoots ( ) throws JavaModelException { } protected IPackageFragmentRoot [ ] getPackageFragmentRoots ( IPath path ) throws JavaModelException { } public IPackageFragmentRoot [ ] getPackageFragmentRoots ( IClasspathEntry entry ) { } public IPackageFragment [ ] getPackageFragments ( ) throws JavaModelException { } public IPackageFragment [ ] getPackageFragmentsInRoots ( IPackageFragmentRoot [ ] roots ) { } public IProject getProject ( ) { } public IClasspathEntry [ ] getRawClasspath ( ) throws JavaModelException { } public String [ ] getRequiredProjectNames ( ) throws JavaModelException { } public IClasspathEntry [ ] getResolvedClasspath ( boolean ignoreUnresolvedVariable ) throws JavaModelException { } public IClasspathEntry [ ] getResolvedClasspath ( boolean ignoreUnresolvedVariable , boolean generateMarkerOnError ) throws JavaModelException { } public IClasspathEntry [ ] getExpandedClasspath ( boolean ignoreUnresolvedVariable ) throws JavaModelException { } public IClasspathEntry [ ] getExpandedClasspath ( boolean ignoreUnresolvedVariable , boolean generateMarkerOnError ) throws JavaModelException { } private void computeExpandedClasspath ( JavaProject initialProject , boolean ignoreUnresolvedVariable , boolean generateMarkerOnError , HashSet visitedProjects , ObjectVector accumulatedEntries ) throws JavaModelException { } public ISearchableNameEnvironment getSearchableNameEnvironment ( ) throws JavaModelException { } public String getSharedProperty ( QualifiedName key ) throws CoreException { } public SourceMapper getSourceMapper ( ) { } public IResource getUnderlyingResource ( ) throws JavaModelException { } public boolean hasBuildState ( ) { } public boolean hasClasspathCycle ( IClasspathEntry [ ] entries ) { } public int hashCode ( ) { } public boolean hasSource ( ) { } public boolean isClasspathEqualsTo ( IClasspathEntry [ ] otherClasspathWithOutput ) throws JavaModelException { } static int kindFromString ( String kindStr ) { } static String kindToString ( int kind ) { } public String loadClasspath ( ) throws JavaModelException { } public IEvaluationContext newEvaluationContext ( ) { } public ITypeHierarchy newTypeHierarchy ( IRegion region , IProgressMonitor monitor ) throws JavaModelException { } public ITypeHierarchy newTypeHierarchy ( IType type , IRegion region , IProgressMonitor monitor ) throws JavaModelException { } protected void openWhenClosed ( IProgressMonitor pm , IBuffer buffer ) throws JavaModelException { } private String [ ] projectPrerequisites ( IClasspathEntry [ ] entries ) throws JavaModelException { } protected IClasspathEntry [ ] readPaths ( String xmlClasspath ) throws IOException { } protected void removeFromBuildSpec ( String builderID ) throws CoreException { } public void updatePackageFragmentRoots ( ) { } private IResource retrieveResource ( IPath path , IResourceDelta delta ) throws JavaModelException { } public String rootID ( ) { } public void saveClasspath ( boolean force ) throws JavaModelException { } private void setJavaCommand ( IProjectDescription description , ICommand newCommand ) throws CoreException { } public void setOutputLocation ( IPath outputLocation , IProgressMonitor monitor ) throws JavaModelException { } public void setProject ( IProject project ) { } public void setRawClasspath ( IClasspathEntry [ ] entries , IProgressMonitor monitor ) throws JavaModelException { } public void setRawClasspath ( IClasspathEntry [ ] entries , IPath outputLocation , IProgressMonitor monitor ) throws JavaModelException { } public void setRawClasspath ( IClasspathEntry [ ] newEntries , IPath newOutputLocation , IProgressMonitor monitor , boolean canChangeResource , boolean forceSave , IClasspathEntry [ ] oldClasspath ) throws JavaModelException { } protected void setRawClasspath0 ( IClasspathEntry [ ] rawEntries ) throws JavaModelException { JavaProjectElementInfo info = getJavaProjectElementInfo ( ) ; synchronized ( info ) { if ( rawEntries == null ) { rawEntries = defaultClasspath ( ) ; } info . setChildren ( new IPackageFragmentRoot [ ] { } ) ; info . setRawClasspath ( rawEntries ) ; updatePackageFragmentRoots ( ) ; IndexManager indexManager = ( ( JavaModelManager ) ( JavaModelManager . getJavaModelManager ( ) ) ) . getIndexManager ( ) ; IPackageFragmentRoot [ ] immediateRoots = getPackageFragmentRoots ( ) ; for ( int i = 0 , length = immediateRoots . length ; i < length ; i ++ ) { PackageFragmentRoot root = ( ( PackageFragmentRoot ) ( immediateRoots [ i ] ) ) ; <START_BUG> if ( ( ( root . getKind ( ) ) == ( IPackageFragmentRoot . K_BINARY ) ) && ( indexManager != null ) ) { <END_BUG> if ( root . isArchive ( ) ) { indexManager . indexJarFile ( root . getPath ( ) , getUnderlyingResource ( ) . getName ( ) ) ; } else { indexManager . indexBinaryFolder ( ( ( IFolder ) ( root . getUnderlyingResource ( ) ) ) , ( ( IProject ) ( this . getUnderlyingResource ( ) ) ) ) ; } } } } } public void setSharedProperty ( QualifiedName key , String value ) throws CoreException { } public void updateClassPath ( IProgressMonitor monitor , boolean canChangeResource ) throws JavaModelException { } private void createClasspathProblemMarker ( IClasspathEntry entry , String message ) { } protected void flushClasspathProblemMarkers ( ) { } public IClasspathEntry [ ] getClasspath ( ) throws JavaModelException { } public IClasspathEntry newLibraryEntry ( IPath path ) { } public IClasspathEntry newProjectEntry ( IPath path ) { } public IClasspathEntry newSourceEntry ( IPath path ) { } public void setClasspath ( IClasspathEntry [ ] entries , IProgressMonitor monitor ) throws JavaModelException { } }

Fix:
if ( ( root . getKind ( ) ) == ( IPackageFragmentRoot . K_BINARY ) ) {