简体   繁体   中英

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?

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." ("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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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