ClassTag.runtimeClass.isInstance does not work for AnyVal
问题 Working with scala ClassTags I have seen that classTag.runtimeClass.isInstance doesn't work properly when you use it with AnyVal objects. Here is a snippet where you can test it. Any ideas to make this work for AnyVal objects? import scala.reflect.ClassTag import scala.reflect.runtime.{universe => ru} object Test { def extractField[U: ru.TypeTag](json: Map[String, Any], field: String)(implicit classTag: ClassTag[U]): Option[U] = { json.get(field) match { case Some(value) => if(classTag