【发布时间】:2018-03-21 16:46:30
【问题描述】:
这是一个棘手的问题 - 我有一个我想在 scala 中实现的 java 接口:
public interface Foo {
public void bar(scala.Array arr);
}
甚至可以在 scala 中实现吗?当我尝试时:
class FooImpl extends Foo {
override def bar(arr: Array[_]): Unit = ???
}
我明白了:
Error:(13, 7) class FooImpl needs to be abstract, since method bar
in trait Foo of type (x$1: Array)Unit is not defined
(Note that Array does not match Array[_]. To implement a raw type, use
Array[_])
class FooImpl extends Foo {
【问题讨论】:
标签: java scala scala-java-interop