code: protected <T> List<T> toArrayList(List<T> list) {
          if (list == null) {
              return null;
          }
          if (!list.getClass().equals(ArrayList.class)) {
              list = new ArrayList<>(list);
          }
          return list;
      }
docs: This is used to fix Kryo serialization issues with lists generated from methods such as
  {@link java.util.Arrays#asList(Object[])}