File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ object Splicer {
9393 }
9494 }
9595
96+ private val classLoaders = scala.collection.mutable.HashMap .empty[String , URLClassLoader ]
97+
9698 /** Tree interpreter that can interpret calls to static methods with it's default arguments
9799 *
98100 * The interpreter assumes that all calls in the trees are to code that was
@@ -101,8 +103,12 @@ object Splicer {
101103 private class Interpreter (pos : Position )(implicit ctx : Context ) {
102104
103105 private [this ] val classLoader = {
104- val urls = ctx.settings.classpath.value.split(':' ).map(cp => java.nio.file.Paths .get(cp).toUri.toURL)
105- new URLClassLoader (urls, getClass.getClassLoader)
106+ val cp = ctx.settings.classpath.value
107+ def newClassLoader = {
108+ val urls = cp.split(':' ).map(cp => java.nio.file.Paths .get(cp).toUri.toURL)
109+ new URLClassLoader (urls, getClass.getClassLoader)
110+ }
111+ classLoaders.getOrElseUpdate(cp, newClassLoader)
106112 }
107113
108114 /** Returns the interpreted result of interpreting the code a call to the symbol with default arguments.
You can’t perform that action at this time.
0 commit comments