2

I am working through the examples in Spark in Action, and there was an example about implicit conversions in Scala, with code like this:

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)

I input these lines into the spark shell, but after each of the implicit defs I get a warning like this:

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

It still seems to work, but what does the warning mean?

gsamaras
  • 71,951
  • 46
  • 188
  • 305
b_pcakes
  • 2,452
  • 3
  • 28
  • 45

1 Answers1

2

You have to add

scalacOptions += "-feature"

to your build.sbt and execute reload if your sbt console is running (or restart it).

as mentioned here and here.

Community
  • 1
  • 1
gsamaras
  • 71,951
  • 46
  • 188
  • 305