Stop using Predef.error

We'd like to remove this from 2.11.0.

This patch should be backported to 0.12.3.
This commit is contained in:
Jason Zaugg 2013-01-28 22:29:48 +01:00
parent d7779ec96e
commit c597b48eda
1 changed files with 5 additions and 5 deletions

View File

@ -8,16 +8,16 @@ package xsbt
object Command object Command
{ {
/** /**
* Construct a CompilerCommand using reflection, to be compatible with Scalac before and after * Construct a CompilerCommand using reflection, to be compatible with Scalac before and after
* <a href="https://lampsvn.epfl.ch/trac/scala/changeset/21274">r21274</a> * <a href="https://lampsvn.epfl.ch/trac/scala/changeset/21274">r21274</a>
*/ */
def apply(arguments: List[String], settings: Settings): CompilerCommand = { def apply(arguments: List[String], settings: Settings): CompilerCommand = {
def constr(params: Class[_]*) = classOf[CompilerCommand].getConstructor(params: _*) def constr(params: Class[_]*) = classOf[CompilerCommand].getConstructor(params: _*)
try { try {
constr(classOf[List[_]], classOf[Settings]).newInstance(arguments, settings) constr(classOf[List[_]], classOf[Settings]).newInstance(arguments, settings)
} catch { } catch {
case e: NoSuchMethodException => case e: NoSuchMethodException =>
constr(classOf[List[_]], classOf[Settings], classOf[Function1[_, _]], classOf[Boolean]).newInstance(arguments, settings, error _, false.asInstanceOf[AnyRef]) constr(classOf[List[_]], classOf[Settings], classOf[Function1[_, _]], classOf[Boolean]).newInstance(arguments, settings, (s: String) => throw new RuntimeException(s), false.asInstanceOf[AnyRef])
} }
} }