diff --git a/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala b/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala index edbc7c3da..28f560a00 100644 --- a/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala +++ b/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala @@ -39,13 +39,13 @@ import Constants._ private[sbt] object Parser { def apply(file: Path, log: Logger): ClassFile = - Using.bufferedInputStream(Files.newInputStream(file))(parse(file.toString, log)).right.get + Using.bufferedInputStream(Files.newInputStream(file))(parse(file.toString, log)).toOption.get def apply(file: File, log: Logger): ClassFile = - Using.fileInputStream(file)(parse(file.toString, log)).right.get + Using.fileInputStream(file)(parse(file.toString, log)).toOption.get def apply(url: URL, log: Logger): ClassFile = - usingUrlInputStreamWithoutCaching(url)(parse(url.toString, log)).right.get + usingUrlInputStreamWithoutCaching(url)(parse(url.toString, log)).toOption.get // JarURLConnection with caching enabled will never close the jar private val usingUrlInputStreamWithoutCaching = Using.resource((u: URL) => diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala index 61f376182..86e74afaa 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala @@ -36,7 +36,7 @@ object ReflectUtilities { else clazz :: ancestry(clazz.getSuperclass); def fields(clazz: Class[?]) = - mutable.OpenHashMap(ancestry(clazz).flatMap(_.getDeclaredFields).map(f => (f.getName, f)): _*) + mutable.AnyRefMap(ancestry(clazz).flatMap(_.getDeclaredFields).map(f => (f.getName, f)): _*) /** * Collects all `val`s of type `T` defined on value `self`. diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClassLoaders.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClassLoaders.scala index 3074c2d23..fde68b471 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClassLoaders.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClassLoaders.scala @@ -191,8 +191,8 @@ trait NativeCopyLoader extends ClassLoader { private[this] def findLibrary0(name: String): String = { val mappedName = System.mapLibraryName(name) - val explicit = explicitLibraries.toIterator.filter(_.getFileName.toString == mappedName) - val search = searchPaths.toIterator flatMap relativeLibrary(mappedName) + val explicit = explicitLibraries.iterator.filter(_.getFileName.toString == mappedName) + val search = searchPaths.iterator flatMap relativeLibrary(mappedName) val combined = explicit ++ search if (combined.hasNext) copy(combined.next()) else null } diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala index b8021a66b..f992ee7fb 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/Compilations.scala @@ -30,7 +30,7 @@ trait Compilations extends ReadCompilations { object Compilations { val empty: Compilations = new MCompilations(Seq.empty) def of(s: Seq[Compilation]): Compilations = new MCompilations(s) - def merge(s: Traversable[Compilations]): Compilations = + def merge(s: Iterable[Compilations]): Compilations = of((s flatMap { _.allCompilations }).toSeq.distinct) } diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/FormatCommons.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/FormatCommons.scala index eef736e0a..20d28cd06 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/FormatCommons.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/FormatCommons.scala @@ -155,7 +155,7 @@ trait FormatCommons { protected def readMappedPairs[K, V]( in: BufferedReader - )(expectedHeader: String, s2k: String => K, s2v: (K, String) => V): Traversable[(K, V)] = { + )(expectedHeader: String, s2k: String => K, s2v: (K, String) => V): Iterable[(K, V)] = { def toPair(s: String): (K, V) = { if (s == null) throw new EOFException val p = s.indexOf(" -> ") diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/RelationsTextFormat.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/RelationsTextFormat.scala index eae0ced88..495b31008 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/RelationsTextFormat.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/RelationsTextFormat.scala @@ -82,7 +82,7 @@ trait RelationsTextFormat extends FormatCommons { def read(in: BufferedReader): Relations = { def readRelation[A, B](relDesc: Descriptor[A, B]): Map[A, Set[B]] = { import relDesc._ - val items = readPairs(in)(header, keyMapper.read, valueMapper.read).toIterator + val items = readPairs(in)(header, keyMapper.read, valueMapper.read).iterator // Reconstruct the multi-map efficiently, using the writing strategy above val builder = Map.newBuilder[A, Set[B]] var currentKey = null.asInstanceOf[A]