IsSerializable Vs Serializable

47 views
Skip to first unread message

Eddy

unread,
Mar 21, 2007, 1:51:00 PM3/21/07
to Google Web Toolkit
Hi,

let's say we have a class, just a simple bean like this:

public class SimpleBean implements IsSerializable, Serializable {
...
}

it implements IsSerializable because it is a client bean used by GWT
application, but at the same time it implements the normal
Serializable interface because it is coming from a pure Java
FileStream, I/O, etc.
of course GWT compiler doesn't know Serializable and this is bad code.

On the other hand, from a formal point of view, this could be no
mistake cause both interfaces are just marker (tags) used by the
serializable engines to check compile/runtime wether a class is
serializable.

Couldn't be possible to make them "compatible" in some sort of way?
maybe making the GWT tag to extend the Java one:

public interface IsSerializable extends Serializable { }

in this way it would be possible to fetch a serialized bean from a
stream and, without any modification, send it to the client side of a
GWT app.

or maybe I'm talking nonsense and there is an easier way to do this :)

Travis

unread,
Mar 21, 2007, 2:26:16 PM3/21/07
to Google Web Toolkit
I have been doing this by adding a blank Serializable interface in
com.google.gwt.emul.java.io. This allows me to put the IsSerializable
class together on a JBoss server and pass it through the tomcat
servlet to the client. Have not noticed any side effects from this
being there. Is there a reason it is not part of the emulator? Can
be made standard in GWT?

Thanks
Travis

Eddy

unread,
Mar 21, 2007, 2:42:43 PM3/21/07
to Google Web Toolkit
Yes, that's definitely a solution, even if there might be something
one can do to reach the same result maybe using some of new Java 1.5
parts of the language.
I haven't checked anything about it, being stuck with 1.4.. even
though I'm pretty sure there isn't multiple inheritance available...
Reply all
Reply to author
Forward
0 new messages