GWTではまった
なんだかちょっと気になってGWTを触ってみたところ、以下のようなエラーが。
[ERROR] Errors in 'transient source for com.ibm.examples.client.ToppingService_Proxy' [ERROR] Line 24: The return type is incompatible with ToppingServiceAsync.getAllToppings(AsyncCallback)
PRCで呼び出される先のインターフェースは以下の通り。
public interface ToppingService extends RemoteService{ public List getAllToppings(); }
で、プロキシのインターフェースを以下のように定義しておいたのだが・・
public interface ToppingServiceAsync extends RemoteService{ public List getAllToppings(AsyncCallback callback); }
いろいろ調べたら、実はgetAllToppingsのreturn typeはvoidである必要があった・・!
public interface ToppingServiceAsync extends RemoteService{ public void getAllToppings(AsyncCallback callback); }
と言うわけで上のようにList→voidに直したらあっさり解決・・orz
クラス名とシグニチャは慎重に形式をあわせる必要があるな・・。同件でハマる人は結構いるんでないかな・・。
以上、覚書。それにしてもGWTすごいね。