3

我正在尝试在 GWT 中使用编辑器框架,以便我可以让多个编辑器编辑同一个 bean(每个编辑器编辑一个不相交的字段子集)。

这大概是我所拥有的:

class EventEditor implements Editor<MajorEvent> {

    // Dispatch to a sub editor. 
    // Later there will be multiple such sub editors with different types,
    // but all implementing Editor<MajorEvent>.

    @Path("")
    public GenSubEditor genSubEditor() {
        return genPresenter.getView().getSubEditor();
    }
}

public class GenSubEditor implements Editor<MajorEvent> {

    Editor<String> nameEditor() {
        return endDate;
    }
}

这是 GWT 编译器给我的错误:

The type `GenSubEditor` is assignable to the raw Editor type, but a type parameterization is required.

如果我在方法中替换GenSubEditor为,编译器不会抱怨。但是似乎驱动程序生成器没有解析我的子编辑器并且从未找到。所以这不是一个解决方案,或者这意味着我做错了什么。Editor<MajorEvent>genSubEditornameEditor

希望有人可以提供帮助。我没有提供 SSCCE,因为我实际上不知道如何创建存根 gwt 演示者/视图,但如果有人告诉我该怎么做,我会很高兴。

4

1 回答 1

2

我相信这是一个 GWT 错误。GWT 编译器不会读取非静态内部类的泛型类型。在这种情况下,它知道GenSubEditorimplements Editor,但无法读取其MajorEvent参数类型。

尝试做GenSubEditor一个static类。如果您使用任何引用,请记住删除对外部类实例的所有引用。

我将尝试提交有关此问题的错误报告。

于 2014-03-30T03:05:55.867 回答