特牛网址导航

class type required but T found 获取Scala泛型的Class_scala中获取泛型c的class-CSDN博客

网友收藏
文章浏览阅读2.5k次。问题代码:object Test { def msgHandler[T: Classtag](msg: String){ val clazz = classOf[T]) //获取T的泛型时报错 ... }}代码编译报错class type required but T found那么如何通过泛型T获取到其Class呢import scala...._scala中获取泛型c的class