Program: 85720
Project: 85720
Buggy source:
public GeneralBody buildMixinReferenceReplacement(final MixinReference reference,final IScope callerScope,List<FoundMixin> mixins){
  GeneralBody result=new GeneralBody(reference.getUnderlyingStructure());
  if (mixins.isEmpty())   return result;
  final List<BodyCompilationData> compiledMixins=new ArrayList<BodyCompilationData>();
  for (  final FoundMixin fullMixin : mixins) {
    final ReusableStructure mixin=fullMixin.getMixin();
    final IScope mixinScope=fullMixin.getScope();
    final BodyCompilationData data=new BodyCompilationData(fullMixin.getMixin(),null);
    final ScopeView callerScopeCopy=ScopeFactory.createSaveableView(callerScope);
    callerScopeCopy.saveLocalDataForTheWholeWayUp();
    InScopeSnapshotRunner.runInLocalDataSnapshot(mixinScope.getParent(),new ITask(){
      @Override public void run(){
        IScope mixinArguments=buildMixinsArguments(reference,callerScope,fullMixin);
        data.setMixinArguments(mixinArguments);
        mixinScope.getParent().add(mixinArguments);
        ScopeView mixinWorkingScope=scopeManipulation.joinIfIndependent(callerScope,mixinScope);
        data.setMixinWorkingScope(mixinWorkingScope);
        MixinsGuardsValidator guardsValidator=new MixinsGuardsValidator(mixinWorkingScope,problemsHandler,configuration);
        GuardValue guardValue=guardsValidator.evaluateGuards(mixin);
        LinkedList<GuardValue> namespacesGuards=fullMixin.getGuardsOnPath();
        namespacesGuards.add(guardValue);
        guardValue=guardsValidator.andGuards(namespacesGuards);
        data.setGuardValue(guardValue);
      }
    }
);
    InScopeSnapshotRunner.runInLocalDataSnapshot(mixinScope.getParent(),new ITask(){
      @Override public void run(){
        IScope mixinArguments=data.getMixinArguments();
        ScopeView mixinWorkingScope=data.getMixinWorkingScope();
        mixinWorkingScope.getParent().add(mixinArguments);
        mixinWorkingScope.saveLocalDataForTheWholeWayUp();
        data.setMixinWorkingScope(mixinWorkingScope);
        easilyMoveable(callerScope,compiledMixins,fullMixin,data);
      }
    }
);
  }
  List<BodyCompilationData> mixinsToBeUsed=defaultGuardHelper.chooseMixinsToBeUsed(compiledMixins,reference);
  for (  BodyCompilationData data : mixinsToBeUsed) {
    result.addMembers(data.getReplacement());
    callerScope.addToDataPlaceholder(data.getReturnValues());
  }
  callerScope.closeDataPlaceholder();
  resolveImportance(reference,result);
  shiftComments(reference,result);
  return result;
}

Fixed version (ground truth):
public GeneralBody buildMixinReferenceReplacement(final MixinReference reference,final IScope callerScope,List<FoundMixin> mixins){
  GeneralBody result=new GeneralBody(reference.getUnderlyingStructure());
  if (mixins.isEmpty())   return result;
  final List<BodyCompilationData> compiledMixins=new ArrayList<BodyCompilationData>();
  for (  final FoundMixin fullMixin : mixins) {
    final ReusableStructure mixin=fullMixin.getMixin();
    final IScope mixinScope=fullMixin.getScope();
    final BodyCompilationData data=new BodyCompilationData(mixin,mixinScope,null);
    InScopeSnapshotRunner.runInLocalDataSnapshot(mixinScope.getParent(),new ITask(){
      @Override public void run(){
        IScope mixinArguments=buildMixinsArguments(reference,callerScope,fullMixin);
        data.setMixinArguments(mixinArguments);
        mixinScope.getParent().add(mixinArguments);
        ScopeView mixinWorkingScope=scopeManipulation.joinIfIndependent(callerScope,mixinScope);
        data.setMixinWorkingScope(mixinWorkingScope);
        MixinsGuardsValidator guardsValidator=new MixinsGuardsValidator(mixinWorkingScope,problemsHandler,configuration);
        GuardValue guardValue=guardsValidator.evaluateGuards(mixin);
        LinkedList<GuardValue> namespacesGuards=fullMixin.getGuardsOnPath();
        namespacesGuards.add(guardValue);
        guardValue=guardsValidator.andGuards(namespacesGuards);
        data.setGuardValue(guardValue);
        compiledMixins.add(data);
      }
    }
);
  }
  List<BodyCompilationData> mixinsToBeUsed=defaultGuardHelper.chooseMixinsToBeUsed(compiledMixins,reference);
  for (  final BodyCompilationData data : mixinsToBeUsed) {
    final ScopeView mixinWorkingScope=data.getMixinWorkingScope();
    InScopeSnapshotRunner.runInLocalDataSnapshot(data.getOriginalBodyOwnerScope().getParent(),new ITask(){
      @Override public void run(){
        BodyOwner<?> mixin=data.getCompiledBodyOwner();
        IScope mixinArguments=data.getMixinArguments();
        mixinWorkingScope.getParent().add(mixinArguments);
        mixinWorkingScope.saveLocalDataForTheWholeWayUp();
        data.setMixinWorkingScope(mixinWorkingScope);
        GuardValue guardValue2=data.getGuardValue();
        IScope mixinWorkingScope2=data.getMixinWorkingScope();
        if (guardValue2 != GuardValue.DO_NOT_USE) {
          BodyCompilationData compiled=resolveCalledBody(callerScope,mixin,mixinWorkingScope2,ReturnMode.MIXINS_AND_VARIABLES);
          data.setReplacement(compiled.getReplacement());
          data.setReturnValues(compiled.getReturnValues());
        }
      }
    }
);
  }
  for (  BodyCompilationData data : mixinsToBeUsed) {
    result.addMembers(data.getReplacement());
    callerScope.addToDataPlaceholder(data.getReturnValues());
  }
  callerScope.closeDataPlaceholder();
  resolveImportance(reference,result);
  shiftComments(reference,result);
  return result;
}