Handle recursive types in parameterized records

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Unknown
    • 4.8.0
    • Affects Version/s: None
    • Component/s: POJO
    • None
    • None
    • Fully Compatible
    • Needed
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              Jeffrey Yemin
              Reporter:
              Jeffrey Yemin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: