Spark - 功能警告

时间:2016-06-19 00:37:11

标签: scala apache-spark warnings

我正在研究Spark in Action中的示例,并且有一个关于Scala中隐式转换的示例,代码如下:

class ClassOne[T](val input: T) { }

class ClassOneStr(val one: ClassOne[String]) {
    def duplicatedString() = one.input + one.input
}
class ClassOneInt(val one: ClassOne[Int]) {
    def duplicatedInt() = one.input.toString + one.input.toString
}
implicit def toStrMethods(one: ClassOne[String]) = new ClassOneStr(one)
implicit def toIntMethods(one: ClassOne[Int]) = new ClassOneInt(one)

我将这些行输入到spark shell中,但是在每个隐式defs之后我都会收到这样的警告:

warning: there were 1 feature warning(s); re-run with -feature for details 

它似乎仍有效,但警告意味着什么?

1 个答案:

答案 0 :(得分:2)

你必须添加

scalacOptions += "-feature"
如果您的sbt控制台正在运行(或重新启动),请

build.sbt并执行reload

如上所述herehere