Scala WartRemover with java.io.Serializable

454 views Asked by At

I just hit a nasty bug where I had, essentially,

sealed trait T extends Product with Serializable
case object O extends T
val mistake = List("foo", "bar", O /* forgot O.toString */)

So scala went ahead and inferred List[java.io.Serializable] for this list, since String is not scala.Serializable, but is java.io.Serializable, and T is scala.Serializable which extends java.io.Serializable. I typically rely on WartRemover to catch such mistakes, but in this case it didn't. Apparently it only complains about inferring scala.Serializable. Is there any reason to not have the wart also warn about java.io.Serializable?

0

There are 0 answers