Program: 9374
Project: 9374
Buggy source:
public void completeTypeBindings(){
  stepCompleted=BUILD_TYPE_HIERARCHY;
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i].scope.checkAndSetImports();
  }
  stepCompleted=CHECK_AND_SET_IMPORTS;
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i].scope.connectTypeHierarchy();
  }
  stepCompleted=CONNECT_TYPE_HIERARCHY;
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i].scope.buildFieldsAndMethods();
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      factory.addSourceTypeBinding(b[j]);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      buildInterTypeAndPerClause(b[j].scope);
      addCrosscuttingStructures(b[j].scope);
    }
  }
  factory.finishTypeMungers();
  Collection typeMungers=factory.getTypeMungers();
  Collection declareParents=factory.getDeclareParents();
  doPendingWeaves();
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    weaveInterTypeDeclarations(units[i].scope,typeMungers,declareParents);
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      resolvePointcutDeclarations(b[j].scope);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      addAdviceLikeDeclares(b[j].scope);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i]=null;
  }
  stepCompleted=BUILD_FIELDS_AND_METHODS;
  lastCompletedUnitIndex=lastUnitIndex;
}

Fixed version (ground truth):
public void completeTypeBindings(){
  stepCompleted=BUILD_TYPE_HIERARCHY;
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i].scope.checkAndSetImports();
  }
  stepCompleted=CHECK_AND_SET_IMPORTS;
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i].scope.connectTypeHierarchy();
  }
  stepCompleted=CONNECT_TYPE_HIERARCHY;
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i].scope.buildFieldsAndMethods();
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      factory.addSourceTypeBinding(b[j]);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      buildInterTypeAndPerClause(b[j].scope);
      addCrosscuttingStructures(b[j].scope);
    }
  }
  factory.finishTypeMungers();
  Collection typeMungers=factory.getTypeMungers();
  Collection declareParents=factory.getDeclareParents();
  doPendingWeaves();
  boolean typeProcessingOrderIsImportant=declareParents.size() > 0;
  if (typeProcessingOrderIsImportant) {
    List typesToProcess=new ArrayList();
    for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
      CompilationUnitScope cus=units[i].scope;
      SourceTypeBinding[] stbs=cus.topLevelTypes;
      for (int j=0; j < stbs.length; j++) {
        SourceTypeBinding stb=stbs[j];
        typesToProcess.add(stb);
      }
    }
    while (typesToProcess.size() > 0) {
      weaveIntertypes(typesToProcess,(SourceTypeBinding)typesToProcess.get(0),typeMungers,declareParents);
    }
  }
 else {
    for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
      weaveInterTypeDeclarations(units[i].scope,typeMungers,declareParents);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      resolvePointcutDeclarations(b[j].scope);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    SourceTypeBinding[] b=units[i].scope.topLevelTypes;
    for (int j=0; j < b.length; j++) {
      addAdviceLikeDeclares(b[j].scope);
    }
  }
  for (int i=lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
    units[i]=null;
  }
  stepCompleted=BUILD_FIELDS_AND_METHODS;
  lastCompletedUnitIndex=lastUnitIndex;
}