Consider this tiny snippet:
scala> val u = true.asInstanceOf[Serializable]
java.lang.ClassCastException: java.lang.Boolean cannot be cast to scala.Serializable
Well that is a bit of a surprise.. The motivation is to support a modest range of classes - both primitives and custom classes (which do explicitly `extends Serializable).
So then what is the way to handle automatic serialization of these primitives?
java.lang.Boolean is not scala.Serializable. It is however java.io.Serializable:
scala> val u = true.asInstanceOf[java.io.Serializable]
u: java.io.Serializable = true
See http://www.scala-lang.org/api/2.11.8/#scala.Serializable for information about scala.Serializable which seem to indicate some kind of cross platform serialization between JVM and .NET.