mirror of https://github.com/sbt/sbt.git
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:
parent
30d59d356d
commit
38f550deef
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue