I have an RPC service in GWT that needs to return a List. The List can be filled with various types of objects, all of which are serializable and all of are referenced elsewher
Let me expand on what David Nouls said. The GWT compiler can't read your mind, so when you fail to specify what the return types can be, GWT assumes that it can be anything, and has to do extra work to make sure that can happen on the Javascript client side.
You really should specify what types are able to be returned. There is only upside to doing this--as the compiler will produce more optimized code, rather than generating code to handle '465 genreated units', so your downloads will be faster.
I would suggest creating an empty interface called "BaseResult" and then having the objects you return all implement that that interface.
/**
* Marker interface
*/
public interface BaseResult {
}
Then you specify that the return type of your rpc method is ArrayList:
public interface MyRpcService extends RemoteService {
public ArrayList doRpc();
}
Then make sure your return objects all implement that interface.
public class UserInfo implements BaseResult {}
public class Order implements BaseResult {}
Now the GWT compiler will have a much easier time optimizing for your code.