Buggy code:
public class JavaBuilder extends IncrementalProjectBuilder { IProject currentProject ; IJavaProject javaProject ; IWorkspaceRoot workspaceRoot ; ClasspathLocation [ ] classpath ; IContainer outputFolder ; IContainer [ ] sourceFolders ; SimpleLookupTable binaryResources ; State lastState ; BuildNotifier notifier ; char [ ] [ ] resourceFilters ; public static final String JAVA_EXTENSION = "java" ; public static final String CLASS_EXTENSION = "class" ; public static final String JAR_EXTENSION = "jar" ; public static final String ZIP_EXTENSION = "zip" ; public static final String OPTION_InvalidClasspathSwitch = "org.eclipse.jdt.core.builder.invalidClasspath" ; public static final String OPTION_ResourceCopyFilter = "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter" ; public static boolean DEBUG = false ; static final String ProblemMarkerTag = IJavaModelMarker . JAVA_MODEL_PROBLEM_MARKER ; static ArrayList builtProjects = null ; public static IMarker [ ] getProblemsFor ( IResource resource ) { } public static void removeProblemsFor ( IResource resource ) { } public static State readState ( DataInputStream in ) throws IOException { } public static void writeState ( Object state , DataOutputStream out ) throws IOException { } public JavaBuilder ( ) { } protected IProject [ ] build ( int kind , Map ignored , IProgressMonitor monitor ) throws CoreException { } private void buildAll ( ) { } private void buildDeltas ( SimpleLookupTable deltas ) { } private void cleanup ( ) { } private void clearLastState ( ) { } private void createFolder ( IContainer folder ) throws CoreException { } boolean filterResource ( IResource resource ) { } private SimpleLookupTable findDeltas ( ) { } private State getLastState ( IProject project ) { } private IProject [ ] getRequiredProjects ( ) { if ( ( ( javaProject ) == null ) || ( ( workspaceRoot ) == null ) ) return new IProject [ 0 ] ; ArrayList projects = new ArrayList ( ) ; try { IClasspathEntry [ ] entries = ( ( JavaProject ) ( javaProject ) ) . getExpandedClasspath ( true ) ; for ( int i = 0 , length = entries . length ; i < length ; i ++ ) { IClasspathEntry entry = JavaCore . getResolvedClasspathEntry ( entries [ i ] ) ; if ( ( entry != null ) && ( ( entry . getEntryKind ( ) ) == ( IClasspathEntry . CPE_PROJECT ) ) ) { IProject p = workspaceRoot . getProject ( entry . getPath ( ) . lastSegment ( ) ) ; if ( ( p != null ) && ( ! ( projects . contains ( p ) ) ) ) projects . add ( p ) ; } } if ( ( binaryResources ) != null ) { Object [ ] keyTable = binaryResources . keyTable ; for ( int i = 0 , l = keyTable . length ; i < l ; i ++ ) { IProject p = ( ( IProject ) ( keyTable [ i ] ) ) ; <START_BUG> if ( ( p != null ) && ( ! ( projects . contains ( p ) ) ) ) <END_BUG> projects . add ( p ) ; } } } catch ( JavaModelException e ) { return new IProject [ 0 ] ; } IProject [ ] result = new IProject [ projects . size ( ) ] ; projects . toArray ( result ) ; return result ; } private boolean hasClasspathChanged ( ) { } private boolean hasOutputLocationChanged ( ) { } private void initializeBuilder ( ) throws CoreException { } private boolean isWorthBuilding ( ) throws CoreException { } private void recordNewState ( State state ) { } public String toString ( ) { } }

Fix:
if ( ( ( p != null ) && ( p != ( currentProject ) ) ) && ( ! ( projects . contains ( p ) ) ) )