Skip to content

Commit

Permalink
Reduce overhead of workarkaround for Scala 2.11 on JDK9+
Browse files Browse the repository at this point in the history
Calling isDirectory on every reference is pretty excessive!
  • Loading branch information
retronym committed Apr 24, 2020
1 parent 2f1bad9 commit b3f4cf5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,12 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile with
// The dependency comes from a JAR
for {
zip <- zipEntry.underlyingSource
jarFile <- Option(zip.file)
if !jarFile.isDirectory // workaround for JDK9 and Scala 2.10/2.11, see https://github.com/sbt/sbt/pull/3701
} binaryDependency(jarFile.toPath, binaryClassName)
} {
// workaround for JDK9 and Scala 2.10/2.11, see https://github.com/sbt/sbt/pull/3701
val ignore = zip.file == null || (!zip.hasExtension("jar") && zip.isDirectory)
if (!ignore)
binaryDependency(zip.file.toPath, binaryClassName)
}
case pf: xsbt.Compat.PlainNioFile =>
// The dependency comes from a class file
binaryDependency(Paths.get(pf.path), binaryClassName)
Expand Down

0 comments on commit b3f4cf5

Please sign in to comment.