0

LeafValueEditor<int[]>次のようなインターフェースを実装するエディターを作成するとします。

class MyEditor implements LeafValueEditor<int[]> {
    @Override
    public void setValue(@NotNull int[] value) {

    }

    @NotNull
    @Override
    public int[] getValue() {
        return new int[0];
    }
}

GWT 2.4 をまだ使用している場合、上記のコードは実行時に NPE で失敗します。

Generator 'com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator' threw an exception while rebinding 'HERE IS YOUR DRIVER CLASS' java.lang.NullPointerException: null
at com.google.gwt.editor.rebind.model.EditorModel.findBeanPropertyMethods(EditorModel.java:509)
at com.google.gwt.editor.rebind.model.EditorModel.createEditorData(EditorModel.java:407)
at com.google.gwt.editor.rebind.model.EditorModel.calculateEditorData(EditorModel.java:345)
at com.google.gwt.editor.rebind.model.EditorModel.<init>(EditorModel.java:237)

GWT 2.5 では、状況は少し改善されています。エディター フレームワークは、ドライバーの説明にそのような配列引数を持つエディターを無視します。このリリースで GWT チームが問題を解決するのではなく、無視することにしたのはなぜですか?

のソースコードを調べEditorModelたところ、その場合、JArrayType サポートを実装するのはそれほど難しくないようです。しかし、配列をラップするための定型クラスを作成したり、Java コレクションを使用したりする必要があるため、これは本当に厄介な問題です。

4

0 に答える 0