When recursive proto fields are initialized, the resulting messages have an expected nesting depth on the order of the inverse of the frequency with which a nullable value is non-null, which tends to run into StackOverflowErrors quickly.
This is fixed by checking whether a given proto field is recursive and if so, only initializing it "layer by layer" in mutations rather than all at once during initialization.
When recursive proto fields are initialized, the resulting messages have an expected nesting depth on the order of the inverse of the frequency with which a nullable value is non-null, which tends to run into StackOverflowErrors quickly.
This is fixed by checking whether a given proto field is recursive and if so, only initializing it "layer by layer" in mutations rather than all at once during initialization.