mandrean opened a new issue, #3343: URL: https://github.com/apache/fory/issues/3343
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fory/issues) and found no similar issues. ### Version 0.15.0 ### Component(s) Java ### Minimal reproduce step ```java import java.util.TreeSet; import org.apache.fory.Fory; import org.apache.fory.serializer.collection.CollectionSerializers.SortedSetSerializer; public class ChildTreeSet extends TreeSet<String> {} Fory fory = Fory.builder() .requireClassRegistration(false) .build(); // This throws UnsupportedOperationException at construction time fory.registerSerializer( ChildTreeSet.class, new SortedSetSerializer<>(fory, ChildTreeSet.class)); ``` `SortedSetSerializer` requires all non-`TreeSet` subclasses to have an explicit `(Comparator)` constructor. Java constructors are not inherited, so a subclass with only a no-arg constructor (which delegates to `TreeSet()`) fails even though `TreeSet(Comparator)` exists on the parent class. ### What did you expect to see? `SortedSetSerializer` should accept `TreeSet` subclasses that have a no-arg constructor but no `(Comparator)` constructor, falling back to the no-arg constructor for instantiation. ### What did you see instead? ``` java.lang.UnsupportedOperationException: java.lang.NoSuchMethodException: no such constructor: ChildTreeSet.<init>(Comparator)void/newInvokeSpecial at o.a.fory.serializer.collection.CollectionSerializers$SortedSetSerializer.<init>(CollectionSerializers.java:194) ``` ### Anything Else? This also affects the default serialization path indirectly. `TreeSet` subclasses fall back to `JDKCompatibleCollectionSerializer` (because `TreeSet` has `readObject`/`writeObject`), which works but is inefficient. Users who try to optimize by explicitly registering `SortedSetSerializer` hit this error. ### 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]
