[jboss-jira] [JBoss JIRA] Commented: (JASSIST-42) Proxy serialization looses inner data objects
David Lloyd (JIRA)
jira-events at lists.jboss.org
Sun Feb 21 14:32:18 EST 2010
[ https://jira.jboss.org/jira/browse/JASSIST-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12515597#action_12515597 ]
David Lloyd commented on JASSIST-42:
------------------------------------
Designing Javassist proxies to rely on readResolve()/writeReplace() was a mistake for a few reasons.
1) The design of SerializedProxy is insufficiently flexible, as it makes a number of assumptions about the serializable proxy (for example, that it has no significant serializable state).
2) Proxy type superclasses cannot define their own readResolve/writeReplace methods; at best it simply won't work; at worst it could result in VerifyError since the superclass's writeReplace might have too restrictive of an access level or a final modifier.
3) It is impossible to use a secondary mechanism, like special class annotation, to make traditional serialization work properly because the proxy's writeReplace will cause serialization to be bypassed in any case.
If there is an option to globally disable writeReplace/SerializableProxy somehow, then the ObjectOutputStream subclass idea will solve all three of the above issues and would suffice to allow proxy serialization in a 100% compliant fashion, with a minimum of coding effort required.
> Proxy serialization looses inner data objects
> ---------------------------------------------
>
> Key: JASSIST-42
> URL: https://jira.jboss.org/jira/browse/JASSIST-42
> Project: Javassist
> Issue Type: Bug
> Reporter: Damien Lecan
> Assignee: Shigeru Chiba
> Priority: Blocker
>
> I working with proxies build with ProxyFactory method.
> When I want to serialize/deserialize it, everything seems to be ok except that only proxy instance is serialized, not inner objects.
> Eg.
> Object "A" contains an instance of "B"
> After serialization/deserialization of a proxy of A, instance of "B" in "A" is null
> When I look at this code :
> public static SerializedProxy makeSerializedProxy(Object proxy)
> throws java.io.InvalidClassException
> {
> Class clazz = proxy.getClass();
> return new SerializedProxy(clazz, ProxyFactory.getFilter(clazz),
> ProxyFactory.getHandler(clazz));
> }
> I don't understand how serialization can keep inner objects ...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list