Hello team. I got some question/problem with XStream. I have a class with custom realization of methods equals/hashCode. Such objects contains in HashSet collection. Default XStream behavior: create object instance, read attributes, read inner fields, return object and add it to collection if needed. The problem: due a specific object graph on some step of deserialization object was created, added to collection, and after all other fields was loaded. After fields was loaded, result of hashCode was changed, causing "damage" to collection (because HashSet uses HashMap inside). That happens because xstream got object with null fields from cache by 'refference' attribute. This does not looks like a bug, but working behavior is not ideal. In my project I fixed it by restoring collection (just recreate it with same objects) in readResolve of other object (1 level upward in graph). There are other problem: calling readResolve does not guarantee that all fields of 'this' object (including sub objects in fields) was fully deserialized at moment of call. That why I cant fix collection in readResolve of object with HashSet or HashMap and should do it in other place.
There are attach file that nicely describes a situation.
Main.java
Description: Binary data
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email