Skip to content

Commit

Permalink
Merge pull request json4s#295 from seratch/pr165-to-3.3
Browse files Browse the repository at this point in the history
Cherry-pick json4s#165 into 3.3 branch
  • Loading branch information
seratch committed Sep 3, 2015
2 parents 8bd6a50 + f8c9767 commit 0b26325
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/src/main/scala/org/json4s/reflect/ScalaSigReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,10 @@ object ScalaSigReader {
cc map (ccc => (ccc, safeField(ccc)))
}

def resolveClass[X <: AnyRef](c: String, classLoaders: Iterable[ClassLoader] = ClassLoaders): Option[Class[X]] = classLoaders match {
case Nil => sys.error("resolveClass: expected 1+ classloaders but received empty list")
case List(cl) => Some(Class.forName(c, true, cl).asInstanceOf[Class[X]])
case many => {
def resolveClass[X <: AnyRef](c: String, classLoaders: Iterable[ClassLoader] = ClassLoaders): Option[Class[X]] = {
try {
var clazz: Class[_] = null
val iter = many.iterator
val iter = classLoaders.iterator ++ List(Thread.currentThread().getContextClassLoader())
while (clazz == null && iter.hasNext) {
try {
clazz = Class.forName(c, true, iter.next())
Expand All @@ -229,5 +226,4 @@ object ScalaSigReader {
case _: Throwable => None
}
}
}
}

0 comments on commit 0b26325

Please sign in to comment.