blob: 20e2d5d3f457381d28cd1188eccedf50adaecf14 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package cbt
import java.net._
import scala.util.Try
case class URLClassLoader( classPath: ClassPath, parent: ClassLoader )( implicit val logger: Logger )
extends java.net.URLClassLoader(
classPath.strings.map( p => new URL("file:" ++ p) ).toArray,
parent
) with CachingClassLoader{
override def toString = (
scala.Console.BLUE
++ super.toString
++ scala.Console.RESET
++ "(\n"
++ (
getURLs.map(_.toString).sorted.mkString(",\n")
++ (
if(getParent() != ClassLoader.getSystemClassLoader())
",\n" ++ getParent().toString
else ""
)
).split("\n").map(" "++_).mkString("\n")
++ "\n)"
)
}
/*
trait ClassLoaderLogging extends ClassLoader{
def logger: Logger
val prefix = s"[${getClass.getSimpleName}] "
val postfix = " in \name" ++ this.toString
override def loadClass(name: String, resolve: Boolean): Class[_] = {
//logger.resolver(prefix ++ s"loadClass($name, $resolve)" ++ postfix )
super.loadClass(name, resolve)
}
override def loadClass(name: String): Class[_] = {
//logger.resolver(prefix ++ s"loadClass($name)" ++ postfix )
super.loadClass(name)
}
override def findClass(name: String): Class[_] = {
//logger.resolver(prefix ++ s"findClass($name)" ++ postfix )
super.findClass(name)
}
}
*/
|