public static @NotNull List<MutableAccessor> doCollect(@NotNull Class<?> aClass,
                                                         @NotNull Configuration configuration,
                                                         @Nullable ClassValue<List<MutableAccessor>> classToOwnFields) {
    List<MutableAccessor> accessors = new ArrayList<>();

    Map<String, Pair<Method, Method>> nameToAccessors;
    // special case for Rectangle.class to avoid infinite recursion during serialization due to `bounds()` method
    if (!configuration.collectAccessors || aClass == Rectangle.class) {
      nameToAccessors = Collections.emptyMap();
    }
    else {
      nameToAccessors = collectPropertyAccessors(aClass, accessors, configuration);
    }

    int propertyAccessorCount = accessors.size();
    Class<?> currentClass = aClass;
    // AtomicReference is a superclass of UserDataHolderBase, which is a superclass of many serializable objects,
    // and we mustn't consider AtomicReference.getOpaque etc. as serializable properties
    do {
      accessors.addAll(classToOwnFields == null ? doCollectOwnFields(currentClass, configuration) : classToOwnFields.get(currentClass));
    }
    while ((currentClass = currentClass.getSuperclass()) != null && isSerializableClass(configuration, currentClass));

    // if there are field accessor and property accessor, prefer field - Kotlin generates private var and getter/setter,
    // but annotation moved to var, not to getter/setter, so, we must remove duplicated accessor
    for (int j = propertyAccessorCount; j < accessors.size(); j++) {
      String name = accessors.get(j).getName();
      if (nameToAccessors.containsKey(name)) {
        for (int i = 0; i < propertyAccessorCount; i++) {
          if (accessors.get(i).getName().equals(name)) {
            accessors.remove(i);
            propertyAccessorCount--;
            //noinspection AssignmentToForLoopParameter
            j--;
            break;
          }
        }
      }
    }

    return accessors;
  }
public static @NotNull List<MutableAccessor> doCollect(@NotNull Class<?> aClass,
                                                         @NotNull Configuration configuration,
                                                         @Nullable ClassValue<List<MutableAccessor>> classToOwnFields)