PigsyMonk opened a new issue, #2454: URL: https://github.com/apache/fory/issues/2454
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fory/issues) and found no similar issues. ### Version 0.11.2 ### Component(s) Java ### Minimal reproduce step public class FuryBugReporter { // memory concern, try making some class can act like a list private interface SingleItemList<E> extends List<E> { E getFirst(); @Nonnull default Iterator<E> iterator() { throw new UnsupportedOperationException(); } @Nonnull default Object[] toArray() { throw new UnsupportedOperationException(); } @Nonnull default <E> E[] toArray(@Nonnull E[] a) { return null; } default boolean add(E e) { throw new UnsupportedOperationException(); } default boolean remove(Object o) { throw new UnsupportedOperationException(); } default boolean containsAll(@Nonnull Collection<?> c) { throw new UnsupportedOperationException(); } default boolean addAll(@Nonnull Collection<? extends E> c) { throw new UnsupportedOperationException(); } default boolean addAll(int index, @Nonnull Collection<? extends E> c) { throw new UnsupportedOperationException(); } default boolean removeAll(@Nonnull Collection<?> c) { throw new UnsupportedOperationException(); } default boolean retainAll(@Nonnull Collection<?> c) { throw new UnsupportedOperationException(); } default void clear() { throw new UnsupportedOperationException(); } default void rangeCheckForAdd(int index) { throw new UnsupportedOperationException(); } default void rangeCheck(int index) { throw new UnsupportedOperationException(); } default String outOfBoundsMsg(int index) { return "Index: " + index + ", Size: " + this.size(); } default E get(int index) { this.rangeCheck(index); return this.getFirst(); } default E set(int index, E element) { throw new UnsupportedOperationException(); } default void add(int index, E element) { throw new UnsupportedOperationException(); } default E remove(int index) { throw new UnsupportedOperationException(); } default int indexOf(Object o) { return Objects.equals(this.getFirst(), o) ? 0 : -1; } default int lastIndexOf(Object o) { return this.indexOf(o); } @Nonnull default ListIterator<E> listIterator() { throw new UnsupportedOperationException(); } @Nonnull default ListIterator<E> listIterator(int index) { throw new UnsupportedOperationException(); } @Nonnull default List<E> subList(int fromIndex, int toIndex) { throw new UnsupportedOperationException(); } default int size() { return 1; } default boolean isEmpty() { return false; } default boolean contains(Object o) { return Objects.equals(this.getFirst(), o); } default void sort(Comparator<? super E> c) { } default E getLast() { throw new UnsupportedOperationException(); } } private static class Record implements SingleItemList<Record> { @Override public Record getFirst() { return this; } } private static class RecordHolder { private Record record; } public static void main(String[] args) { Fory fory = Fory.builder() .withLanguage(Language.JAVA) .requireClassRegistration(false) .withNumberCompressed(true) .withRefTracking(true) .withCompatibleMode(CompatibleMode.COMPATIBLE) .withAsyncCompilation(false) .withCodegen(true) .build(); Record record = new Record(); RecordHolder recordHolder = new RecordHolder(); recordHolder.record = record; byte[] bytes = fory.serialize(recordHolder); } } ### What did you expect to see? object recordHolder can be serilaized ### What did you see instead? an stack over flow error ### Anything Else? _No response_ ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
