Program: 12145
Project: 12145
Buggy source:
protected AbstractVariable processFieldInstruction(SimpleName fieldInstructionName,VariableDeclaration parameterDeclaration,AbstractVariable previousVariable){
  VariableDeclaration variableDeclaration=null;
  IBinding binding=fieldInstructionName.resolveBinding();
  if (binding.getKind() == IBinding.VARIABLE) {
    IVariableBinding variableBinding=(IVariableBinding)binding;
    if (variableBinding.isField()) {
      ITypeBinding declaringClassBinding=variableBinding.getDeclaringClass();
      SystemObject systemObject=ASTReader.getSystemObject();
      ClassObject classObject=systemObject.getClassObject(declaringClassBinding.getQualifiedName());
      if (classObject != null) {
        ListIterator<FieldObject> fieldIterator=classObject.getFieldIterator();
        while (fieldIterator.hasNext()) {
          FieldObject fieldObject=fieldIterator.next();
          VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
          if (fragment.resolveBinding().isEqualTo(variableBinding)) {
            variableDeclaration=fragment;
            break;
          }
        }
      }
    }
 else     if (variableBinding.isParameter()) {
      if (parameterDeclaration != null && parameterDeclaration.resolveBinding().isEqualTo(variableBinding))       variableDeclaration=parameterDeclaration;
    }
 else {
      for (      VariableDeclaration declaration : variableDeclarationsInMethod) {
        if (declaration.resolveBinding().isEqualTo(variableBinding)) {
          variableDeclaration=declaration;
          break;
        }
      }
    }
  }
  if (variableDeclaration != null) {
    AbstractVariable currentVariable=null;
    if (previousVariable == null)     currentVariable=new PlainVariable(variableDeclaration);
 else     currentVariable=new CompositeVariable(variableDeclaration,previousVariable);
    if (fieldInstructionName.getParent() instanceof QualifiedName) {
      QualifiedName qualifiedName=(QualifiedName)fieldInstructionName.getParent();
      Name qualifier=qualifiedName.getQualifier();
      if (qualifier instanceof SimpleName) {
        SimpleName qualifierSimpleName=(SimpleName)qualifier;
        if (!qualifierSimpleName.equals(fieldInstructionName))         return processFieldInstruction(qualifierSimpleName,parameterDeclaration,currentVariable);
 else         return currentVariable;
      }
 else       if (qualifier instanceof QualifiedName) {
        QualifiedName qualifiedName2=(QualifiedName)qualifier;
        return processFieldInstruction(qualifiedName2.getName(),parameterDeclaration,currentVariable);
      }
    }
 else     if (fieldInstructionName.getParent() instanceof FieldAccess) {
      FieldAccess fieldAccess=(FieldAccess)fieldInstructionName.getParent();
      Expression fieldAccessExpression=fieldAccess.getExpression();
      if (fieldAccessExpression instanceof FieldAccess) {
        FieldAccess fieldAccess2=(FieldAccess)fieldAccessExpression;
        return processFieldInstruction(fieldAccess2.getName(),parameterDeclaration,currentVariable);
      }
 else       if (fieldAccessExpression instanceof ThisExpression) {
        return currentVariable;
      }
    }
 else {
      return currentVariable;
    }
  }
  return null;
}

Fixed version (ground truth):
protected AbstractVariable processFieldInstruction(SimpleName fieldInstructionName,VariableDeclaration parameterDeclaration,AbstractVariable previousVariable){
  VariableDeclaration variableDeclaration=null;
  IBinding binding=fieldInstructionName.resolveBinding();
  if (binding.getKind() == IBinding.VARIABLE) {
    IVariableBinding variableBinding=(IVariableBinding)binding;
    if (variableBinding.isField()) {
      ITypeBinding declaringClassBinding=variableBinding.getDeclaringClass();
      SystemObject systemObject=ASTReader.getSystemObject();
      ClassObject classObject=systemObject.getClassObject(declaringClassBinding.getQualifiedName());
      if (classObject != null) {
        ListIterator<FieldObject> fieldIterator=classObject.getFieldIterator();
        while (fieldIterator.hasNext()) {
          FieldObject fieldObject=fieldIterator.next();
          VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
          if (fragment.resolveBinding().isEqualTo(variableBinding)) {
            variableDeclaration=fragment;
            break;
          }
        }
      }
    }
 else     if (variableBinding.isParameter() && parameterDeclaration != null) {
      if (parameterDeclaration.resolveBinding().isEqualTo(variableBinding))       variableDeclaration=parameterDeclaration;
    }
 else {
      for (      VariableDeclaration declaration : variableDeclarationsInMethod) {
        if (declaration.resolveBinding().isEqualTo(variableBinding)) {
          variableDeclaration=declaration;
          break;
        }
      }
    }
  }
  if (variableDeclaration != null) {
    AbstractVariable currentVariable=null;
    if (previousVariable == null)     currentVariable=new PlainVariable(variableDeclaration);
 else     currentVariable=new CompositeVariable(variableDeclaration,previousVariable);
    if (fieldInstructionName.getParent() instanceof QualifiedName) {
      QualifiedName qualifiedName=(QualifiedName)fieldInstructionName.getParent();
      Name qualifier=qualifiedName.getQualifier();
      if (qualifier instanceof SimpleName) {
        SimpleName qualifierSimpleName=(SimpleName)qualifier;
        if (!qualifierSimpleName.equals(fieldInstructionName))         return processFieldInstruction(qualifierSimpleName,parameterDeclaration,currentVariable);
 else         return currentVariable;
      }
 else       if (qualifier instanceof QualifiedName) {
        QualifiedName qualifiedName2=(QualifiedName)qualifier;
        return processFieldInstruction(qualifiedName2.getName(),parameterDeclaration,currentVariable);
      }
    }
 else     if (fieldInstructionName.getParent() instanceof FieldAccess) {
      FieldAccess fieldAccess=(FieldAccess)fieldInstructionName.getParent();
      Expression fieldAccessExpression=fieldAccess.getExpression();
      if (fieldAccessExpression instanceof FieldAccess) {
        FieldAccess fieldAccess2=(FieldAccess)fieldAccessExpression;
        return processFieldInstruction(fieldAccess2.getName(),parameterDeclaration,currentVariable);
      }
 else       if (fieldAccessExpression instanceof ThisExpression) {
        return currentVariable;
      }
    }
 else {
      return currentVariable;
    }
  }
  return null;
}