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 {
93
93
}
94
94
}
95
95
96
+ private val classLoaders = scala.collection.mutable.HashMap .empty[String , URLClassLoader ]
97
+
96
98
/** Tree interpreter that can interpret calls to static methods with it's default arguments
97
99
*
98
100
* The interpreter assumes that all calls in the trees are to code that was
@@ -101,8 +103,12 @@ object Splicer {
101
103
private class Interpreter (pos : Position )(implicit ctx : Context ) {
102
104
103
105
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)
106
112
}
107
113
108
114
/** 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