Re: NotSerializable object issue...
On Jul 4, 8:41 pm, Slash <java.ko...@gmail.com> wrote:
Hello all...
I have got a ghost bug running around my project* for a while now, and
I haven't been able to track it... to put it simple, I am writing a
serializable object to disk (an object of class Game) when the player
saves the game. It works most of the times, however, under
circumstances I haven't been able to figure out, it fails with a
NotSerializable Exception over an object that is supposed never to be
Serialized. (GFXUserInterface, which I dont want to just implement
Serializable, as I would then have to make its members Serializable,
and it would be an ugly hack)
I have looked for member variables of this type and its
superclasses... all of them are transient. I did the same for all the
interfaces implemented by this type... no luck...
Can you recomend me a program that recursively checks a serializable
class to see if it has non transient non serializable fields? I tried
FindBugs, but it didn't report anything about it...
Thanks in advance for any help that could be provided.
--
Slashhttp://www.santiagoz.com
* CastlevaniaRL, a roguelike game (http://www.santiagoz.com/web)
Any field you don't want serialized should be declared transient.
It also sounds like a design flaw to hold on to an object that is
related to the running state of your program, but not related to the
state of the game.