【发布时间】:2014-02-23 18:23:59
【问题描述】:
我的java 在interface 中有以下层次结构
public interface Identifiable<T extends Comparable<T>> extends Serializable {
public T getId();
}
public interface Function extends Identifiable {
public String getId();
}
public abstract class Adapter implements Function {
public abstract String getId();
}
当我尝试在scala 中实现Adapter 时,如下所示
class MultiGetFunction extends Adapter {
def getId() : String = this.getClass.getName
}
我收到以下错误
Multiple markers at this line
- overriding method getId in trait Identifiable of type ()T; method getId has incompatible
type
- overrides Adapter.getId
- implements Function.getId
- implements Identifiable.getId
【问题讨论】:
-
stackoverflow.com/q/5279149/1296806 包括经典的 paulp 响应。
标签: java scala generics scala-java-interop