GWT RPC警告检查所有子类型

时间:2012-08-29 11:58:15

标签: gwt serialization rpc

我有一个gwt应用程序,在编译期间我收到错误:

  

扫描其他依赖项:file:/ D:/projects/healthplanel_trunk/clinics-gwt-client/src/com/clinics/gwt/shared/UserServiceAsync.java      计算'com.clinics.gwt.shared.UserService'的所有可能的重新绑定结果         重新绑定com.clinics.gwt.shared.UserService            调用生成器com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator               为远程服务接口'com.clinics.gwt.shared.UserService'生成客户端代理                  分析'com.clinics.gwt.shared.UserService'以获取可序列化的类型                     分析方法:                        public abstract com.clinics.gwt.shared.query.GQueryResult listAdmins(com.clinics.gwt.shared.query.GQueryParams queryParams)                           参数:com.clinics.gwt.shared.query.GQueryParams queryParams                              com.clinics.gwt.shared.query.GQueryParams                                 验证实例化                                    com.clinics.gwt.shared.query.GQueryParams                                       分析符合序列化条件的'com.clinics.gwt.shared.query.GQueryParams'类型的字段                                          private java.util.List>过滤器                                             的java.util.List>                                                验证实例化                                                   java.util.Vector中>                                                      检查'java.util.Vector>'的参数                                                         检查类型为'java.util.Vector'的类型参数0,因为它直接暴露在此类型或其子类型之一中                                                            com.clinics.gwt.shared.query.GFilterBy                                                               验证实例化                                                                  com.clinics.gwt.shared.query.GFilterBy                                                                     检查'com.clinics.gwt.shared.query.GFilterBy'的参数                                                                        检查类型为'com.clinics.gwt.shared.query.GFilterBy'的类型参数0,因为它直接暴露在此类型或其子类型之一中                                                                           的java.io.Serializable                                                                              验证实例化                                                                                 的java.util.HashMap                                                                                    [WARN]检查符合序列化条件的Object的所有子类型

我的代码是:

public class GQueryParams implements IsSerializable {
private static final long serialVersionUID = 1L;
private int offset = 0;
private int maxCount = -1; // -1 means all
private ArrayList<GOrderBy> orders = new ArrayList<GOrderBy>();
private ArrayList<NoSqlOrderBy> noSqlOrders = new ArrayList<NoSqlOrderBy>();
private ArrayList<GFilterBy<?>> filters = new ArrayList<GFilterBy<?>>();

public class GFilterBy<T extends Serializable> implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private GFilterOperation operation;
private T value;

出了什么问题,请你帮帮我吧?

1 个答案:

答案 0 :(得分:4)

GFilterBy<?>基本上接受所有内容(实现Serializable的所有内容),因此生成器必须扫描每个适用类的整个类路径,并为每个类生成相应的ser / deserialization代码。

这通常不是你想要的,因此警告。

经验法则是在GWT-RPC通过线路发送的类型中始终尽可能具体;并且?显然违反了该规则。