mirror of https://github.com/sbt/sbt.git
Don't use anonymous URLClassLoaders
This makes debugging a bit easier in the eclipse memory analyzer tool since we get a more specific classloader type than URLClassLoader and by giving the class a meaningful name, we can tell from where it originated.
This commit is contained in:
parent
af9f665649
commit
468334f142
|
|
@ -773,7 +773,7 @@ object Defaults extends BuildCommon {
|
|||
class ScalaLoader extends URLClassLoader(allJars.map(_.toURI.toURL).toArray, libraryLoader)
|
||||
val fullLoader = classLoaderCache.cachedCustomClassloader(
|
||||
allJars.toList,
|
||||
() => new URLClassLoader(allJars.map(_.toURI.toURL).toArray, libraryLoader)
|
||||
() => new ScalaLoader
|
||||
)
|
||||
new ScalaInstance(
|
||||
version,
|
||||
|
|
|
|||
|
|
@ -230,10 +230,12 @@ private[sbt] object ClassLoaders {
|
|||
} else parent
|
||||
}
|
||||
|
||||
private[this] class FlatLoader(classpath: Seq[File], parent: ClassLoader)
|
||||
extends URLClassLoader(classpath.map(_.toURI.toURL).toArray, parent) {
|
||||
override def toString: String =
|
||||
s"FlatClassLoader(parent = $interfaceLoader, jars =\n${classpath.mkString("\n")}\n)"
|
||||
}
|
||||
// helper methods
|
||||
private def flatLoader(classpath: Seq[File], parent: ClassLoader): ClassLoader =
|
||||
new URLClassLoader(classpath.map(_.toURI.toURL).toArray, parent) {
|
||||
override def toString: String =
|
||||
s"FlatClassLoader(parent = $interfaceLoader, jars =\n${classpath.mkString("\n")}\n)"
|
||||
}
|
||||
new FlatLoader(classpath, parent)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue