Buggy code:
public class IncrementalImageBuilder extends AbstractImageBuilder { protected ArrayList sourceFiles ; protected ArrayList previousSourceFiles ; protected StringSet qualifiedStrings ; protected StringSet simpleStrings ; protected StringSet rootStrings ; protected SimpleLookupTable secondaryTypesToRemove ; protected boolean hasStructuralChanges ; protected int compileLoop ; protected boolean makeOutputFolderConsistent ; public static int MaxCompileLoop = 5 ; protected IncrementalImageBuilder ( JavaBuilder javaBuilder , State buildState ) { } protected IncrementalImageBuilder ( JavaBuilder javaBuilder ) { } protected IncrementalImageBuilder ( BatchImageBuilder batchBuilder ) { } public boolean build ( SimpleLookupTable deltas ) { } protected void buildAfterBatchBuild ( ) { } protected void addAffectedSourceFiles ( ) { } protected void addAffectedSourceFiles ( StringSet qualifiedSet , StringSet simpleSet , StringSet rootSet , StringSet affectedTypes ) { } protected void addDependentsOf ( IPath path , boolean isStructuralChange ) { } protected void addDependentsOf ( IPath path , boolean isStructuralChange , StringSet qualifiedNames , StringSet simpleNames , StringSet rootNames ) { } protected boolean checkForClassFileChanges ( IResourceDelta binaryDelta , ClasspathMultiDirectory md , int segmentCount ) throws CoreException { } protected void cleanUp ( ) { } protected void compile ( SourceFile [ ] units , SourceFile [ ] additionalUnits , boolean compilingFirstGroup ) { } protected void deleteGeneratedFiles ( IFile [ ] deletedGeneratedFiles ) { } protected boolean findAffectedSourceFiles ( IResourceDelta delta , ClasspathLocation [ ] classFoldersAndJars , IProject prereqProject ) { } protected void findAffectedSourceFiles ( IResourceDelta binaryDelta , int segmentCount , StringSet structurallyChangedTypes ) { } protected boolean findSourceFiles ( IResourceDelta delta ) throws CoreException { } protected boolean findSourceFiles ( IResourceDelta sourceDelta , ClasspathMultiDirectory md , int segmentCount ) throws CoreException { } protected void finishedWith ( String sourceLocator , CompilationResult result , char [ ] mainTypeName , ArrayList definedTypeNames , ArrayList duplicateTypeNames ) { } protected void processAnnotationResults ( CompilationParticipantResult [ ] results ) { } protected void removeClassFile ( IPath typePath , IContainer outputFolder ) throws CoreException { } protected void removeSecondaryTypes ( ) throws CoreException { } protected void resetCollections ( ) { } protected void updateProblemsFor ( SourceFile sourceFile , CompilationResult result ) throws CoreException { } protected void updateTasksFor ( SourceFile sourceFile , CompilationResult result ) throws CoreException { } protected void writeClassFileContents ( ClassFile classfile , IFile file , String qualifiedFileName , boolean isTopLevelType , SourceFile compilationUnit ) throws CoreException { byte [ ] bytes = classfile . getBytes ( ) ; if ( file . exists ( ) ) { if ( ( writeClassFileCheck ( file , qualifiedFileName , bytes ) ) || ( compilationUnit . updateClassFile ) ) { if ( JavaBuilder . DEBUG ) System . out . println ( ( "Writing<seq2seq4repair_space>changed<seq2seq4repair_space>class<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getName ( ) ) ) ) ; if ( ! ( file . isDerived ( ) ) ) <START_BUG> file . setDerived ( true ) ; <END_BUG> file . setContents ( new ByteArrayInputStream ( bytes ) , true , false , null ) ; } else if ( JavaBuilder . DEBUG ) { System . out . println ( ( "Skipped<seq2seq4repair_space>over<seq2seq4repair_space>unchanged<seq2seq4repair_space>class<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getName ( ) ) ) ) ; } } else { if ( isTopLevelType ) addDependentsOf ( new Path ( qualifiedFileName ) , true ) ; if ( JavaBuilder . DEBUG ) System . out . println ( ( "Writing<seq2seq4repair_space>new<seq2seq4repair_space>class<seq2seq4repair_space>file<seq2seq4repair_space>" + ( file . getName ( ) ) ) ) ; try { file . create ( new ByteArrayInputStream ( bytes ) , ( ( IResource . FORCE ) | ( IResource . DERIVED ) ) , null ) ; } catch ( CoreException e ) { if ( ( e . getStatus ( ) . getCode ( ) ) == ( IResourceStatus . CASE_VARIANT_EXISTS ) ) { IStatus status = e . getStatus ( ) ; if ( status instanceof IResourceStatus ) { IPath oldFilePath = ( ( IResourceStatus ) ( status ) ) . getPath ( ) ; char [ ] oldTypeName = oldFilePath . removeFileExtension ( ) . lastSegment ( ) . toCharArray ( ) ; char [ ] [ ] previousTypeNames = this . newState . getDefinedTypeNamesFor ( compilationUnit . typeLocator ( ) ) ; boolean fromSameFile = false ; if ( previousTypeNames == null ) { fromSameFile = CharOperation . equals ( compilationUnit . getMainTypeName ( ) , oldTypeName ) ; } else { for ( int i = 0 , l = previousTypeNames . length ; i < l ; i ++ ) { if ( CharOperation . equals ( previousTypeNames [ i ] , oldTypeName ) ) { fromSameFile = true ; break ; } } } if ( fromSameFile ) { IFile collision = file . getParent ( ) . getFile ( new Path ( oldFilePath . lastSegment ( ) ) ) ; collision . delete ( true , false , null ) ; boolean success = false ; try { file . create ( new ByteArrayInputStream ( bytes ) , ( ( IResource . FORCE ) | ( IResource . DERIVED ) ) , null ) ; success = true ; } catch ( CoreException ignored ) { } if ( success ) return ; } } throw new AbortCompilation ( true , new AbortIncrementalBuildException ( qualifiedFileName ) ) ; } throw e ; } } } protected boolean writeClassFileCheck ( IFile file , String fileName , byte [ ] newBytes ) throws CoreException { } public String toString ( ) { } }

Fix:
file . setDerived ( true , null ) ;