Improve toString for flat classloader

It can be helpful to see what jars are available to the underlying url
classloader as well as what the parent classloader is.
This commit is contained in:
Ethan Atkins 2019-04-07 14:54:11 -07:00
parent b40084f6fd
commit c9aec02d05
1 changed files with 4 additions and 1 deletions

View File

@ -198,7 +198,10 @@ private[sbt] object ClassLoaders {
// helper methods
private def flatLoader(classpath: Seq[File], parent: ClassLoader): ClassLoader =
new URLClassLoader(classpath.map(_.toURI.toURL).toArray, parent)
new URLClassLoader(classpath.map(_.toURI.toURL).toArray, parent) {
override def toString: String =
s"FlatClassLoader(parent = $interfaceLoader, jars =\n${classpath.mkString("\n")}\n)"
}
}