[ https://issues.apache.org/jira/browse/THRIFT-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057545#comment-13057545 ]
Mathias Herberts commented on THRIFT-1226: ------------------------------------------ Prior to THRIFT-1038, Thrift structures which contained binary fields were not serializable despite implementing Serializable (because ByteBuffer is not Serializable), THRIFT-1038 corrected this by using a TProtocol to write the object on the ObjectOutputStream, thus using Thrift's serialization mechanism. The 'default' Java serialization mechanism calls writeObject on the object to serialize, the default implementation of this method serializes primitive types and calls ObjectOutputStream.writeObject on referenced objects. The patch introduced by THRIFT-1038 makes the generated Thrift structures Serializable but using a custom serialization mechanism, not the 'default' one. To the best of my knowledge, the Java serialization spec (http://download.oracle.com/javase/1.5.0/docs/guide/serialization/spec/serialTOC.html) does not impose that object graph conservation property to custom serialization mechanisms. One cannot therefore expect the object graph conservation to apply to Thrift structures serialized using the custom writeObject methods. I'd be glad to hear anyone else's view of this issue. > command line option to disable overriding java serialization > ------------------------------------------------------------ > > Key: THRIFT-1226 > URL: https://issues.apache.org/jira/browse/THRIFT-1226 > Project: Thrift > Issue Type: Improvement > Components: Java - Compiler > Affects Versions: 0.6, 0.6.1 > Reporter: ojciec pijo > Attachments: testcase.zip > > > bugfix THRIFT-1038 is a breaking change since it overrides default java > serialization mechanism. as a result, objects generated by Thrift v6 are not > compatible with java serialization rules (references between objects are lost > after deserialization). Please provide a command line parameter to disable > generating readObject/writeObject as a workaround. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira