mirror of https://github.com/sbt/sbt.git
enable -deprecation for Scala 2.10
Enable -deprecation flag to catch old code being use when we migrate things. In this commit I moved error to sys.error.
This commit is contained in:
parent
672479bbf3
commit
a39e105b1f
|
|
@ -92,7 +92,7 @@ trait Init[Scope] {
|
||||||
* Only the static dependencies are tracked, however. Dependencies on previous values do not introduce a derived setting either.
|
* Only the static dependencies are tracked, however. Dependencies on previous values do not introduce a derived setting either.
|
||||||
*/
|
*/
|
||||||
final def derive[T](s: Setting[T], allowDynamic: Boolean = false, filter: Scope => Boolean = const(true), trigger: AttributeKey[_] => Boolean = const(true), default: Boolean = false): Setting[T] = {
|
final def derive[T](s: Setting[T], allowDynamic: Boolean = false, filter: Scope => Boolean = const(true), trigger: AttributeKey[_] => Boolean = const(true), default: Boolean = false): Setting[T] = {
|
||||||
deriveAllowed(s, allowDynamic) foreach error
|
deriveAllowed(s, allowDynamic) foreach sys.error
|
||||||
val d = new DerivedSetting[T](s.key, s.init, s.pos, filter, trigger)
|
val d = new DerivedSetting[T](s.key, s.init, s.pos, filter, trigger)
|
||||||
if (default) d.default() else d
|
if (default) d.default() else d
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +248,7 @@ trait Init[Scope] {
|
||||||
new Undefined(fakeUndefinedSetting(definingKey, derived), referencedKey)
|
new Undefined(fakeUndefinedSetting(definingKey, derived), referencedKey)
|
||||||
private[this] def fakeUndefinedSetting[T](definingKey: ScopedKey[T], d: Boolean): Setting[T] =
|
private[this] def fakeUndefinedSetting[T](definingKey: ScopedKey[T], d: Boolean): Setting[T] =
|
||||||
{
|
{
|
||||||
val init: Initialize[T] = pure(() => error("Dummy setting for compatibility only."))
|
val init: Initialize[T] = pure(() => sys.error("Dummy setting for compatibility only."))
|
||||||
new Setting(definingKey, init, NoPosition) { override def isDerived = d }
|
new Setting(definingKey, init, NoPosition) { override def isDerived = d }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ final class History private (val lines: IndexedSeq[String], val path: Option[Fil
|
||||||
def all: Seq[String] = lines
|
def all: Seq[String] = lines
|
||||||
def size = lines.length
|
def size = lines.length
|
||||||
def !! : Option[String] = !-(1)
|
def !! : Option[String] = !-(1)
|
||||||
def apply(i: Int): Option[String] = if (0 <= i && i < size) Some(lines(i)) else { error("Invalid history index: " + i); None }
|
def apply(i: Int): Option[String] = if (0 <= i && i < size) Some(lines(i)) else { sys.error("Invalid history index: " + i); None }
|
||||||
def !(i: Int): Option[String] = apply(i)
|
def !(i: Int): Option[String] = apply(i)
|
||||||
|
|
||||||
def !(s: String): Option[String] =
|
def !(s: String): Option[String] =
|
||||||
|
|
@ -27,7 +27,7 @@ final class History private (val lines: IndexedSeq[String], val path: Option[Fil
|
||||||
|
|
||||||
private def nonEmpty[T](s: String)(act: => Option[T]): Option[T] =
|
private def nonEmpty[T](s: String)(act: => Option[T]): Option[T] =
|
||||||
if (s.isEmpty) {
|
if (s.isEmpty) {
|
||||||
error("No action specified to history command")
|
sys.error("No action specified to history command")
|
||||||
None
|
None
|
||||||
} else
|
} else
|
||||||
act
|
act
|
||||||
|
|
@ -37,7 +37,7 @@ final class History private (val lines: IndexedSeq[String], val path: Option[Fil
|
||||||
}
|
}
|
||||||
|
|
||||||
object History {
|
object History {
|
||||||
def apply(lines: Seq[String], path: Option[File], error: String => Unit): History = new History(lines.toIndexedSeq, path, error)
|
def apply(lines: Seq[String], path: Option[File], error: String => Unit): History = new History(lines.toIndexedSeq, path, sys.error)
|
||||||
|
|
||||||
def number(s: String): Option[Int] =
|
def number(s: String): Option[Int] =
|
||||||
try { Some(s.toInt) }
|
try { Some(s.toInt) }
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ object Logic {
|
||||||
if (newlyFalse.nonEmpty)
|
if (newlyFalse.nonEmpty)
|
||||||
newlyFalse
|
newlyFalse
|
||||||
else // should never happen due to the acyclic negation rule
|
else // should never happen due to the acyclic negation rule
|
||||||
error(s"No progress:\n\tclauses: $clauses\n\tpossibly true: $possiblyTrue")
|
sys.error(s"No progress:\n\tclauses: $clauses\n\tpossibly true: $possiblyTrue")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ object LogicTest extends Properties("Logic") {
|
||||||
Logic.reduceAll(badClauses, Set()) match {
|
Logic.reduceAll(badClauses, Set()) match {
|
||||||
case Right(res) => false
|
case Right(res) => false
|
||||||
case Left(err: Logic.CyclicNegation) => true
|
case Left(err: Logic.CyclicNegation) => true
|
||||||
case Left(err) => error(s"Expected cyclic error, got: $err")
|
case Left(err) => sys.error(s"Expected cyclic error, got: $err")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ object LogicTest extends Properties("Logic") {
|
||||||
case Left(err) => false
|
case Left(err) => false
|
||||||
case Right(res) =>
|
case Right(res) =>
|
||||||
val actual = res.provenSet
|
val actual = res.provenSet
|
||||||
(actual == expected) || error(s"Expected to prove $expected, but actually proved $actual")
|
(actual == expected) || sys.error(s"Expected to prove $expected, but actually proved $actual")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ private abstract class AbstractProcessBuilder extends ProcessBuilder with SinkPa
|
||||||
{
|
{
|
||||||
val buffer = new StringBuffer
|
val buffer = new StringBuffer
|
||||||
val code = this ! BasicIO(buffer, log, withIn)
|
val code = this ! BasicIO(buffer, log, withIn)
|
||||||
if (code == 0) buffer.toString else error("Nonzero exit value: " + code)
|
if (code == 0) buffer.toString else sys.error("Nonzero exit value: " + code)
|
||||||
}
|
}
|
||||||
def !! = getString(None, false)
|
def !! = getString(None, false)
|
||||||
def !!(log: ProcessLogger) = getString(Some(log), false)
|
def !!(log: ProcessLogger) = getString(Some(log), false)
|
||||||
|
|
@ -190,7 +190,7 @@ private abstract class BasicProcess extends Process {
|
||||||
|
|
||||||
private abstract class CompoundProcess extends BasicProcess {
|
private abstract class CompoundProcess extends BasicProcess {
|
||||||
def destroy() { destroyer() }
|
def destroy() { destroyer() }
|
||||||
def exitValue() = getExitValue().getOrElse(error("No exit code: process destroyed."))
|
def exitValue() = getExitValue().getOrElse(sys.error("No exit code: process destroyed."))
|
||||||
|
|
||||||
def start() = getExitValue
|
def start() = getExitValue
|
||||||
|
|
||||||
|
|
@ -426,7 +426,7 @@ private object Streamed {
|
||||||
def next(): Stream[T] =
|
def next(): Stream[T] =
|
||||||
q.take match {
|
q.take match {
|
||||||
case Left(0) => Stream.empty
|
case Left(0) => Stream.empty
|
||||||
case Left(code) => if (nonzeroException) error("Nonzero exit code: " + code) else Stream.empty
|
case Left(code) => if (nonzeroException) sys.error("Nonzero exit code: " + code) else Stream.empty
|
||||||
case Right(s) => Stream.cons(s, next)
|
case Right(s) => Stream.cons(s, next)
|
||||||
}
|
}
|
||||||
new Streamed((s: T) => q.put(Right(s)), code => q.put(Left(code)), () => next())
|
new Streamed((s: T) => q.put(Right(s)), code => q.put(Left(code)), () => next())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue