From aac97476ce70b3e70ae124d90de1942ff2f79a90 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 1 Nov 2017 13:36:23 +1000 Subject: [PATCH] Refactor createBootClasspath to avoid work when sun.boot.class.path is present --- .../scala/sbt/compiler/CompilerArguments.scala | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/compile/src/main/scala/sbt/compiler/CompilerArguments.scala b/compile/src/main/scala/sbt/compiler/CompilerArguments.scala index e3916fcb9..6a2a41056 100644 --- a/compile/src/main/scala/sbt/compiler/CompilerArguments.scala +++ b/compile/src/main/scala/sbt/compiler/CompilerArguments.scala @@ -45,13 +45,14 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs /** Add the correct Scala library jar to the boot classpath if `addLibrary` is true.*/ def createBootClasspath(addLibrary: Boolean) = { - def findBoot: String = { - import scala.collection.JavaConverters._ - System.getProperties.asScala.iterator.collectFirst { - case (k, v) if k.endsWith(".boot.class.path") => v - }.getOrElse("") - } - val originalBoot = System.getProperty("sun.boot.class.path", findBoot) + def findBoot: String = + { + import scala.collection.JavaConverters._ + System.getProperties.asScala.iterator.collectFirst { + case (k, v) if k.endsWith(".boot.class.path") => v + }.getOrElse("") + } + val originalBoot = Option(System.getProperty("sun.boot.class.path")).getOrElse(findBoot) if (addLibrary) { val newBootPrefix = if (originalBoot.isEmpty) "" else originalBoot + File.pathSeparator newBootPrefix + scalaInstance.libraryJar.getAbsolutePath