Fix warnings in util-collection project

There were warnings because of
- unused pattern match values
- deprecations
- a Xlint bug in scalac
This commit is contained in:
Simon Schäfer 2017-10-18 19:36:48 +02:00
parent 30d59d356d
commit 38f550deef
4 changed files with 8 additions and 6 deletions

View File

@ -229,7 +229,9 @@ private class BasicAttributeMap(private val backing: Map[AttributeKey[_], Any])
}
def entries: Iterable[AttributeEntry[_]] =
for ((k: AttributeKey[kt], v) <- backing) yield AttributeEntry(k, v.asInstanceOf[kt])
backing.collect {
case (k: AttributeKey[kt], v) => AttributeEntry(k, v.asInstanceOf[kt])
}
private[sbt] def setCond[T](k: AttributeKey[T], opt: Option[T]): AttributeMap =
opt match {

View File

@ -41,7 +41,7 @@ object IDSet {
def +=(t: T) = { backing.put(t, Dummy); () }
def ++=(t: Iterable[T]) = t foreach +=
def -=(t: T) = if (backing.remove(t) eq null) false else true
def all = collection.JavaConversions.collectionAsScalaIterable(backing.keySet)
def all = collection.JavaConverters.collectionAsScalaIterable(backing.keySet)
def toList = all.toList
def isEmpty = backing.isEmpty

View File

@ -793,7 +793,7 @@ trait Init[Scope] {
// proper solution is for evaluate to be deprecated or for external use only and a new internal method returning Either be used
private[this] def trapBadRef[A](run: => A): Option[A] =
try Some(run)
catch { case e: InvalidReference => None }
catch { case _: InvalidReference => None }
private[sbt] def processAttributes[B](init: B)(f: (B, AttributeMap) => B): B = a match {
case None => init

View File

@ -16,7 +16,7 @@ object Signals {
try {
val signals = new Signals0
signals.withHandler(signal, handler, action)
} catch { case e: LinkageError => Right(action()) }
} catch { case _: LinkageError => Right(action()) }
result match {
case Left(e) => throw e
@ -61,7 +61,7 @@ object Signals {
try {
val signals = new Signals0
signals.supported(signal)
} catch { case e: LinkageError => false }
} catch { case _: LinkageError => false }
}
// Must only be referenced using a
@ -70,7 +70,7 @@ object Signals {
private final class Signals0 {
def supported(signal: String): Boolean = {
import sun.misc.Signal
try { new Signal(signal); true } catch { case e: IllegalArgumentException => false }
try { new Signal(signal); true } catch { case _: IllegalArgumentException => false }
}
// returns a LinkageError in `action` as Left(t) in order to avoid it being