ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dardo D Kleiner <dklei...@cmf.nrl.navy.mil>
Subject [OT] Re: AW: RMI problem with Ant
Date Mon, 08 Jul 2002 15:04:51 GMT
>     As I was going through the problem, I found out that this happens only
> with the innerclasses. When the innerclass is serialized
> java.io.NotSerializableException: is thrown. It should be noted that only
> the innerclass is implementing the Serializable interface. And I serialize
> only the innerclass. Does that make any difference for Ant.
> 
> For the normal classes there is no problem with the serialization.

By default, normal inner classes have a hidden reference to their enclosing class.  When you
attempt to serialize the inner class, RMI will try to pull the enclosing class along with
it.  A simple answer is to declare the inner class "static" - making it effectively a top-level
class, with no reference to the enclosing class.

There might be a way to use Externalizable to avoid streaming the enclosing class (or perhaps
serialPersistentFields might help) - but I believe that's your basic problem: understanding
inner classes.

This is not Ant related at all.  Not sure why it works under JBuilder - it should still fail.

Continue off list...

-- 
Dardo D. Kleiner
Connection Machine Facility, Center for Computational Sciences
Naval Research Laboratory (Washington, DC)
dkleiner@cmf.nrl.navy.mil -- 202.404.7019 



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message