From 87fd9d580bece0201fe7f6067fdbebec57e3507c Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Tue, 3 Oct 2023 22:05:43 +0900 Subject: [PATCH] use ClassTag instead of Manifest --- cli/src/main/resources/visitor.scala.template | 4 ++-- cli/src/main/scala/scalaxb/compiler/Config.scala | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/src/main/resources/visitor.scala.template b/cli/src/main/resources/visitor.scala.template index 2a24a6dd6..a4d1ad6b4 100644 --- a/cli/src/main/resources/visitor.scala.template +++ b/cli/src/main/resources/visitor.scala.template @@ -1,6 +1,6 @@ package scalaxb -import scala.reflect.Manifest +import scala.reflect.ClassTag /** * Visitor utility for ScalaXB structures. @@ -68,7 +68,7 @@ trait VisitorTrait { /** * Collects all the nodes of a given class. */ - def collect[T](implicit m: Manifest[T]): Seq[T] = + def collect[T](implicit m: ClassTag[T]): Seq[T] = collect(m.runtimeClass.isInstance(_)).asInstanceOf[Seq[T]] diff --git a/cli/src/main/scala/scalaxb/compiler/Config.scala b/cli/src/main/scala/scalaxb/compiler/Config.scala index 6cc1a5099..384cba5fc 100644 --- a/cli/src/main/scala/scalaxb/compiler/Config.scala +++ b/cli/src/main/scala/scalaxb/compiler/Config.scala @@ -24,6 +24,7 @@ package scalaxb.compiler import java.io.File import scala.collection.immutable.{ Map, Set, Seq } +import scala.reflect.ClassTag case class Config(items: Map[String, ConfigEntry]) { import Config._ @@ -87,8 +88,8 @@ case class Config(items: Map[String, ConfigEntry]) { def enumNameMaxLength: Int = (get[EnumNameMaxLength] getOrElse defaultEnumNameMaxLength).value def useLists: Boolean = values contains UseLists - private def get[A <: ConfigEntry: Manifest]: Option[A] = - items.get(implicitly[Manifest[A]].runtimeClass.getName).asInstanceOf[Option[A]] + private def get[A <: ConfigEntry: ClassTag]: Option[A] = + items.get(implicitly[ClassTag[A]].runtimeClass.getName).asInstanceOf[Option[A]] def update(item: ConfigEntry): Config = copy(items = items.updated(item.name, item)) def remove(item: ConfigEntry): Config =