Program: 44598
Project: 44598
Buggy source:
/** 
 * Transforms the   {@code method} into a method descriptor and creates a newmethod descriptor.
 * @param method the method to process.
 * @return the method descriptor that was created.
 */
public MethodDescriptor add(final ExecutableElement method){
  final MethodDescriptor result=new MethodDescriptor(this,method);
  Message message=method.getAnnotation(Message.class);
  LogMessage logMessage=method.getAnnotation(LogMessage.class);
  result.returnType=method.getReturnType();
  final Collection<MethodDescriptor> methodDescriptors=find(result.name());
  for (  MethodDescriptor methodDesc : methodDescriptors) {
    if (methodDesc.message() != null && message == null) {
      message=methodDesc.message();
    }
    if (methodDesc.logMessage() != null && logMessage == null) {
      logMessage=methodDesc.logMessage();
    }
    if (message != null && logMessage != null) {
      break;
    }
  }
  for (  MethodDescriptor methodDesc : methodDescriptors) {
    boolean changed=false;
    if (methodDesc.logMessage() == null) {
      methodDesc.logMessage=logMessage;
      changed=true;
    }
    if (methodDesc.message() == null) {
      methodDesc.message=message;
      changed=true;
    }
    if (changed) {
      descriptors.remove(methodDesc);
      descriptors.add(methodDesc);
    }
  }
  for (  VariableElement param : method.getParameters()) {
    if (param.getAnnotation(Cause.class) != null) {
      result.cause=param;
    }
    result.parameters.add(param);
  }
  result.logMessage=logMessage;
  result.message=message;
  result.descriptors.add(result);
  return result;
}

Fixed version (ground truth):
/** 
 * Transforms the   {@code method} into a method descriptor and creates a newmethod descriptor.
 * @param method the method to process.
 * @return the method descriptor that was created.
 */
protected MethodDescriptor add(final ExecutableElement method){
  final MethodDescriptor result=new MethodDescriptor(this,method);
  Message message=method.getAnnotation(Message.class);
  LogMessage logMessage=method.getAnnotation(LogMessage.class);
  result.returnType=method.getReturnType();
  final Collection<MethodDescriptor> methodDescriptors=find(result.name());
  for (  MethodDescriptor methodDesc : methodDescriptors) {
    if (methodDesc.message() != null && message == null) {
      message=methodDesc.message();
    }
    if (methodDesc.logMessage() != null && logMessage == null) {
      logMessage=methodDesc.logMessage();
    }
    if (message != null && logMessage != null) {
      break;
    }
  }
  for (  MethodDescriptor methodDesc : methodDescriptors) {
    boolean changed=false;
    if (methodDesc.logMessage == null) {
      methodDesc.logMessage=logMessage;
      changed=true;
    }
    if (methodDesc.message == null) {
      methodDesc.message=message;
      changed=true;
    }
    if (changed) {
      descriptors.remove(methodDesc);
      descriptors.add(methodDesc);
    }
  }
  for (  VariableElement param : method.getParameters()) {
    if (param.getAnnotation(Cause.class) != null) {
      result.cause=param;
    }
    result.parameters.add(param);
  }
  result.logMessage=logMessage;
  result.message=message;
  result.descriptors.add(result);
  return result;
}