3
的发电机我有接口答:GWT类继承接口
public interface A{
String someMethod();
}
并采用GWT.create(的A.class)我得到实现此接口的瞬间。
但是,如果我创建接口B();
public interface B extends A{
String someOtherMethod();
}
并做GWT.create(B.class)我得到B接口的实现,但没有实现A接口方法。
并获得编译错误:
[错误] 3号线:类型B_impl必须实现抽象方法A.someMethod()
附加: 后来我才发现,可它与连接注释。
所以我有:
public interface annotationHelperClass{
}
有:
public final class annotationHelperClassGenerator{
//Some code
}
注释:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
String someParam();
}
这样一个接口将是:
public interface A extends annotationHelperClass{
@MyAnnotation(someParam = "Some string")
String someMethod();
}
接口B:
public interface B extends A{
@MyAnnotation(someParam = "Some another string")
String someOtherMethod();
}
GWT.create(B.class)允许你创建一个接口? –
不,它允许我创建此接口的即时,但仅限于在B接口中声明的方法。 –
可能是Annotations中的原因,我使用接口A中的注释来帮助我生成实现类,但注释不会继承到B接口,所以GWT无法正确生成该方法! –