XStream won't call readObject()

你。 提交于 2019-12-06 13:03:29
eipark

It seems that the XStream documentation was incorrect, or at least misleading. It says in http://x-stream.github.io/faq.html#Serialization_initialize_transient,

Use the latter [readObject] in class hierarchies, readResolve is not called for base classes.

However, replacing readObject() with readResolve() in the code I listed in my question, it seems to be called and foo is being initialized properly. This is confusing though because according to documentation of both XStream and java.io.Serializable, readObject() seems to be what I need.

The breakpoint inside the method still is not being hit however. It may have to do with the way these Serializable methods are being called.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!