Program: 12263
Project: 12263
Buggy source:
public boolean canBeMovedTo(ClassObject sourceClass,ClassObject targetClass,MethodObject sourceMethod){
  List<LocalVariableInstructionObject> localVariableInstructions=new ArrayList<LocalVariableInstructionObject>();
  for (  AbstractStatement statement : statementsForExtraction) {
    localVariableInstructions.addAll(statement.getLocalVariableInstructions());
  }
  for (  LocalVariableInstructionObject localVariableInstruction : localVariableInstructions) {
    if (localVariableInstruction.getType().getClassType().equals(targetClass.getName())) {
      VariableDeclarationStatement variableDeclarationStatement=null;
      LocalVariableDeclarationObject localVariableDeclaration=localVariableInstruction.generateLocalVariableDeclaration();
      for (      AbstractStatement statement : statementsForExtraction) {
        if (statement instanceof CompositeStatementObject) {
          CompositeStatementObject compositeStatement=(CompositeStatementObject)statement;
          variableDeclarationStatement=compositeStatement.getVariableDeclarationStatement(localVariableDeclaration);
        }
 else         if (statement instanceof StatementObject) {
          StatementObject statementObject=(StatementObject)statement;
          if (statementObject.containsLocalVariableDeclaration(localVariableDeclaration))           variableDeclarationStatement=(VariableDeclarationStatement)statementObject.getStatement();
        }
      }
      if (variableDeclarationStatement != null) {
        return false;
      }
 else {
        variableDeclarationStatement=sourceMethod.getVariableDeclarationStatement(localVariableDeclaration);
        if (variableDeclarationStatement != null)         return true;
        ListIterator<ParameterObject> parameterIterator=sourceMethod.getParameterListIterator();
        while (parameterIterator.hasNext()) {
          ParameterObject parameter=parameterIterator.next();
          if (localVariableInstruction.getName().equals(parameter.getName()))           return true;
        }
      }
    }
  }
  List<FieldInstructionObject> fieldInstructions=new ArrayList<FieldInstructionObject>();
  for (  AbstractStatement statement : statementsForExtraction) {
    fieldInstructions.addAll(statement.getFieldInstructions());
  }
  for (  FieldInstructionObject fieldInstruction : fieldInstructions) {
    if (fieldInstruction.getType().getClassType().equals(targetClass.getName())) {
      ListIterator<FieldObject> fieldIterator=sourceClass.getFieldIterator();
      while (fieldIterator.hasNext()) {
        FieldObject field=fieldIterator.next();
        if (fieldInstruction.getName().equals(field.getName()))         return true;
      }
    }
  }
  List<MethodInvocationObject> methodInvocations=new ArrayList<MethodInvocationObject>();
  for (  AbstractStatement statement : statementsForExtraction) {
    methodInvocations.addAll(statement.getMethodInvocations());
  }
  for (  MethodInvocationObject methodInvocation : methodInvocations) {
    if (methodInvocation.getOriginClassName().equals(sourceClass.getName())) {
      MethodObject invokedMethod=sourceClass.getMethod(methodInvocation);
      FieldInstructionObject fieldInstruction=invokedMethod.isGetter();
      if (fieldInstruction != null && fieldInstruction.getType().getClassType().equals(targetClass.getName()))       return true;
      MethodInvocationObject delegation=invokedMethod.isDelegate();
      if (delegation != null && delegation.getOriginClassName().equals(targetClass.getName()))       return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean canBeMovedTo(ClassObject sourceClass,ClassObject targetClass,MethodObject sourceMethod){
  List<LocalVariableInstructionObject> localVariableInstructions=new ArrayList<LocalVariableInstructionObject>();
  if (parentStatementForCopy != null) {
    for (    AbstractExpression expression : parentStatementForCopy.getExpressions()) {
      localVariableInstructions.addAll(expression.getLocalVariableInstructions());
    }
  }
  for (  AbstractStatement statement : statementsForExtraction) {
    localVariableInstructions.addAll(statement.getLocalVariableInstructions());
  }
  for (  LocalVariableInstructionObject localVariableInstruction : localVariableInstructions) {
    if (localVariableInstruction.getType().getClassType().equals(targetClass.getName())) {
      VariableDeclarationStatement variableDeclarationStatement=null;
      LocalVariableDeclarationObject localVariableDeclaration=localVariableInstruction.generateLocalVariableDeclaration();
      for (      AbstractStatement statement : statementsForExtraction) {
        if (statement instanceof CompositeStatementObject) {
          CompositeStatementObject compositeStatement=(CompositeStatementObject)statement;
          variableDeclarationStatement=compositeStatement.getVariableDeclarationStatement(localVariableDeclaration);
        }
 else         if (statement instanceof StatementObject) {
          StatementObject statementObject=(StatementObject)statement;
          if (statementObject.containsLocalVariableDeclaration(localVariableDeclaration))           variableDeclarationStatement=(VariableDeclarationStatement)statementObject.getStatement();
        }
      }
      if (variableDeclarationStatement != null) {
        return false;
      }
 else {
        variableDeclarationStatement=sourceMethod.getVariableDeclarationStatement(localVariableDeclaration);
        if (variableDeclarationStatement != null)         return true;
        ListIterator<ParameterObject> parameterIterator=sourceMethod.getParameterListIterator();
        while (parameterIterator.hasNext()) {
          ParameterObject parameter=parameterIterator.next();
          if (localVariableInstruction.getName().equals(parameter.getName()))           return true;
        }
      }
    }
  }
  List<FieldInstructionObject> fieldInstructions=new ArrayList<FieldInstructionObject>();
  if (parentStatementForCopy != null) {
    for (    AbstractExpression expression : parentStatementForCopy.getExpressions()) {
      fieldInstructions.addAll(expression.getFieldInstructions());
    }
  }
  for (  AbstractStatement statement : statementsForExtraction) {
    fieldInstructions.addAll(statement.getFieldInstructions());
  }
  for (  FieldInstructionObject fieldInstruction : fieldInstructions) {
    if (fieldInstruction.getType().getClassType().equals(targetClass.getName())) {
      ListIterator<FieldObject> fieldIterator=sourceClass.getFieldIterator();
      while (fieldIterator.hasNext()) {
        FieldObject field=fieldIterator.next();
        if (fieldInstruction.getName().equals(field.getName()))         return true;
      }
    }
  }
  List<MethodInvocationObject> methodInvocations=new ArrayList<MethodInvocationObject>();
  if (parentStatementForCopy != null) {
    for (    AbstractExpression expression : parentStatementForCopy.getExpressions()) {
      methodInvocations.addAll(expression.getMethodInvocations());
    }
  }
  for (  AbstractStatement statement : statementsForExtraction) {
    methodInvocations.addAll(statement.getMethodInvocations());
  }
  for (  MethodInvocationObject methodInvocation : methodInvocations) {
    if (methodInvocation.getOriginClassName().equals(sourceClass.getName())) {
      MethodObject invokedMethod=sourceClass.getMethod(methodInvocation);
      FieldInstructionObject fieldInstruction=invokedMethod.isGetter();
      if (fieldInstruction != null && fieldInstruction.getType().getClassType().equals(targetClass.getName()))       return true;
      MethodInvocationObject delegation=invokedMethod.isDelegate();
      if (delegation != null && delegation.getOriginClassName().equals(targetClass.getName()))       return true;
    }
  }
  return false;
}