试图从这个 SO question编译一些代码并遇到这个错误消息cannot find class manifest for element type T
。这是另一个显示行为的片段:
scala> def f[T](a:T, b:T):Array[T] = { new Array[T](2) }
<console>:4: error: cannot find class manifest for element type T
def f[T](a:T, b:T):Array[T] = { new Array[T](2) }
我可以看到new collection.mutable.GenericArray[T](2)
解决了这个问题。显然提供清单是另一种选择......但是“提供清单意味着”是什么?