简体   繁体   English

在Gson代码库的哪一部分未处理循环引用?

[英]In which part of the Gson codebase are circular references unhandled?

Is the exception generated during the conversion of JSON or during the writing of the JSON? 是在JSON转换期间还是在JSON写入期间生成异常?

Thanks for your help in advance. 感谢您的帮助。

I suggest that you answered your own question by constructing a test-case that produced a StackOverflow exception when JSON was not involved: clearly, the addChild method is not programmed to recognize the (obviously erroneous) case when "the child that is to be added" is "the object itself." 我建议您通过构造一个测试用例来回答您自己的问题,该用例在不涉及JSON时会产生StackOverflow异常:显然,当“要添加的子代”时, addChild方法未编程为识别(显然是错误的)情形是“对象本身”。 ("That," IMHO, "is a rather serious omission," but it's probably something that you can do nothing about.) (“恕我直言,“这是一个相当严重的遗漏,”但是您可能对此无能为力。)

It is easy to foresee, then, that such an error could occur either when preparing the data, to be written as JSON, or when interpreting an incoming JSON stream. 这是很容易预见,那么,可能发生这样的错误或者准备数据时,将被写为JSON, 解释传入JSON流时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM