Hi David!
I'm forwarding this to the CID-EG list (weld-dev is only for JBoss Weld now).
LieGrue,
strub
--- On Tue, 5/24/11, David Blevins <david.blevins(a)gmail.com> wrote:
From: David Blevins <david.blevins(a)gmail.com>
Subject: [weld-dev] Overly restrictive serialization requirements
To: weld-dev(a)lists.jboss.org
Date: Tuesday, May 24, 2011, 4:18 AM
I find CDI 1.0 section 6.6.4 and some
of the TCK tests a little confusing. I know
serialization like the back of my hand and much of that
section does not line up with actual serialization
requirements.
The bottom line is that you can't statically check a
class's serialization capabilities. Non-serializable
object reference types are ok. Fields of
java.lang.Object and other non-serialzable types are
ok. The reference type does not need to be
serializable, just the object at the other end of the
reference needs to be serializable. Obviously you
can't check that at deploy time, you need the
instance. You can't even check it at runtime as there
are callbacks in the Serialization API that allow the
instance to control it's own serialization. If the
class implements Serializable you just have to trust it will
be when the time comes.
Small example:
https://gist.github.com/988120
What's the point of mistrusting a class that claims to be
serializable and adding CDI-specific restrictions on its
fields, methods and constructor types?
-David
_______________________________________________
weld-dev mailing list
weld-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev