@Didier
Of course MyType implements Serializable . It is just a typo in the
example. Sorry.

@Paul
I didn't realized that Class is not GWT-serializable. Thanks for your
remark. I lost pretty much time to find out why I get an exception
during an RPC call

It would have been nice if Class<T> was serializable. I would have
used it to select an appropriate handler at server-side. Anyway I use
instead the canonical class name to map the handler, but the code is
little bit more uggly :-)

I noticed also the a call to class.hashCode() does not give the same
value in the (gwt-compiled)-client and in the (JVM running)-server.
In my attempts to workaround the "unserializability" of Class, I tried
to use the hashCode() value, unsuccessfully...

Regards
Yves

On 14 déc, 10:42, Paul Robinson <ukcue...@gmail.com> wrote:
> Class is not gwt-serializable.
>
> MyType has a non-final, non-transient field of type Class
>
> Therefore MyType is not serializable
>
> On 14/12/10 09:33, Didier Durand wrote:
>
> > Hi,
>
> > Serializable is an interface not a class. That's why it's not the list
> > you mention. An interface has nothing to be serialized per se.
>
> > You should let us know about your class MyType in order to better
> > help.
>
> > regards
>
> > didier
>
> > On Dec 14, 9:21 am, Paul Robinson<ukcue...@gmail.com>  wrote:
>
> >> If you look at the Class.java that GWT uses to emulate the JVM's Class,
> >> you'll see that it does not implement Serializable.
>
> >> On 13/12/10 22:19, yves wrote:
>
> >>> Hi,
>
> >>> I have a class defined in a way similar to this:
>
> >>> class MyType<T extends MyGen>    extends Serializable {
>
> >>>      private Class<T>    aClass;
>
> >>>      public MyType() {}
>
> >>>      public void setClass(Class<T>    aClass) {
> >>>         this.aClass = aClass;
> >>>      }
> >>> }
>
> >>> where MyGen is also Serializable
>
> >>> When I compile de project (I'am currently still using GWT 2.1.0 RC1),
> >>> then I find the following :
>
> >>> 1) the compiler (using the compiler options -extra, -work and -gen)
> >>> does not generate the code MyType_FieldSerializer.java as it does for
> >>> all other serializable classes.
>
> >>> 2) In the "extra" / rpclog dir, the class MyType is flagged like this:
> >>>      Serialization status
> >>>         Not serializable
>
> >>> 3) And when I run my app, I get an "InvocationException" : the client
> >>> is unable to make an RPC call with a parameter of type MyType.
>
> >>> Is it a bug in the compiler, or did I missed something about Class<T>
> >>> "serializability" ?
>
> >>> Thanks for your help
> >>> Yves

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to