Skip to content

Commit

Permalink
Fix some more deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Oct 19, 2024
1 parent 1f63557 commit 2a4d78d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(" -> ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 2a4d78d

Please sign in to comment.