Program: 20570
Project: 20570
Buggy source:
private void readClass(){
  Class<?> iClass=(Class<?>)(javaClass != null ? javaClass : baseClass.getLanguageType());
  ParameterizedType type=SchemaHelper.resolveParameterizedType(iClass);
  List<Method> methods=SchemaHelper.getMethods(iClass);
  for (  Method method : methods) {
    if (isToIgnoreMethod(method))     continue;
    if (isGetterForField(method,type))     continue;
 else     if (isSetterForField(method,type))     continue;
 else     if (isEvent(method))     continue;
 else     createAction(method,type);
  }
  Field[] javaFields=iClass.getDeclaredFields();
  for (  Field curField : javaFields) {
    SchemaField sf=getField(curField.getName());
    if (sf != null && sf instanceof SchemaFieldReflection) {
      SchemaClass fieldSchemaClass=Roma.schema().getSchemaClassIfExist(curField.getType());
      if (sf.getType() == null || fieldSchemaClass.isAssignableAs(fieldSchemaClass)) {
        sf.setType(fieldSchemaClass);
        ((SchemaFieldReflection)sf).field=curField;
        ((SchemaFieldReflection)sf).languageType=SchemaHelper.resolveClassFromType(curField.getGenericType(),type);
      }
    }
  }
  List<SchemaField> curFields=new ArrayList<SchemaField>(fields.values());
  for (  SchemaField field : curFields) {
    if (field instanceof SchemaFieldReflection && ((SchemaFieldReflection)field).getGetterMethod() == null) {
      fields.remove(field.getName());
      orderedFields.remove(field);
    }
 else {
      if (field instanceof SchemaFieldReflection)       ((SchemaFieldReflection)field).configure();
      field.setOrder(getFieldOrder(field));
    }
  }
  Collections.sort(orderedFields);
  List<SchemaAction> curActions=new ArrayList<SchemaAction>(actions.values());
  for (  SchemaAction action : curActions) {
    if (action instanceof SchemaActionReflection)     ((SchemaActionReflection)action).configure();
    action.setOrder(getActionOrder(action));
  }
  Collections.sort(orderedActions);
  List<SchemaEvent> curEvents=new ArrayList<SchemaEvent>(events.values());
  for (  SchemaEvent event : curEvents) {
    if (event instanceof SchemaEventReflection)     ((SchemaEventReflection)event).configure();
    event.setOrder(getActionOrder(event));
  }
  Collections.sort(orderedActions);
}

Fixed version (ground truth):
private void readClass(){
  Class<?> iClass=(Class<?>)(javaClass != null ? javaClass : baseClass.getLanguageType());
  ParameterizedType type=SchemaHelper.resolveParameterizedType(iClass);
  List<Method> methods=SchemaHelper.getMethods(iClass);
  List<Method> eventsToAdd=new ArrayList<Method>();
  for (  Method method : methods) {
    if (isToIgnoreMethod(method))     continue;
    if (isGetterForField(method,type))     continue;
 else     if (isSetterForField(method,type))     continue;
 else     if (isEvent(method)) {
      eventsToAdd.add(method);
      continue;
    }
 else     createAction(method,type);
  }
  Field[] javaFields=iClass.getDeclaredFields();
  for (  Field curField : javaFields) {
    SchemaField sf=getField(curField.getName());
    if (sf != null && sf instanceof SchemaFieldReflection) {
      SchemaClass fieldSchemaClass=Roma.schema().getSchemaClassIfExist(curField.getType());
      if (sf.getType() == null || fieldSchemaClass.isAssignableAs(fieldSchemaClass)) {
        sf.setType(fieldSchemaClass);
        ((SchemaFieldReflection)sf).field=curField;
        ((SchemaFieldReflection)sf).languageType=SchemaHelper.resolveClassFromType(curField.getGenericType(),type);
      }
    }
  }
  List<SchemaField> curFields=new ArrayList<SchemaField>(fields.values());
  for (  SchemaField field : curFields) {
    if (field instanceof SchemaFieldReflection && ((SchemaFieldReflection)field).getGetterMethod() == null) {
      fields.remove(field.getName());
      orderedFields.remove(field);
    }
 else {
      if (field instanceof SchemaFieldReflection)       ((SchemaFieldReflection)field).configure();
      field.setOrder(getFieldOrder(field));
    }
  }
  Collections.sort(orderedFields);
  List<SchemaAction> curActions=new ArrayList<SchemaAction>(actions.values());
  for (  SchemaAction action : curActions) {
    if (action instanceof SchemaActionReflection)     ((SchemaActionReflection)action).configure();
    action.setOrder(getActionOrder(action));
  }
  Collections.sort(orderedActions);
  addEvents(eventsToAdd);
  List<SchemaEvent> curEvents=new ArrayList<SchemaEvent>(events.values());
  for (  SchemaEvent event : curEvents) {
    if (event instanceof SchemaEventReflection)     ((SchemaEventReflection)event).configure();
    event.setOrder(getActionOrder(event));
  }
  Collections.sort(orderedActions);
}