Buggy code:
protected boolean findAffectedSourceFiles ( IResourceDelta delta , IResource [ ] binaryResources ) { } protected void findAffectedSourceFiles ( IResourceDelta binaryDelta , int segmentCount ) { } protected boolean findSourceFiles ( IResourceDelta delta ) throws CoreException { } protected void findSourceFiles ( IResourceDelta sourceDelta , int segmentCount ) throws CoreException { IResource resource = sourceDelta . getResource ( ) ; IPath location = resource . getLocation ( ) ; switch ( resource . getType ( ) ) { case IResource . PROJECT : case IResource . FOLDER : if ( resource . getName ( ) . equalsIgnoreCase ( "CVS" ) ) return ; switch ( sourceDelta . getKind ( ) ) { case IResourceDelta . ADDED : IPath addedPackagePath = location . removeFirstSegments ( segmentCount ) ; IFolder addedPackageFolder = outputFolder . getFolder ( addedPackagePath ) ; if ( ! ( addedPackageFolder . exists ( ) ) ) addedPackageFolder . create ( true , true , null ) ; if ( JavaBuilder . DEBUG ) System . out . println ( ( "Add<seq2seq4repair_space>dependents<seq2seq4repair_space>of<seq2seq4repair_space>added<seq2seq4repair_space>package<seq2seq4repair_space>" + addedPackagePath ) ) ; addDependentsOf ( addedPackagePath , true ) ; case IResourceDelta . CHANGED : IResourceDelta [ ] children = sourceDelta . getAffectedChildren ( ) ; for ( int i = 0 , length = children . length ; i < length ; i ++ ) findSourceFiles ( children [ i ] , segmentCount ) ; return ; case IResourceDelta . REMOVED : IPath removedPackagePath = location . removeFirstSegments ( segmentCount ) ; IFolder removedPackageFolder = outputFolder . getFolder ( removedPackagePath ) ; for ( int i = 0 , length = sourceFolders . length ; i < length ; i ++ ) { if ( ( sourceFolders [ i ] . findMember ( removedPackagePath ) ) != null ) { if ( ! ( removedPackageFolder . exists ( ) ) ) removedPackageFolder . create ( true , true , null ) ; IResourceDelta [ ] removedChildren = sourceDelta . getAffectedChildren ( ) ; for ( int j = 0 , rlength = removedChildren . length ; j < rlength ; j ++ ) findSourceFiles ( removedChildren [ j ] , segmentCount ) ; return ; } } if ( removedPackageFolder . exists ( ) ) removedPackageFolder . delete ( true , null ) ; if ( JavaBuilder . DEBUG ) System . out . println ( ( "Add<seq2seq4repair_space>dependents<seq2seq4repair_space>of<seq2seq4repair_space>removed<seq2seq4repair_space>package<seq2seq4repair_space>" + removedPackagePath ) ) ; addDependentsOf ( removedPackagePath , true ) ; newState . removePackage ( sourceDelta ) ; } return ; case IResource . FILE : String extension = location . getFileExtension ( ) ; if ( JAVA_EXTENSION . equalsIgnoreCase ( extension ) ) { IPath typePath = location . removeFirstSegments ( segmentCount ) . removeFileExtension ( ) ; String sourceLocation = location . toString ( ) ; switch ( sourceDelta . getKind ( ) ) { case IResourceDelta . ADDED : if ( JavaBuilder . DEBUG ) System . out . println ( ( "Compile<seq2seq4repair_space>this<seq2seq4repair_space>added<seq2seq4repair_space>source<seq2seq4repair_space>file<seq2seq4repair_space>" + location ) ) ; locations . add ( sourceLocation ) ; String typeName = typePath . setDevice ( null ) . toString ( ) ; typeNames . add ( typeName ) ; if ( ! ( newState . isDuplicateLocation ( typeName , sourceLocation ) ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( ( "Add<seq2seq4repair_space>dependents<seq2seq4repair_space>of<seq2seq4repair_space>added<seq2seq4repair_space>source<seq2seq4repair_space>file<seq2seq4repair_space>" + typePath ) ) ; addDependentsOf ( typePath , true ) ; } return ; case IResourceDelta . REMOVED : char [ ] [ ] definedTypeNames = newState . getDefinedTypeNamesFor ( sourceLocation ) ; if ( definedTypeNames == null ) { removeClassFile ( typePath ) ; } else if ( ( definedTypeNames . length ) > 0 ) { IPath packagePath = typePath . removeLastSegments ( 1 ) ; for ( int i = 0 , length = definedTypeNames . length ; i < length ; i ++ ) removeClassFile ( packagePath . append ( new String ( definedTypeNames [ i ] ) ) ) ; } <START_BUG> newState . remove ( location ) ; <END_BUG> return ; case IResourceDelta . CHANGED : if ( ( ( sourceDelta . getFlags ( ) ) & ( IResourceDelta . CONTENT ) ) == 0 ) return ; if ( JavaBuilder . DEBUG ) System . out . println ( ( "Compile<seq2seq4repair_space>this<seq2seq4repair_space>changed<seq2seq4repair_space>source<seq2seq4repair_space>file<seq2seq4repair_space>" + location ) ) ; locations . add ( sourceLocation ) ; typeNames . add ( typePath . setDevice ( null ) . toString ( ) ) ; } return ; } else if ( CLASS_EXTENSION . equalsIgnoreCase ( extension ) ) { return ; } else if ( hasSeparateOutputFolder ) { if ( javaBuilder . filterResource ( resource ) ) return ; IPath resourcePath = location . removeFirstSegments ( segmentCount ) ; IResource outputFile = outputFolder . getFile ( resourcePath ) ; switch ( sourceDelta . getKind ( ) ) { case IResourceDelta . ADDED : if ( outputFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( ( "Deleting<seq2seq4repair_space>existing<seq2seq4repair_space>file<seq2seq4repair_space>" + resourcePath ) ) ; outputFile . delete ( true , null ) ; } if ( JavaBuilder . DEBUG ) System . out . println ( ( "Copying<seq2seq4repair_space>added<seq2seq4repair_space>file<seq2seq4repair_space>" + resourcePath ) ) ; getOutputFolder ( resourcePath . removeLastSegments ( 1 ) ) ; resource . copy ( outputFile . getFullPath ( ) , true , null ) ; resource . setDerived ( true ) ; return ; case IResourceDelta . REMOVED : if ( outputFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( ( "Deleting<seq2seq4repair_space>removed<seq2seq4repair_space>file<seq2seq4repair_space>" + resourcePath ) ) ; outputFile . delete ( true , null ) ; } return ; case IResourceDelta . CHANGED : if ( ( ( sourceDelta . getFlags ( ) ) & ( IResourceDelta . CONTENT ) ) == 0 ) return ; if ( outputFile . exists ( ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( ( "Deleting<seq2seq4repair_space>existing<seq2seq4repair_space>file<seq2seq4repair_space>" + resourcePath ) ) ;

Fix:
newState . remove ( sourceLocation ) ;