GWT プロジェクトでいくつかの関数フックを提供しようとしています。
private TextBox hello = new TextBox();
private void helloMethod(String from) { hello.setText(from); }
private native void publish() /*-{
$wnd.setText = $entry(this.@com.example.my.Class::helloMethod(Ljava/lang/String;));
}-*/;
publish()
で呼び出されonModuleLoad()
ます。しかし、これは機能せず、開発コンソールで理由に関するフィードバックを提供しません。私も試しました:
private native void publish() /*-{
$wnd.setText = function(from) {
alert(from);
this.@com.example.my.Class::helloMethod(Ljava/lang/String;)(from);
}
}-*/;
これはjava.lang.ClassCastException
FireBug コンソールでa を投げますが、問題alert
なく発火します。提案?