How do I remove implementing types from GWT’s Serialization Policy?

Posted by Bluu on Stack Overflow See other posts from Stack Overflow or by Bluu
Published on 2010-01-22T20:04:34Z Indexed on 2010/03/22 3:21 UTC
Read the original article Hit count: 238

Filed under:
|
|

The opposite of this question: http://stackoverflow.com/questions/138099/how-do-i-add-a-type-to-gwts-serialization-policy-whitelist

GWT is adding undesired types to the serialization policy and bloating my JS. How do I trim my GWT whitelist by hand? Or should I at all?

For example, if I put the interface List on a GWT RPC service class, GWT has to generate Javascript that handles ArrayList, LinkedList, Stack, Vector, ... even though my team knows we're only ever going to return an ArrayList. I could just make the method's return type ArrayList, but I like relying on an interface rather than a specific implementation. After all, maybe one day we will switch it up and return e.g. a LinkedList. In that case, I'd like to force the GWT serialization policy to compile for only ArrayList and LinkedList. No Stacks or Vectors.

These implicit restrictions have one huge downside I can think of: a new member of the team starts returning Vectors, which will be a runtime error. So besides the question in the title, what is your experience designing around this?

© Stack Overflow or respective owner

Related posts about gwt

Related posts about java