我正在研究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
它似乎仍有效,但警告意味着什么?