Skip to content

Commit 3c52fa4

Browse files
committed
try exclude packages
1 parent 101ebf8 commit 3c52fa4

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

+7-13
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,8 @@ object DottyPlugin extends AutoPlugin {
554554
* jline terminal. To do so we add the `appConfiguration` loader in
555555
* the parent hierarchy of the scala 3 instance loader.
556556
*
557-
* The [[FilteringClassLoader]] ensures that the JNA, JDK and xsbti
558-
* classes only are loaded from the sbt loader. That is necessary because
559-
* the sbt class loader contains the Scala 2.12 library and compiler
560-
* bridge.
557+
* The [[FilteringClassLoader]] ensures that the classes from the
558+
* Scala 2.12 library and compiler bridge are not loaded.
561559
*/
562560
val topLoader = new FilteringClassLoader(appConfiguration.provider.loader)
563561

@@ -585,18 +583,14 @@ object DottyPlugin extends AutoPlugin {
585583
}
586584

587585
private class FilteringClassLoader(parent: ClassLoader) extends ClassLoader(parent) {
588-
private val prefixes = List(
589-
"xsbti.",
590-
"org.jline.",
591-
"java.",
592-
"sun.",
593-
"jdk.internal.reflect.",
594-
"javax."
586+
private val exludePackages = List(
587+
"scala.",
588+
"xsbt."
595589
)
596590

597591
override def loadClass(name: String, resolve: Boolean): Class[_] = {
598-
if (prefixes.exists(name.startsWith(_))) super.loadClass(name, resolve)
599-
else null
592+
if (exludePackages.exists(name.startsWith(_))) null
593+
else super.loadClass(name, resolve)
600594
}
601595

602596
override def getResource(name: String): URL = {

0 commit comments

Comments
 (0)