Does Java Serialization work for cyclic references?
问题 For example: Object A contains Object B that contains Object C that contains Object A. Will Object A serialize properly? Comment #9 here indicates that it does not work . In contrast, XStream indicates that it does handle cyclic references. 回答1: Yes, the default Java serialization works for cyclic references. When you serialize object C, the field will contain a backreference to the already-serialized object A instead of serializing it again. 回答2: Yes, Java serialization works for circular