The problem with List<Object> or List<Serializable> is that it forces
GWT to look for every implementation of serializable used anywhere with
your program  and generate the code needs to serialize and deserialize it.

This is asking it to do too much work - so the compile would take much
longer. Moreover, there are probably java-serializable objects you're
using that are not gwt-serializable, meaning that the compile wouldn't
work even if you were allowed to use object in this way.

This is why you should be as specific as possible. This means:
(1) you must use List<Foo> instead of List<Object> - for some
appropriate Foo for your usage
(2) you should prefer ArrayList<Foo> to List<Foo> in the objects you
gwt-serialize and in your RPC service APIs - so GWT doesn't try and
create serialization code for every implementation of List, only the
particular implementations you actually use.

I'm not sure why the naked "List resultList" works. Probably some hang
over from the pre-generics days of GWT. However, the above still applies
and you ought to use generics and be as specific as possible.

HTH
Paul





mwaschkowski wrote:
> Hi,
>
> Quick question about serialization:
>
> If I have something to be serialized with the following type defined:
>
>   private List<Object> resultList
>
> gwt gives me a serialization error, but if I take away the <Object>
> tag:
>
>   private List resultList
>
> it works fine.
>
> I'm a bit worried that I'm breaking a rule somehow, and if things get
> tightened up in a future version, my app might break. Can someone
> please shed a little light on this for me?
>
> Thanks,
>
> Mark
> >
>
>   

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

Reply via email to