Skip to content

Commit 71b8334

Browse files
authored
Merge pull request #5166 from dotty-staging/fix-ide-java9
Fix the IDE always crashing due to an incorrect cast under Java 9+
2 parents 90671f0 + 74fadfe commit 71b8334

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,14 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
119119

120120
private val (zipClassPaths, dirClassPaths) = currentCtx.platform.classPath(currentCtx) match {
121121
case AggregateClassPath(cps) =>
122-
val (zipCps, dirCps) = cps.partition(_.isInstanceOf[ZipArchiveFileLookup[_]])
123-
// This will be wrong if any other subclass of ClassPath is either used,
124-
// like `JrtClassPath` once we get Java 9 support
125-
(zipCps.asInstanceOf[Seq[ZipArchiveFileLookup[_]]], dirCps.asInstanceOf[Seq[JFileDirectoryLookup[_]]])
122+
// FIXME: We shouldn't assume that ClassPath doesn't have other
123+
// subclasses. For now, the only other subclass is JrtClassPath on Java
124+
// 9+, we can safely ignore it for now because it's only used for the
125+
// standard Java library, but this will change once we start supporting
126+
// adding entries to the modulepath.
127+
val zipCps = cps.collect { case cp: ZipArchiveFileLookup[_] => cp }
128+
val dirCps = cps.collect { case cp: JFileDirectoryLookup[_] => cp }
129+
(zipCps, dirCps)
126130
case _ =>
127131
(Seq(), Seq())
128132
}

0 commit comments

Comments
 (0)