diff --git a/src/main/scala/higherkindness/rules_scala/workers/common/AnnexScalaInstance.scala b/src/main/scala/higherkindness/rules_scala/workers/common/AnnexScalaInstance.scala index e220ede3..2b846160 100644 --- a/src/main/scala/higherkindness/rules_scala/workers/common/AnnexScalaInstance.scala +++ b/src/main/scala/higherkindness/rules_scala/workers/common/AnnexScalaInstance.scala @@ -8,7 +8,7 @@ import java.util.Properties object AnnexScalaInstance { // Check the comment on ScalaInstanceDualLoader to understand why this is necessary. - private val dualClassLoader: ScalaInstanceDualLoader = { + private def getDualClassLoader(): ScalaInstanceDualLoader = { new ScalaInstanceDualLoader( // Classloader for xsbti classes getClass.getClassLoader, @@ -24,7 +24,7 @@ object AnnexScalaInstance { private def getClassLoader(jars: Array[File]): URLClassLoader = { new URLClassLoader( jars.map(_.toURI.toURL), - dualClassLoader, + getDualClassLoader(), ) } diff --git a/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala b/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala index d850855a..021a7249 100644 --- a/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala +++ b/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala @@ -49,12 +49,6 @@ import xsbti.compile.{AnalysisContents, AnalysisStore, Changes, ClasspathOptions //format: on object ZincRunner extends WorkerMain[Namespace] { - private[this] val classloaderCache = new ClassLoaderCache(new URLClassLoader(Array())) - - private[this] val compilerCache = CompilerCache.fresh - - // prevents GC of the soft reference in classloaderCache - private[this] var lastCompiler: AnyRef = null private[this] def labelToPath(label: String) = Paths.get(label.replaceAll("^/+", "").replaceAll(raw"[^\w/]", "_")) @@ -196,10 +190,13 @@ object ZincRunner extends WorkerMain[Namespace] { ) val compilers = { - val scalaCompiler = ZincUtil - .scalaCompiler(scalaInstance, namespace.get[File]("compiler_bridge")) - .withClassLoaderCache(classloaderCache) - lastCompiler = scalaCompiler + val scalaCompiler = new AnalyzingCompiler( + scalaInstance, + ZincUtil.constantBridgeProvider(scalaInstance, namespace.get[File]("compiler_bridge").toPath()), + ClasspathOptionsUtil.noboot(scalaInstance.version), + _ => (), + None + ) ZincUtil.compilers(scalaInstance, ClasspathOptionsUtil.boot, None, scalaCompiler) } @@ -243,7 +240,7 @@ object ZincRunner extends WorkerMain[Namespace] { lookup, skip, file, - compilerCache, + CompilerCache.fresh, incOptions, reporter, Optional.empty[CompileProgress](),