Skip to content

Commit

Permalink
Merge pull request #608 from xuwei-k/ClassTag-Manifest
Browse files Browse the repository at this point in the history
use `ClassTag` instead of `Manifest`
  • Loading branch information
eed3si9n authored Oct 4, 2023
2 parents eadcf3e + 87fd9d5 commit 55af826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cli/src/main/resources/visitor.scala.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scalaxb

import scala.reflect.Manifest
import scala.reflect.ClassTag

/**
* Visitor utility for ScalaXB structures.
Expand Down Expand Up @@ -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]]


Expand Down
5 changes: 3 additions & 2 deletions cli/src/main/scala/scalaxb/compiler/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down Expand Up @@ -88,8 +89,8 @@ case class Config(items: Map[String, ConfigEntry]) {
def useLists: Boolean = values contains UseLists
def jaxbPackage = get[JaxbPackage] getOrElse defaultJaxbPackage

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 =
Expand Down

0 comments on commit 55af826

Please sign in to comment.