jeudi 22 janvier 2015

Why function scala.reflect.runtime.universe.classTag[T] is missing?

I'm using apache Spark and one of my subroutine is to check if T: ClassTag of an RDD[T: ClassTag] is a subclass of Map.


I've checked many source on scala reflection and they all suggest the following code:



import scala.reflect.runtime.universe._
if classTag[T] <:< classTag[Map[_,_]] {do something...}


however the classTag function seems to be missing, I only see typeOf and weakTypeOf which obviously doesn't work here (because of type erasure: ClassTag of an RDD carries far less information than a TypeTag). Is it moved somewhere else in a later scala version? I'm using 2.10.4


Thanks a lot!






Aucun commentaire:

Enregistrer un commentaire