Using that logic, we can make all of the fields transient. But what is the 
point if the deserialized object is meaningless because important fields 
are null?

Making the fields transient does not make the object serializable. It just 
ignores the data that can't be serialized and you end up with a 
meaningless serialized form.

Another important factor here that the serialized form of a type is an API 
contract. As an API contract, one must be able to deserialize a meaningful 
object which you cannot since Bundle cannot be serialized.

Believe me, I regret making these extends EventObject. Unfortunately I 
can't take it back... :-(
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[email protected]

office: +1 386 848 1781
mobile: +1 386 848 3788





From:   [email protected]
To:     "OSGi Developer Mail List" <[email protected]>
Date:   2011/08/04 13:35
Subject:        RE: [osgi-dev] BundleEvent and others extend EventObject 
eventhough      they aren't serializable
Sent by:        [email protected]



Is there a reason fields of those types couldn’t be made transient?
 
David Humeniuk
 
From: BJ Hargrave [mailto:[email protected]] 
Sent: Thursday, August 04, 2011 12:20 PM
To: OSGi Developer Mail List
Subject: Re: [osgi-dev] BundleEvent and others extend EventObject 
eventhough they aren't serializable
 
I think you are stuck with this. It was a design mistake in R1 (c. 1999) 
to base these classes on EventObject. Mea culpa. 

There is no way to make them serializable. Bundle and ServiceReference 
(types referenced by these classes) are not serializable and cannot be 
made so. There is no way to declare the event classes not serializable as 
far as I know. And we cannot really go back now and remove the base class. 
Sorry. 
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[email protected] 

office: +1 386 848 1781
mobile: +1 386 848 3788






From:        [email protected] 
To:        <[email protected]> 
Date:        2011/08/04 11:22 
Subject:        [osgi-dev] BundleEvent and others extend EventObject even 
though        they aren't serializable 
Sent by:        [email protected] 




EventObject implements Serializable so any class extending it should be 
serializable as well.  However, BundleEvent and others are not serialiable 
and as I understand are not intended to be. 
  
Any chance the base class will change or am I stuck with this?  I would 
rather not have special logic which ignore these types of object when 
sending them through RMI (or other times serializing is involved). 
  
Thanks, 
David Humeniuk_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev 
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to