我有一個GWT aplication,編譯時出現錯誤:GWT RPC警告檢查所有亞型
Scanning for additional dependencies: file:/D:/projects/healthplanel_trunk/clinics-gwt-client/src/com/clinics/gwt/shared/UserServiceAsync.java Computing all possible rebind results for 'com.clinics.gwt.shared.UserService' Rebinding com.clinics.gwt.shared.UserService Invoking generator com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator Generating client proxy for remote service interface 'com.clinics.gwt.shared.UserService' Analyzing 'com.clinics.gwt.shared.UserService' for serializable types Analyzing methods: public abstract com.clinics.gwt.shared.query.GQueryResult listAdmins(com.clinics.gwt.shared.query.GQueryParams queryParams) Parameter: com.clinics.gwt.shared.query.GQueryParams queryParams com.clinics.gwt.shared.query.GQueryParams Verifying instantiability com.clinics.gwt.shared.query.GQueryParams Analyzing the fields of type 'com.clinics.gwt.shared.query.GQueryParams' that qualify for serialization private java.util.List> filters java.util.List> Verifying instantiability java.util.Vector> Checking parameters of 'java.util.Vector>' Checking type argument 0 of type 'java.util.Vector' because it is directly exposed in this type or in one of its subtypes com.clinics.gwt.shared.query.GFilterBy Verifying instantiability com.clinics.gwt.shared.query.GFilterBy Checking parameters of 'com.clinics.gwt.shared.query.GFilterBy' Checking type argument 0 of type 'com.clinics.gwt.shared.query.GFilterBy' because it is directly exposed in this type or in one of its subtypes java.io.Serializable Verifying instantiability java.util.HashMap [WARN] Checking all subtypes of Object which qualify for serialization
我的代碼是:
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;
什麼錯了,你能幫我一下嗎?
非常感謝您的回答。但是,如果我使用「GFilterBy」和「GFilterBy 」中的一類?我應該在這種情況下使用哪種通用類型? –
Andrew
你最好重構你的代碼,這樣你就不需要'instanceof'處理值(例如增加2場的非通用'GFilterBy'類:'字符串strValue的;布爾boolValue',可能添加一個字段說服力您要使用的值字段,或在各值字段檢查'null'),或者至少限制'instanceof'使用到自己的類(即做一個'GFilterByString'和'GFilterByBoolean',使'GFilterBy'抽象類);沿着這些線...... –
好吧,我明白了。非常感謝你! – Andrew