Description
The implementation of JAVA-4740 (Support deserialization of records with generic parameters) doesn't handle recursive types, and will result in a runtime recursion that is only halted by a StackOverflowException. We need a different design in order to handle this case properly. An example to make it clearer:
public record RecordTree<T>(T content, |
@Nullable RecordTree<T> left, |
@Nullable RecordTree<T> right) { |
}
|
The RecordCodec should be able to handle a record like that, and in general, any sort of cyclical reference. Note that this isn't about actual cycles in the object graph. It's about cycles in the static type definitions.