Added parent classloader to interpreter
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@6774 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
0b27ae1b7e
commit
3d250c4dad
|
@ -88,8 +88,13 @@ class Interpreter(val compiler: Global, output: (String => Unit)) {
|
|||
shadow the old ones, and old code objects to refer to the old
|
||||
definitions.
|
||||
*/
|
||||
private val classLoader = new java.net.URLClassLoader(Predef.Array(classfilePath.toURL))
|
||||
|
||||
private val classLoader = {
|
||||
if (parentClassLoader == null)
|
||||
new java.net.URLClassLoader(Predef.Array(classfilePath.toURL))
|
||||
else
|
||||
new java.net.URLClassLoader(Predef.Array(classfilePath.toURL), parentClassLoader)
|
||||
}
|
||||
protected def parentClassLoader : ClassLoader = null;
|
||||
|
||||
/** the previous requests this interpreter has processed */
|
||||
private val prevRequests = new ArrayBuffer[Request]()
|
||||
|
|
|
@ -108,7 +108,7 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
|
|||
interpretOne(line)
|
||||
true
|
||||
}
|
||||
|
||||
def parentClassLoader0 : ClassLoader = null;
|
||||
|
||||
/** process command-line arguments and do as they request */
|
||||
def main(args: Array[String]): unit = {
|
||||
|
@ -121,7 +121,9 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
|
|||
}
|
||||
|
||||
val compiler = new Global(command.settings, reporter)
|
||||
interpreter = new Interpreter(compiler, str=>Console.print(str))
|
||||
interpreter = new Interpreter(compiler, out.print) {
|
||||
override protected def parentClassLoader = parentClassLoader0;
|
||||
}
|
||||
|
||||
try {
|
||||
if(!command.files.isEmpty) {
|
||||
|
|
Loading…
Reference in New Issue