diff options
99 files changed, 336 insertions, 346 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 77b55e288c..0e52e867ca 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -75,7 +75,7 @@ object Actor extends Combinators { private[actors] def rawSelf(sched: IScheduler): ReplyReactor = { val s = tl.get if (s eq null) { - val r = new ActorProxy(currentThread, sched) + val r = new ActorProxy(Thread.currentThread, sched) tl.set(r) r } else @@ -98,7 +98,7 @@ object Actor extends Combinators { def resetProxy { val a = tl.get if ((null ne a) && a.isInstanceOf[ActorProxy]) - tl.set(new ActorProxy(currentThread, parentScheduler)) + tl.set(new ActorProxy(Thread.currentThread, parentScheduler)) } /** @@ -543,7 +543,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu received = Some(TIMEOUT) senders = this :: senders } else - error("unhandled timeout") + system.error("unhandled timeout") } var done = false diff --git a/src/actors/scala/actors/ActorTask.scala b/src/actors/scala/actors/ActorTask.scala index 66c47f65a5..fd6c1f71ed 100644 --- a/src/actors/scala/actors/ActorTask.scala +++ b/src/actors/scala/actors/ActorTask.scala @@ -37,7 +37,7 @@ private[actors] class ActorTask(actor: Actor, val uncaught = UncaughtException(actor, if (msg != null) Some(msg) else None, senderInfo, - currentThread, + Thread.currentThread, e) val todo = actor.synchronized { diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala index ad5d83e911..d41d2ea9e8 100644 --- a/src/actors/scala/actors/Scheduler.scala +++ b/src/actors/scala/actors/Scheduler.scala @@ -45,7 +45,7 @@ object Scheduler extends DelegatingScheduler { if (sched.isInstanceOf[ForkJoinScheduler]) { sched.asInstanceOf[ForkJoinScheduler].snapshot() } else - error("scheduler does not implement snapshot") + system.error("scheduler does not implement snapshot") } /* Only <code>ForkJoinScheduler</code> implements this method. @@ -55,7 +55,7 @@ object Scheduler extends DelegatingScheduler { if (sched.isInstanceOf[ForkJoinScheduler]) { sched.asInstanceOf[ForkJoinScheduler].restart() } else - error("scheduler does not implement restart") + system.error("scheduler does not implement restart") } } diff --git a/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala b/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala index 4aaef16661..c31026c3e8 100644 --- a/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala +++ b/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala @@ -160,9 +160,9 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean def restart() { synchronized { if (!snapshoting) - error("snapshot has not been invoked") + system.error("snapshot has not been invoked") else if (isActive) - error("scheduler is still active") + system.error("scheduler is still active") else snapshoting = false diff --git a/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala b/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala index 89df10e19c..575a2698e5 100644 --- a/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala +++ b/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala @@ -181,9 +181,9 @@ class ResizableThreadPoolScheduler(protected val terminate: Boolean, def restart() { synchronized { if (!suspending) - error("snapshot has not been invoked") + system.error("snapshot has not been invoked") else if (isActive) - error("scheduler is still active") + system.error("scheduler is still active") else suspending = false diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala index 8c8363a321..98e6098f89 100644 --- a/src/compiler/scala/tools/ant/FastScalac.scala +++ b/src/compiler/scala/tools/ant/FastScalac.scala @@ -99,16 +99,16 @@ class FastScalac extends Scalac { val args = (cmdOptions ::: (sourceFiles map (_.toString))).toArray try { if (scala.tools.nsc.CompileClient.main0(args) > 0 && failonerror) - error("Compile failed; see the compiler error output for details.") + buildError("Compile failed; see the compiler error output for details.") } catch { case exception: Throwable if (exception.getMessage ne null) => exception.printStackTrace() - error("Compile failed because of an internal compiler error (" + + buildError("Compile failed because of an internal compiler error (" + exception.getMessage + "); see the error output for details.") case exception => exception.printStackTrace() - error("Compile failed because of an internal compiler error " + + buildError("Compile failed because of an internal compiler error " + "(no error message provided); see the error output for details.") } } diff --git a/src/compiler/scala/tools/ant/Pack200Task.scala b/src/compiler/scala/tools/ant/Pack200Task.scala index 12a8706a1c..c15e1f04f5 100644 --- a/src/compiler/scala/tools/ant/Pack200Task.scala +++ b/src/compiler/scala/tools/ant/Pack200Task.scala @@ -16,7 +16,6 @@ import java.util.jar.{JarFile, JarInputStream, JarOutputStream, Pack200} import java.util.jar.Pack200.Packer._ import org.apache.tools.ant.{BuildException, DirectoryScanner} -import org.apache.tools.ant.taskdefs.MatchingTask import org.apache.tools.ant.types.FileSet /** <p> @@ -34,7 +33,7 @@ import org.apache.tools.ant.types.FileSet * * @author James Matlik */ -class Pack200Task extends MatchingTask { +class Pack200Task extends ScalaMatchingTask { /*============================================================================*\ ** Ant user-properties ** @@ -58,13 +57,13 @@ class Pack200Task extends MatchingTask { def setDir(dir: File) { if (dir.exists && dir.isDirectory) srcdir = Some(dir) - else error("Please specify a valid directory with Jar files for packing.") + else buildError("Please specify a valid directory with Jar files for packing.") } /** A level from 0 (none) to 9 (max) of effort for applying Pack200 */ def setEffort(x: Int) { if (effort < 10 && effort > -1) effort = x - else error("The effort level must be a value from 0 to 9") + else buildError("The effort level must be a value from 0 to 9") } /** Set the flag to specify if file reordering should be performed. Reordering @@ -89,7 +88,7 @@ class Pack200Task extends MatchingTask { /** Set the output directory */ def setDestdir(file: File) { if (file != null && file.exists && file.isDirectory) destdir = Some(file) - else error("The destination directory is invalid: " + file.getAbsolutePath) + else buildError("The destination directory is invalid: " + file.getAbsolutePath) } def setSuffix(s: String) { packFileSuffix = s } @@ -117,13 +116,6 @@ class Pack200Task extends MatchingTask { ** Compilation and support methods ** \*============================================================================*/ -/** Generates a build error. Error location will be the current task in the - * ant file. - * @param message A message describing the error. - * @throws BuildException A build error exception thrown in every case. */ - private def error(message: String): Nothing = - throw new BuildException(message, getLocation()) - private def makeJarOutputStream(file: File) = new JarOutputStream(makeOutputStream(file)) @@ -137,13 +129,13 @@ class Pack200Task extends MatchingTask { /** Performs the tool creation. */ override def execute() = { // Audits - val packDir = destdir.getOrElse(error("No output directory specified")) + val packDir = destdir.getOrElse(buildError("No output directory specified")) // Setup the inherited fileset for further processing fileset.setDir(srcdir.getOrElse(getProject.getBaseDir)) val files = getFileList - if (files.isEmpty) error("No JAR files were selected for packing.") + if (files.isEmpty) buildError("No JAR files were selected for packing.") // Setup the packer val packer = Pack200.newPacker diff --git a/src/compiler/scala/tools/ant/Same.scala b/src/compiler/scala/tools/ant/Same.scala index 2ed0395cfa..2c68e12ba8 100644 --- a/src/compiler/scala/tools/ant/Same.scala +++ b/src/compiler/scala/tools/ant/Same.scala @@ -12,7 +12,6 @@ package scala.tools.ant import java.io.{File, FileInputStream} import org.apache.tools.ant.{BuildException, Project} -import org.apache.tools.ant.taskdefs.MatchingTask import org.apache.tools.ant.util.{FileNameMapper, IdentityMapper} import org.apache.tools.ant.types.Mapper @@ -32,7 +31,7 @@ import org.apache.tools.ant.types.Mapper * * @author Gilles Dubochet * @version 1.0 */ -class Same extends MatchingTask { +class Same extends ScalaMatchingTask { /*============================================================================*\ ** Ant user-properties ** \*============================================================================*/ @@ -91,8 +90,8 @@ class Same extends MatchingTask { /** Tests if all mandatory attributes are set and valid. */ private def validateAttributes = { - if (origin.isEmpty) error("Mandatory attribute 'dir' is not set.") - if (destination.isEmpty) error("Mandatory attribute 'todir' is not set.") + if (origin.isEmpty) system.error("Mandatory attribute 'dir' is not set.") + if (destination.isEmpty) system.error("Mandatory attribute 'todir' is not set.") } private def reportDiff(f1: File, f2: File) = { @@ -151,7 +150,7 @@ class Same extends MatchingTask { } if (!allEqualNow) if (failing) - error("There were differences between '" + origin.get + "' and '" + destination.get + "'") + system.error("There were differences between '" + origin.get + "' and '" + destination.get + "'") else log("There were differences between '" + origin.get + "' and '" + destination.get + "'") else { diff --git a/src/compiler/scala/tools/ant/ScalaBazaar.scala b/src/compiler/scala/tools/ant/ScalaBazaar.scala index 1c1b0ccb46..f35ebc44d5 100644 --- a/src/compiler/scala/tools/ant/ScalaBazaar.scala +++ b/src/compiler/scala/tools/ant/ScalaBazaar.scala @@ -52,7 +52,7 @@ package scala.tools.ant { * </ul> * * @author Gilles Dubochet */ - class ScalaBazaar extends Task { + class ScalaBazaar extends Task with ScalaTask { /** The unique Ant file utilities instance to use in this task. */ private val fileUtils = FileUtils.getFileUtils() @@ -161,10 +161,10 @@ package scala.tools.ant { def addConfiguredLooseset(set: LooseFileSet) = { Pair(set.destination, set.fileset) match { case Pair(None, _) => - error("destination not specified for a loose file set") + buildError("destination not specified for a loose file set") case Pair(_, None) => - error("no files specified for a loose file set") + buildError("no files specified for a loose file set") case Pair(Some(dest), Some(fileset)) => fileSetsMap.update(dest, fileset) @@ -178,19 +178,19 @@ package scala.tools.ant { /** Gets the value of the file attribute in a Scala-friendly form. * @return The file as a file. */ private def getName: String = - if (name.isEmpty) error("Name attribute must be defined first.") + if (name.isEmpty) buildError("Name attribute must be defined first.") else name.get /** Gets the value of the file attribute in a Scala-friendly form. * @return The file as a file. */ private def getFile: File = - if (file.isEmpty) error("Member 'file' is empty.") + if (file.isEmpty) buildError("Member 'file' is empty.") else getProject().resolveFile(file.get.toString()) /** Gets the value of the adfile attribute in a Scala-friendly form. * @return The adfile as a file. */ private def getAdfile: File = - if (adfile.isEmpty) error("Member 'adfile' is empty.") + if (adfile.isEmpty) buildError("Member 'adfile' is empty.") else getProject().resolveFile(adfile.get.toString()) /******************************************************************************\ @@ -223,16 +223,9 @@ package scala.tools.ant { file } - /** Generates a build error. Error location will be the current task in the - * ant file. - * @param message A message describing the error. - * @throws BuildException A build error exception thrown in every case. */ - private def error(message: String): Nothing = - throw new BuildException(message, getLocation()) - private def writeFile(file: File, content: String) = if (file.exists() && !file.canWrite()) - error("File " + file + " is not writable") + buildError("File " + file + " is not writable") else { val writer = new FileWriter(file, false) writer.write(content) @@ -246,9 +239,9 @@ package scala.tools.ant { /** Performs the compilation. */ override def execute() = { // Tests if all mandatory attributes are set and valid. - if (file.isEmpty) error("Attribute 'file' is not set.") - if (name.isEmpty) error("Attribute 'name' is not set.") - if (version.isEmpty) error("Attribute 'version' is not set.") + if (file.isEmpty) buildError("Attribute 'file' is not set.") + if (name.isEmpty) buildError("Attribute 'name' is not set.") + if (version.isEmpty) buildError("Attribute 'version' is not set.") val pack = { <package> diff --git a/src/compiler/scala/tools/ant/ScalaMatchingTask.scala b/src/compiler/scala/tools/ant/ScalaMatchingTask.scala new file mode 100644 index 0000000000..5d065eb840 --- /dev/null +++ b/src/compiler/scala/tools/ant/ScalaMatchingTask.scala @@ -0,0 +1,31 @@ +/* __ *\ +** ________ ___ / / ___ Scala Ant Tasks ** +** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +package scala.tools.ant + +import java.io.{ File, InputStream, FileWriter } + +import org.apache.tools.ant.{ Task, BuildException } +import org.apache.tools.ant.taskdefs.MatchingTask +import org.apache.tools.ant.types.{ Path, Reference } + +trait ScalaTask { + self: Task => + + /** Generates a build error. Error location will be the + * current task in the ant file. + * + * @param message A message describing the error. + * @throws BuildException A build error exception thrown in every case. + */ + protected def buildError(message: String): Nothing = + throw new BuildException(message, getLocation()) +} + +abstract class ScalaMatchingTask extends MatchingTask with ScalaTask { +} diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala index db53224b4f..e9bc4435e1 100644 --- a/src/compiler/scala/tools/ant/ScalaTool.scala +++ b/src/compiler/scala/tools/ant/ScalaTool.scala @@ -10,9 +10,7 @@ package scala.tools.ant import java.io.{File, InputStream, FileWriter} - import org.apache.tools.ant.BuildException -import org.apache.tools.ant.taskdefs.MatchingTask import org.apache.tools.ant.types.{Path, Reference} /** <p> @@ -31,7 +29,7 @@ import org.apache.tools.ant.types.{Path, Reference} * @author Gilles Dubochet * @version 1.1 */ -class ScalaTool extends MatchingTask { +class ScalaTool extends ScalaMatchingTask { private def emptyPath = new Path(getProject) @@ -101,7 +99,7 @@ class ScalaTool extends MatchingTask { if (Platforms.isPermissible(st)) (if (input != "") List(st) else Nil) else { - error("Platform " + st + " does not exist.") + buildError("Platform " + st + " does not exist.") Nil } } @@ -148,7 +146,7 @@ class ScalaTool extends MatchingTask { if (input != "") List(Pair(stArray(0), stArray(1))) else Nil } else - error("Property " + st + " is not formatted properly.") + buildError("Property " + st + " is not formatted properly.") } } @@ -183,13 +181,6 @@ class ScalaTool extends MatchingTask { ** Compilation and support methods ** \*============================================================================*/ - /** Generates a build error. Error location will be the current task in the - * ant file. - * @param message A message describing the error. - * @throws BuildException A build error exception thrown in every case. */ - private def error(message: String): Nothing = - throw new BuildException(message, getLocation()) - // XXX encoding and generalize private def getResourceAsCharStream(clazz: Class[_], resource: String): Stream[Char] = { val stream = clazz.getClassLoader() getResourceAsStream resource @@ -246,7 +237,7 @@ class ScalaTool extends MatchingTask { private def writeFile(file: File, content: String) = if (file.exists() && !file.canWrite()) - error("File " + file + " is not writable") + buildError("File " + file + " is not writable") else { val writer = new FileWriter(file, false) writer.write(content) @@ -260,8 +251,8 @@ class ScalaTool extends MatchingTask { /** Performs the tool creation. */ override def execute() = { // Tests if all mandatory attributes are set and valid. - if (file.isEmpty) error("Attribute 'file' is not set.") - if (mainClass.isEmpty) error("Main class must be set.") + if (file.isEmpty) buildError("Attribute 'file' is not set.") + if (mainClass.isEmpty) buildError("Main class must be set.") val resourceRoot = "scala/tools/ant/templates/" val patches = Map ( ("class", mainClass.get), diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index 20ed9fc6d4..6c56ace9fe 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -12,7 +12,7 @@ package scala.tools.ant import java.io.{File,PrintWriter,BufferedWriter,FileWriter} import org.apache.tools.ant.{ BuildException, Project, AntClassLoader } -import org.apache.tools.ant.taskdefs.{MatchingTask,Java} +import org.apache.tools.ant.taskdefs.Java import org.apache.tools.ant.types.{Path, Reference} import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper, SourceFileScanner} @@ -68,7 +68,7 @@ import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} * * @author Gilles Dubochet, Stephane Micheloud */ -class Scalac extends MatchingTask with ScalacShared { +class Scalac extends ScalaMatchingTask with ScalacShared { /** The unique Ant file utilities instance to use in this task. */ private val fileUtils = FileUtils.getFileUtils() @@ -173,7 +173,7 @@ class Scalac extends MatchingTask with ScalacShared { case None => Some(arg) } private def pathAsList(p: Option[Path], name: String): List[File] = p match { - case None => error("Member '" + name + "' is empty.") + case None => buildError("Member '" + name + "' is empty.") case Some(x) => x.list.toList map nameToFile } private def createNewPath(getter: () => Option[Path], setter: (Option[Path]) => Unit) = { @@ -296,7 +296,7 @@ class Scalac extends MatchingTask with ScalacShared { * @param input The value for <code>target</code>. */ def setTarget(input: String): Unit = if (Target.isPermissible(input)) backend = Some(input) - else error("Unknown target '" + input + "'") + else buildError("Unknown target '" + input + "'") /** Sets the <code>force</code> attribute. Used by Ant. * @param input The value for <code>force</code>. */ @@ -317,7 +317,7 @@ class Scalac extends MatchingTask with ScalacShared { * @param input The value for <code>logging</code>. */ def setLogging(input: String) { if (LoggingLevel.isPermissible(input)) logging = Some(input) - else error("Logging level '" + input + "' does not exist.") + else buildError("Logging level '" + input + "' does not exist.") } /** Sets the <code>logphase</code> attribute. Used by Ant. @@ -328,7 +328,7 @@ class Scalac extends MatchingTask with ScalacShared { if (CompilerPhase.isPermissible(st)) (if (input != "") List(st) else Nil) else { - error("Phase " + st + " in log does not exist.") + buildError("Phase " + st + " in log does not exist.") Nil } } @@ -345,19 +345,19 @@ class Scalac extends MatchingTask with ScalacShared { /** Set the <code>deprecation</code> info attribute. * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ def setDeprecation(input: String) { - deprecation = Flag toBoolean input orElse error("Unknown deprecation flag '" + input + "'") + deprecation = Flag toBoolean input orElse buildError("Unknown deprecation flag '" + input + "'") } /** Set the <code>optimise</code> info attribute. * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ def setOptimise(input: String) { - optimise = Flag toBoolean input orElse error("Unknown optimisation flag '" + input + "'") + optimise = Flag toBoolean input orElse buildError("Unknown optimisation flag '" + input + "'") } /** Set the <code>unchecked</code> info attribute. * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ def setUnchecked(input: String) { - unchecked = Flag toBoolean input orElse error("Unknown unchecked flag '" + input + "'") + unchecked = Flag toBoolean input orElse buildError("Unknown unchecked flag '" + input + "'") } /** Sets the <code>force</code> attribute. Used by Ant. @@ -391,7 +391,7 @@ class Scalac extends MatchingTask with ScalacShared { * Scala-friendly form. * @return The destination as a file. */ protected def getDestination: File = - if (destination.isEmpty) error("Member 'destination' is empty.") + if (destination.isEmpty) buildError("Member 'destination' is empty.") else existing(getProject().resolveFile(destination.get.toString)) /** Gets the value of the <code>sourcepath</code> attribute in a @@ -452,14 +452,6 @@ class Scalac extends MatchingTask with ScalacShared { protected def asString(file: File): String = file.getAbsolutePath() - /** Generates a build error. Error location will be the current task in the - * ant file. - * @param message A message describing the error. - * @throws BuildException A build error exception thrown in every case. */ - protected def error(message: String): Nothing = - throw new BuildException(message, getLocation()) - - /*============================================================================*\ ** Hooks for variants of Scala ** \*============================================================================*/ @@ -480,9 +472,9 @@ class Scalac extends MatchingTask with ScalacShared { log("Base directory is `%s`".format(scala.tools.nsc.io.Path("").normalize)) // Tests if all mandatory attributes are set and valid. - if (origin.isEmpty) error("Attribute 'srcdir' is not set.") + if (origin.isEmpty) buildError("Attribute 'srcdir' is not set.") if (!destination.isEmpty && !destination.get.isDirectory()) - error("Attribute 'destdir' does not refer to an existing directory.") + buildError("Attribute 'destdir' does not refer to an existing directory.") if (destination.isEmpty) destination = Some(getOrigin.head) val mapper = new GlobPatternMapper() @@ -531,7 +523,7 @@ class Scalac extends MatchingTask with ScalacShared { // Builds-up the compilation settings for Scalac with the existing Ant // parameters. - val settings = newSettings(error) + val settings = newSettings(buildError) settings.outdir.value = asString(destination.get) if (!classpath.isEmpty) settings.classpath.value = asString(getClasspath) @@ -599,7 +591,7 @@ class Scalac extends MatchingTask with ScalacShared { if (compilerPath.isDefined) path add compilerPath.get else getClass.getClassLoader match { case cl: AntClassLoader => path add new Path(getProject, cl.getClasspath) - case _ => error("Cannot determine default classpath for scalac, please specify one!") + case _ => buildError("Cannot determine default classpath for scalac, please specify one!") } path } @@ -626,7 +618,7 @@ class Scalac extends MatchingTask with ScalacShared { } val res = execWithArgFiles(java, List(writeSettings.getCanonicalPath)) if (failonerror && res != 0) - error("Compilation failed because of an internal compiler error;"+ + buildError("Compilation failed because of an internal compiler error;"+ " see the error output for details.") } @@ -640,14 +632,14 @@ class Scalac extends MatchingTask with ScalacShared { case ex: Throwable => ex.printStackTrace() val msg = if (ex.getMessage == null) "no error message provided" else ex.getMessage - error("Compile failed because of an internal compiler error (" + msg + "); see the error output for details.") + buildError("Compile failed because of an internal compiler error (" + msg + "); see the error output for details.") } reporter.printSummary() if (reporter.hasErrors) { val msg = "Compile failed with %d error%s; see the compiler error output for details.".format( reporter.ERROR.count, plural(reporter.ERROR.count)) - if (failonerror) error(msg) else log(msg) + if (failonerror) buildError(msg) else log(msg) } else if (reporter.WARNING.count > 0) log("Compile succeeded with %d warning%s; see the compiler output for details.".format( diff --git a/src/compiler/scala/tools/ant/ScalacShared.scala b/src/compiler/scala/tools/ant/ScalacShared.scala index 356fb99e56..f4cb444405 100644 --- a/src/compiler/scala/tools/ant/ScalacShared.scala +++ b/src/compiler/scala/tools/ant/ScalacShared.scala @@ -9,10 +9,10 @@ package scala.tools.ant import org.apache.tools.ant.Project -import org.apache.tools.ant.taskdefs.{ MatchingTask, Java } +import org.apache.tools.ant.taskdefs.Java import scala.tools.nsc.io -trait ScalacShared extends MatchingTask { +trait ScalacShared extends ScalaMatchingTask { val MainClass = "scala.tools.nsc.Main" def execWithArgFiles(java: Java, paths: List[String]) = { diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala index 427846fa33..be5311b471 100644 --- a/src/compiler/scala/tools/ant/Scaladoc.scala +++ b/src/compiler/scala/tools/ant/Scaladoc.scala @@ -12,7 +12,6 @@ package scala.tools.ant import java.io.File import org.apache.tools.ant.{BuildException, Project} -import org.apache.tools.ant.taskdefs.MatchingTask import org.apache.tools.ant.types.{Path, Reference} import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper} @@ -61,7 +60,7 @@ import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} * * @author Gilles Dubochet, Stephane Micheloud */ -class Scaladoc extends MatchingTask { +class Scaladoc extends ScalaMatchingTask { /** The unique Ant file utilities instance to use in this task. */ private val fileUtils = FileUtils.getFileUtils() @@ -306,7 +305,7 @@ class Scaladoc extends MatchingTask { if (Flag.isPermissible(input)) deprecation = "yes".equals(input) || "on".equals(input) else - error("Unknown deprecation flag '" + input + "'") + buildError("Unknown deprecation flag '" + input + "'") } /** Set the <code>unchecked</code> info attribute. @@ -317,7 +316,7 @@ class Scaladoc extends MatchingTask { if (Flag.isPermissible(input)) unchecked = "yes".equals(input) || "on".equals(input) else - error("Unknown unchecked flag '" + input + "'") + buildError("Unknown unchecked flag '" + input + "'") } /*============================================================================*\ @@ -330,7 +329,7 @@ class Scaladoc extends MatchingTask { * @return The class path as a list of files. */ private def getClasspath: List[File] = - if (classpath.isEmpty) error("Member 'classpath' is empty.") + if (classpath.isEmpty) buildError("Member 'classpath' is empty.") else classpath.get.list().toList.map(nameToFile) /** Gets the value of the <code>origin</code> attribute in a Scala-friendly @@ -339,7 +338,7 @@ class Scaladoc extends MatchingTask { * @return The origin path as a list of files. */ private def getOrigin: List[File] = - if (origin.isEmpty) error("Member 'origin' is empty.") + if (origin.isEmpty) buildError("Member 'origin' is empty.") else origin.get.list().toList.map(nameToFile) /** Gets the value of the <code>destination</code> attribute in a @@ -348,7 +347,7 @@ class Scaladoc extends MatchingTask { * @return The destination as a file. */ private def getDestination: File = - if (destination.isEmpty) error("Member 'destination' is empty.") + if (destination.isEmpty) buildError("Member 'destination' is empty.") else existing(getProject().resolveFile(destination.get.toString)) /** Gets the value of the <code>sourcepath</code> attribute in a @@ -357,7 +356,7 @@ class Scaladoc extends MatchingTask { * @return The source path as a list of files. */ private def getSourcepath: List[File] = - if (sourcepath.isEmpty) error("Member 'sourcepath' is empty.") + if (sourcepath.isEmpty) buildError("Member 'sourcepath' is empty.") else sourcepath.get.list().toList.map(nameToFile) /** Gets the value of the <code>bootclasspath</code> attribute in a @@ -366,7 +365,7 @@ class Scaladoc extends MatchingTask { * @return The boot class path as a list of files. */ private def getBootclasspath: List[File] = - if (bootclasspath.isEmpty) error("Member 'bootclasspath' is empty.") + if (bootclasspath.isEmpty) buildError("Member 'bootclasspath' is empty.") else bootclasspath.get.list().toList.map(nameToFile) /** Gets the value of the <code>extdirs</code> attribute in a @@ -375,7 +374,7 @@ class Scaladoc extends MatchingTask { * @return The extensions path as a list of files. */ private def getExtdirs: List[File] = - if (extdirs.isEmpty) error("Member 'extdirs' is empty.") + if (extdirs.isEmpty) buildError("Member 'extdirs' is empty.") else extdirs.get.list().toList.map(nameToFile) /*============================================================================*\ @@ -437,15 +436,6 @@ class Scaladoc extends MatchingTask { private def asString(file: File): String = file.getAbsolutePath() - /** Generates a build error. Error location will be the current task in the - * ant file. - * - * @param message A message describing the error. - * @throws BuildException A build error exception thrown in every case. - */ - private def error(message: String): Nothing = - throw new BuildException(message, getLocation()) - /*============================================================================*\ ** The big execute method ** \*============================================================================*/ @@ -453,10 +443,10 @@ class Scaladoc extends MatchingTask { /** Initializes settings and source files */ protected def initialize: Pair[Settings, List[File]] = { // Tests if all mandatory attributes are set and valid. - if (origin.isEmpty) error("Attribute 'srcdir' is not set.") - if (getOrigin.isEmpty) error("Attribute 'srcdir' is not set.") + if (origin.isEmpty) buildError("Attribute 'srcdir' is not set.") + if (getOrigin.isEmpty) buildError("Attribute 'srcdir' is not set.") if (!destination.isEmpty && !destination.get.isDirectory()) - error("Attribute 'destdir' does not refer to an existing directory.") + buildError("Attribute 'destdir' does not refer to an existing directory.") if (destination.isEmpty) destination = Some(getOrigin.head) val mapper = new GlobPatternMapper() @@ -501,7 +491,7 @@ class Scaladoc extends MatchingTask { // Builds-up the compilation settings for Scalac with the existing Ant // parameters. - val docSettings = new Settings(error) + val docSettings = new Settings(buildError) docSettings.outdir.value = asString(destination.get) if (!classpath.isEmpty) docSettings.classpath.value = asString(getClasspath) @@ -532,7 +522,7 @@ class Scaladoc extends MatchingTask { val docProcessor = new scala.tools.nsc.doc.DocFactory(reporter, docSettings) docProcessor.document(sourceFiles.map (_.toString)) if (reporter.ERROR.count > 0) - error( + buildError( "Document failed with " + reporter.ERROR.count + " error" + (if (reporter.ERROR.count > 1) "s" else "") + @@ -547,11 +537,11 @@ class Scaladoc extends MatchingTask { } catch { case exception: Throwable if exception.getMessage ne null => exception.printStackTrace() - error("Document failed because of an internal documenter error (" + + buildError("Document failed because of an internal documenter error (" + exception.getMessage + "); see the error output for details.") case exception => exception.printStackTrace() - error("Document failed because of an internal documenter error " + + buildError("Document failed because of an internal documenter error " + "(no error message provided); see the error output for details.") } } diff --git a/src/compiler/scala/tools/ant/sabbus/Break.scala b/src/compiler/scala/tools/ant/sabbus/Break.scala index 95bc5cc14e..5d1f82e77a 100644 --- a/src/compiler/scala/tools/ant/sabbus/Break.scala +++ b/src/compiler/scala/tools/ant/sabbus/Break.scala @@ -20,7 +20,7 @@ class Break extends Task { private var id: Option[String] = None override def execute { - if (id.isEmpty) error("Attribute 'id' is not set") + if (id.isEmpty) system.error("Attribute 'id' is not set") Compilers.break(id.get) } diff --git a/src/compiler/scala/tools/ant/sabbus/Make.scala b/src/compiler/scala/tools/ant/sabbus/Make.scala index 9173745472..31244ea7b4 100644 --- a/src/compiler/scala/tools/ant/sabbus/Make.scala +++ b/src/compiler/scala/tools/ant/sabbus/Make.scala @@ -14,8 +14,8 @@ import org.apache.tools.ant.Task class Make extends Task with TaskArgs { override def execute { - if (id.isEmpty) error("Mandatory attribute 'id' is not set.") - if (compilerPath.isEmpty) error("Mandatory attribute 'compilerpath' is not set.") + if (id.isEmpty) system.error("Mandatory attribute 'id' is not set.") + if (compilerPath.isEmpty) system.error("Mandatory attribute 'compilerpath' is not set.") val settings = new Settings if (!destinationDir.isEmpty) settings.d = destinationDir.get if (!compTarget.isEmpty) settings.target = compTarget.get diff --git a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala index 689df48a88..f83f476695 100644 --- a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala +++ b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala @@ -13,12 +13,12 @@ package sabbus import java.io.File import java.io.FileWriter import org.apache.tools.ant.Project -import org.apache.tools.ant.taskdefs.{ MatchingTask, Java } +import org.apache.tools.ant.taskdefs.Java import org.apache.tools.ant.util.{ GlobPatternMapper, SourceFileScanner } import scala.tools.nsc.io import scala.tools.nsc.util.ScalaClassLoader -class ScalacFork extends MatchingTask with ScalacShared with TaskArgs { +class ScalacFork extends ScalaMatchingTask with ScalacShared with TaskArgs { private def originOfThis: String = ScalaClassLoader.originOfClass(classOf[ScalacFork]) map (_.toString) getOrElse "<unknown>" @@ -62,9 +62,9 @@ class ScalacFork extends MatchingTask with ScalacShared with TaskArgs { log("Executing ant task scalacfork, origin: %s".format(originOfThis), Project.MSG_VERBOSE) - val compilerPath = this.compilerPath getOrElse error("Mandatory attribute 'compilerpath' is not set.") - val sourceDir = this.sourceDir getOrElse error("Mandatory attribute 'srcdir' is not set.") - val destinationDir = this.destinationDir getOrElse error("Mandatory attribute 'destdir' is not set.") + val compilerPath = this.compilerPath getOrElse system.error("Mandatory attribute 'compilerpath' is not set.") + val sourceDir = this.sourceDir getOrElse system.error("Mandatory attribute 'srcdir' is not set.") + val destinationDir = this.destinationDir getOrElse system.error("Mandatory attribute 'destdir' is not set.") val settings = new Settings settings.d = destinationDir @@ -114,7 +114,7 @@ class ScalacFork extends MatchingTask with ScalacShared with TaskArgs { val res = execWithArgFiles(java, paths) if (failOnError && res != 0) - error("Compilation failed because of an internal compiler error;"+ + system.error("Compilation failed because of an internal compiler error;"+ " see the error output for details.") } } diff --git a/src/compiler/scala/tools/ant/sabbus/Use.scala b/src/compiler/scala/tools/ant/sabbus/Use.scala index a466d7b18a..703cf233e1 100644 --- a/src/compiler/scala/tools/ant/sabbus/Use.scala +++ b/src/compiler/scala/tools/ant/sabbus/Use.scala @@ -7,15 +7,15 @@ \* */ -package scala.tools.ant.sabbus +package scala.tools.ant +package sabbus import java.io.File -import org.apache.tools.ant.taskdefs.MatchingTask import org.apache.tools.ant.types.{Path, Reference} import org.apache.tools.ant.util.{GlobPatternMapper, SourceFileScanner} -class Use extends MatchingTask { +class Use extends ScalaMatchingTask { def setId(input: String) { id = Some(input) @@ -39,8 +39,8 @@ class Use extends MatchingTask { private var failOnError: Boolean = true override def execute() { - if (id.isEmpty) error("Mandatory attribute 'id' is not set.") - if (sourceDir.isEmpty) error("Mandatory attribute 'srcdir' is not set.") + if (id.isEmpty) system.error("Mandatory attribute 'id' is not set.") + if (sourceDir.isEmpty) system.error("Mandatory attribute 'srcdir' is not set.") val compiler = Compilers(id.get) if (!destinationDir.isEmpty) compiler.settings.d = destinationDir.get val mapper = new GlobPatternMapper() @@ -58,7 +58,7 @@ class Use extends MatchingTask { log("Compiling " + includedFiles.size + " file" + (if (includedFiles.size > 1) "s" else "") + " to " + compiler.settings.d.getAbsolutePath) val (errors, warnings) = compiler.compile(includedFiles) if (errors > 0) - error("Compilation failed with " + errors + " error" + (if (errors > 1) "s" else "") + ".") + system.error("Compilation failed with " + errors + " error" + (if (errors > 1) "s" else "") + ".") else if (warnings > 0) log("Compilation succeeded with " + warnings + " warning" + (if (warnings > 1) "s" else "") + ".") } @@ -67,7 +67,7 @@ class Use extends MatchingTask { ex.printStackTrace val errorMsg = "Compilation failed because of an internal compiler error (" + msg + "); see the error output for details." - if (failOnError) error(errorMsg) else log(errorMsg) + if (failOnError) system.error(errorMsg) else log(errorMsg) } } diff --git a/src/compiler/scala/tools/cmd/Demo.scala b/src/compiler/scala/tools/cmd/Demo.scala index 22cf50bd58..c471c455ae 100644 --- a/src/compiler/scala/tools/cmd/Demo.scala +++ b/src/compiler/scala/tools/cmd/Demo.scala @@ -48,7 +48,7 @@ object DemoSpec extends DemoSpec with Property { type ThisCommandLine = SpecCommandLine def creator(args: List[String]) = new SpecCommandLine(args) { - override def errorFn(msg: String) = { println("Error: " + msg) ; System.exit(0) } + override def errorFn(msg: String) = { println("Error: " + msg) ; system.exit(0) } } } diff --git a/src/compiler/scala/tools/cmd/package.scala b/src/compiler/scala/tools/cmd/package.scala index 33d3892077..a5cd7c1bc2 100644 --- a/src/compiler/scala/tools/cmd/package.scala +++ b/src/compiler/scala/tools/cmd/package.scala @@ -12,8 +12,7 @@ package object cmd { def runAndExit(body: => Unit): Nothing = { body - System exit 0 - error("unreachable") + system.exit(0) } def toOpt(s: String) = if (s startsWith "--") s else "--" + s diff --git a/src/compiler/scala/tools/cmd/program/Simple.scala b/src/compiler/scala/tools/cmd/program/Simple.scala index 641be31c9e..a38239a119 100644 --- a/src/compiler/scala/tools/cmd/program/Simple.scala +++ b/src/compiler/scala/tools/cmd/program/Simple.scala @@ -66,8 +66,8 @@ object Simple { * inaccessible due to the overriding var. */ trait Ticket2338WontFixWorkaround { - def enforceArity_=(x: Boolean): Unit = error("unreachable") - def onlyKnownOptions_=(x: Boolean): Unit = error("unreachable") + def enforceArity_=(x: Boolean): Unit = system.error("unreachable") + def onlyKnownOptions_=(x: Boolean): Unit = system.error("unreachable") } /** Configurability simplicity achieved by turning defs into vars and letting diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala index c3307cba77..db5dae0cd9 100644 --- a/src/compiler/scala/tools/nsc/CompileClient.scala +++ b/src/compiler/scala/tools/nsc/CompileClient.scala @@ -114,7 +114,7 @@ class StandardCompileClient { } def main(args: Array[String]): Unit = - exit(try main0(args) catch { case e: Exception => 1 }) + system.exit(try main0(args) catch { case e: Exception => 1 }) } diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala index 04e9b3421e..a1198409dc 100644 --- a/src/compiler/scala/tools/nsc/CompileServer.scala +++ b/src/compiler/scala/tools/nsc/CompileServer.scala @@ -20,8 +20,7 @@ import scala.tools.util.SocketServer * @author Martin Odersky * @version 1.0 */ -class StandardCompileServer extends SocketServer -{ +class StandardCompileServer extends SocketServer { def compileSocket: CompileSocket = CompileSocket // todo: make this a lazy val val versionMsg = "Fast Scala compiler " + @@ -37,7 +36,7 @@ class StandardCompileServer extends SocketServer private def exit(code: Int): Nothing = { System.err.close() System.out.close() - Predef.exit(code) + system.exit(code) } private val runtime = Runtime.getRuntime() @@ -91,11 +90,11 @@ class StandardCompileServer extends SocketServer return } - def error(msg: String) { + def fscError(msg: String) { out.println(FakePos("fsc"), msg + "\n fsc -help gives more information") } - val command = newOfflineCompilerCommand(args, new Settings(error)) + val command = newOfflineCompilerCommand(args, new Settings(fscError)) reporter = new ConsoleReporter(command.settings, in, out) { // disable prompts, so that compile server cannot block diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala index d57016c4e9..2faa97d667 100644 --- a/src/compiler/scala/tools/nsc/CompileSocket.scala +++ b/src/compiler/scala/tools/nsc/CompileSocket.scala @@ -43,10 +43,10 @@ class CompileSocket { /** A Pattern object for checking compiler output for errors */ val errorPattern = Pattern compile errorRegex - protected def error(msg: String) = System.err.println(msg) + protected def fscError(msg: String) = System.err.println(msg) protected def fatal(msg: String) = { - error(msg) + fscError(msg) throw new Exception("fsc failure") } @@ -147,7 +147,7 @@ class CompileSocket { val maxAttempts = (5 * 1000) / retryDelay def getsock(attempts: Int): Option[Socket] = attempts match { - case 0 => error("Unable to establish connection to compilation daemon") ; None + case 0 => fscError("Unable to establish connection to compilation daemon") ; None case num => val port = if (create) getPort(vmArgs) else pollPort() if (port < 0) return None diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 1829c75b43..bb0e122dd6 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -135,10 +135,13 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable // ------------------ Reporting ------------------------------------- - def inform(msg: String) = reporter.info(NoPosition, msg, true) - def error(msg: String) = reporter.error(NoPosition, msg) - def warning(msg: String) = - if (opt.fatalWarnings) error(msg) + // not deprecated yet, but a method called "error" imported into + // nearly every trait really must go. For now using globalError. + def error(msg: String) = globalError(msg) + def globalError(msg: String) = reporter.error(NoPosition, msg) + def inform(msg: String) = reporter.info(NoPosition, msg, true) + def warning(msg: String) = + if (opt.fatalWarnings) globalError(msg) else reporter.warning(NoPosition, msg) def informProgress(msg: String) = if (opt.verbose) inform("[" + msg + "]") @@ -148,7 +151,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable def logError(msg: String, t: Throwable): Unit = () def log(msg: => AnyRef): Unit = if (opt.logPhase) inform("[log " + phase + "] " + msg) - def logThrowable(t: Throwable): Unit = error(throwableAsString(t)) + def logThrowable(t: Throwable): Unit = globalError(throwableAsString(t)) def throwableAsString(t: Throwable): String = if (opt.richExes) Exceptional(t).force().context() else util.stringFromWriter(t printStackTrace _) @@ -163,10 +166,10 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable try Some(Charset.forName(name)) catch { case _: IllegalCharsetNameException => - error("illegal charset name '" + name + "'") + globalError("illegal charset name '" + name + "'") None case _: UnsupportedCharsetException => - error("unsupported charset '" + name + "'") + globalError("unsupported charset '" + name + "'") None } @@ -180,7 +183,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable try Some(ccon.newInstance(charset.newDecoder(), reporter).asInstanceOf[SourceReader]) catch { case x => - error("exception while trying to instantiate source reader '" + name + "'") + globalError("exception while trying to instantiate source reader '" + name + "'") None } } @@ -920,19 +923,19 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable /** Compile list of abstract files */ def compileFiles(files: List[AbstractFile]) { try compileSources(files map getSourceFile) - catch { case ex: IOException => error(ex.getMessage()) } + catch { case ex: IOException => globalError(ex.getMessage()) } } /** Compile list of files given by their names */ def compile(filenames: List[String]) { try { val sources: List[SourceFile] = - if (isScriptRun && filenames.size > 1) returning(Nil)(_ => error("can only compile one script at a time")) + if (isScriptRun && filenames.size > 1) returning(Nil)(_ => globalError("can only compile one script at a time")) else filenames map getSourceFile compileSources(sources) } - catch { case ex: IOException => error(ex.getMessage()) } + catch { case ex: IOException => globalError(ex.getMessage()) } } /** Compile abstract file until `globalPhase`, but at least @@ -1107,7 +1110,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable } catch { case ex: IOException => if (opt.debug) ex.printStackTrace() - error("could not write file " + file) + globalError("could not write file " + file) } }) } diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index aeab9f75d7..57e3f904be 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -1340,7 +1340,7 @@ object Interpreter { intLoop.createInterpreter intLoop.in = InteractiveReader.createDefault(intLoop.interpreter) - // rebind exit so people don't accidentally call System.exit by way of predef + // rebind exit so people don't accidentally call system.exit by way of predef intLoop.interpreter.beQuietDuring { intLoop.interpreter.interpret("""def exit = println("Type :quit to resume program execution.")""") for (p <- args) { diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala index a7f70b12b0..27e1be208d 100644 --- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala +++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala @@ -32,7 +32,7 @@ trait InterpreterControl { sealed abstract class Command extends Function1[List[String], Result] { def name: String def help: String - def error(msg: String) = { + def commandError(msg: String) = { out.println(":" + name + " " + msg + ".") Result(true, None) } @@ -41,7 +41,7 @@ trait InterpreterControl { case class NoArgs(name: String, help: String, f: () => Result) extends Command { def usage(): String = ":" + name - def apply(args: List[String]) = if (args.isEmpty) f() else error("accepts no arguments") + def apply(args: List[String]) = if (args.isEmpty) f() else commandError("accepts no arguments") } case class LineArg(name: String, help: String, f: (String) => Result) extends Command { @@ -53,7 +53,7 @@ trait InterpreterControl { def usage(): String = ":" + name + " <arg>" def apply(args: List[String]) = if (args.size == 1) f(args.head) - else error("requires exactly one argument") + else commandError("requires exactly one argument") } case class VarArgs(name: String, help: String, f: (List[String]) => Result) extends Command { @@ -114,7 +114,7 @@ class InterpreterLoop(in0: Option[BufferedReader], protected val out: PrintWrite private def installSigIntHandler() { def onExit() { Console.println("") // avoiding "shell prompt in middle of line" syndrome - System.exit(1) + system.exit(1) } ignoring(classOf[Exception]) { SignalManager("INT") = { diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index 37fb5952e3..7f79c69f52 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -26,21 +26,21 @@ object Main extends AnyRef with EvalLoop { var reporter: ConsoleReporter = _ - def error(msg: String) { + private def scalacError(msg: String) { reporter.error(FakePos("scalac"), msg + "\n scalac -help gives more information") } def resident(compiler: Global) { loop { line => val args = line.split(' ').toList - val command = new CompilerCommand(args, new Settings(error)) + val command = new CompilerCommand(args, new Settings(scalacError)) compiler.reporter.reset new compiler.Run() compile command.files } } def process(args: Array[String]) { - val ss = new Settings(error) + val ss = new Settings(scalacError) reporter = new ConsoleReporter(ss) val command = new CompilerCommand(args.toList, ss) val settings = command.settings @@ -120,7 +120,7 @@ object Main extends AnyRef with EvalLoop { def main(args: Array[String]) { process(args) - exit(if (reporter.hasErrors) 1 else 0) + system exit (if (reporter.hasErrors) 1 else 0) } } diff --git a/src/compiler/scala/tools/nsc/MainGenericRunner.scala b/src/compiler/scala/tools/nsc/MainGenericRunner.scala index a2d2b5b7c4..116c06179a 100644 --- a/src/compiler/scala/tools/nsc/MainGenericRunner.scala +++ b/src/compiler/scala/tools/nsc/MainGenericRunner.scala @@ -31,7 +31,7 @@ object MainGenericRunner { def main(args: Array[String]) { if (!process(args)) - System.exit(1) + system.exit(1) } def process(args: Array[String]): Boolean = { diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala index fc0ea67051..33e91759f8 100644 --- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala +++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala @@ -34,7 +34,7 @@ object MainTokenMetric { } def process(args: Array[String]) { - val settings = new Settings(error) + val settings = new Settings(system.error) reporter = new ConsoleReporter(settings) val command = new CompilerCommand(args.toList, settings) try { @@ -50,7 +50,7 @@ object MainTokenMetric { def main(args: Array[String]) { process(args) - exit(if (reporter.hasErrors) 1 else 0) + system.exit(if (reporter.hasErrors) 1 else 0) } } diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala index e0cc91cb80..c121098d56 100644 --- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala +++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala @@ -255,7 +255,7 @@ trait PhaseAssembly { self: Global => val tonode = graph.getNodeByPhase(phsname) graph.softConnectNodes(fromnode, tonode) } else { - error("[phase assembly, after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]") + globalError("[phase assembly, after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]") } } for (phsname <- phs.runsBefore) { @@ -263,7 +263,7 @@ trait PhaseAssembly { self: Global => val tonode = graph.getNodeByPhase(phsname) graph.softConnectNodes(tonode, fromnode) } else { - error("[phase assembly, before dependency on parser phase not allowed: " + phsname + " => "+ fromnode.phasename + "]") + globalError("[phase assembly, before dependency on parser phase not allowed: " + phsname + " => "+ fromnode.phasename + "]") } } case Some(phsname) => @@ -271,7 +271,7 @@ trait PhaseAssembly { self: Global => val tonode = graph.getNodeByPhase(phsname) graph.hardConnectNodes(fromnode, tonode) } else { - error("[phase assembly, right after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]") + globalError("[phase assembly, right after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]") } } } diff --git a/src/compiler/scala/tools/nsc/ScalaDoc.scala b/src/compiler/scala/tools/nsc/ScalaDoc.scala index 4354608e10..0549e2c758 100644 --- a/src/compiler/scala/tools/nsc/ScalaDoc.scala +++ b/src/compiler/scala/tools/nsc/ScalaDoc.scala @@ -25,14 +25,14 @@ object ScalaDoc { var reporter: ConsoleReporter = _ - def error(msg: String): Unit = { + private def scalacError(msg: String): Unit = { reporter.error(FakePos("scalac"), msg + "\n scalac -help gives more information") } def process(args: Array[String]): Unit = { val docSettings: doc.Settings = - new doc.Settings(error) + new doc.Settings(scalacError) reporter = new ConsoleReporter(docSettings) { override def hasErrors = false // need to do this so that the Global instance doesn't trash all the symbols just because there was an error @@ -79,7 +79,6 @@ object ScalaDoc { def main(args: Array[String]): Unit = { process(args) - exit(if (reporter.hasErrors) 1 else 0) + system.exit(if (reporter.hasErrors) 1 else 0) } - } diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala index cae2219adf..c8085e58a1 100644 --- a/src/compiler/scala/tools/nsc/ScriptRunner.scala +++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala @@ -134,7 +134,7 @@ object ScriptRunner { scriptFileIn: String): Boolean = { val scriptFile = Path(scriptFileIn).toAbsolute.path - val compSettingNames = new Settings(error).visibleSettings.toList map (_.name) + val compSettingNames = new Settings(system.error).visibleSettings.toList map (_.name) val compSettings = settings.visibleSettings.toList filter (compSettingNames contains _.name) val coreCompArgs = compSettings flatMap (_.unparse) val compArgs = coreCompArgs ::: List("-Xscript", scriptMain(settings), scriptFile) @@ -198,7 +198,7 @@ object ScriptRunner { else None } - /** The script runner calls System.exit to communicate a return value, but this must + /** The script runner calls system.exit to communicate a return value, but this must * not take place until there are no non-daemon threads running. Tickets #1955, #2006. */ waitingForThreads { diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala index a5bf1dfd0c..82c09b6501 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala @@ -684,7 +684,7 @@ abstract class TreeBrowsers { toDocument(thistpe) :/: ", " :/: toDocument(supertpe) ::")")) case _ => - Predef.error("Unknown case: " + t.toString() +", "+ t.getClass) + system.error("Unknown case: " + t.toString() +", "+ t.getClass) } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala index 89c5ca18a9..e38d14c10b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala @@ -75,8 +75,8 @@ trait ExceptionHandlers { } object NoFinalizer extends Finalizer(null, "<no finalizer>", NoPosition) { - override def startBlock: BasicBlock = error("NoFinalizer cannot have a start block."); - override def setStartBlock(b: BasicBlock): Unit = error("NoFinalizer cannot have a start block."); + override def startBlock: BasicBlock = system.error("NoFinalizer cannot have a start block."); + override def setStartBlock(b: BasicBlock): Unit = system.error("NoFinalizer cannot have a start block."); override def dup = this } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 7744a57547..0e2c39aeee 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -122,7 +122,7 @@ abstract class GenICode extends SubComponent { case Block(_, Return(_)) => () case Return(_) => () case EmptyTree => - error("Concrete method has no definition: " + tree) + globalError("Concrete method has no definition: " + tree) case _ => if (ctx1.bb.isEmpty) ctx1.bb.closeWith(RETURN(m.returnType), rhs.pos) else diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala index 8e92beebc3..3beab98237 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala @@ -7,7 +7,8 @@ package scala.tools.nsc package backend package icode -import scala.collection.mutable.{Buffer, ListBuffer, Map, HashMap} +import scala.collection.mutable +import scala.collection.mutable.ListBuffer import scala.tools.nsc.symtab._ abstract class ICodeCheckers { @@ -59,8 +60,8 @@ abstract class ICodeCheckers { var method: IMethod = _ var code: Code = _ - val in: Map[BasicBlock, TypeStack] = new HashMap() - val out: Map[BasicBlock, TypeStack] = new HashMap() + val in: mutable.Map[BasicBlock, TypeStack] = new mutable.HashMap() + val out: mutable.Map[BasicBlock, TypeStack] = new mutable.HashMap() val emptyStack = new TypeStack() { override def toString = "<empty>" } @@ -113,11 +114,11 @@ abstract class ICodeCheckers { for (f1 <- cls.fields ; f2 <- cls.fields ; if f1 < f2) if (isConfict(f1, f2, false)) - ICodeCheckers.this.global.error("Repetitive field name: " + f1.symbol.fullName) + icodeError("Repetitive field name: " + f1.symbol.fullName) for (m1 <- cls.methods ; m2 <- cls.methods ; if m1 < m2) if (isConfict(m1, m2, true)) - ICodeCheckers.this.global.error("Repetitive method: " + m1.symbol.fullName) + icodeError("Repetitive method: " + m1.symbol.fullName) clasz.methods foreach check } @@ -130,7 +131,7 @@ abstract class ICodeCheckers { } def check(c: Code) { - val worklist: Buffer[BasicBlock] = new ListBuffer() + val worklist = new ListBuffer[BasicBlock] def append(elems: List[BasicBlock]) = worklist ++= (elems filterNot (worklist contains _)) @@ -284,7 +285,7 @@ abstract class ICodeCheckers { var stack = new TypeStack(initial) def checkStack(len: Int) { if (stack.length < len) - ICodeChecker.this.error("Expected at least " + len + " elements on the stack", stack) + ICodeChecker.this.icodeError("Expected at least " + len + " elements on the stack", stack) } def sizeString(push: Boolean) = { @@ -301,7 +302,7 @@ abstract class ICodeCheckers { } def _popStack: TypeKind = { if (stack.isEmpty) { - error("Popped empty stack in " + b.fullString + ", throwing a Unit") + icodeError("Popped empty stack in " + b.fullString + ", throwing a Unit") return UNIT } stack.pop @@ -337,7 +338,7 @@ abstract class ICodeCheckers { } def typeError(k1: TypeKind, k2: TypeKind) { - error("\n expected: " + k1 + "\n found: " + k2) + icodeError("\n expected: " + k1 + "\n found: " + k2) } def isSubtype(k1: TypeKind, k2: TypeKind) = (k1 <:< k2) || { import platform.isMaybeBoxed @@ -368,21 +369,21 @@ abstract class ICodeCheckers { def checkLocal(local: Local): Unit = { method lookupLocal local.sym.name getOrElse { - error(" " + local + " is not defined in method " + method) + icodeError(" " + local + " is not defined in method " + method) } } def checkField(obj: TypeKind, field: Symbol): Unit = obj match { case REFERENCE(sym) => if (sym.info.member(field.name) == NoSymbol) - error(" " + field + " is not defined in class " + clasz); + icodeError(" " + field + " is not defined in class " + clasz); case _ => - error(" expected reference type, but " + obj + " found"); + icodeError(" expected reference type, but " + obj + " found"); } /** Checks that tpe is a subtype of one of the allowed types */ def checkType(tpe: TypeKind, allowed: TypeKind*) = ( if (allowed exists (k => isSubtype(tpe, k))) () - else error(tpe + " is not one of: " + allowed.mkString("{ ", ", ", " }")) + else icodeError(tpe + " is not one of: " + allowed.mkString("{ ", ", ", " }")) ) def checkNumeric(tpe: TypeKind) = checkType(tpe, BYTE, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE) @@ -437,11 +438,11 @@ abstract class ICodeCheckers { "Method " + method + " does not exist in " + receiver) case t => - error("Not a reference type: " + t) + icodeError("Not a reference type: " + t) } def checkBool(cond: Boolean, msg: String) = - if (!cond) error(msg) + if (!cond) icodeError(msg) if (settings.debug.value) { log("PC: " + instr) @@ -461,7 +462,7 @@ abstract class ICodeCheckers { subtypeTest(elem, kind) pushStack(elem) case (a, b) => - error(" expected and INT and a array reference, but " + + icodeError(" expected and INT and a array reference, but " + a + ", " + b + " found"); } @@ -486,7 +487,7 @@ abstract class ICodeCheckers { case STORE_THIS(kind) => val actualType = popStack if (actualType.isReferenceType) subtypeTest(actualType, kind) - else error("Expected this reference but found: " + actualType) + else icodeError("Expected this reference but found: " + actualType) case STORE_ARRAY_ITEM(kind) => popStack3 match { @@ -494,7 +495,7 @@ abstract class ICodeCheckers { subtypeTest(k, kind) subtypeTest(k, elem) case (a, b, c) => - error(" expected and array reference, and int and " + kind + + icodeError(" expected and array reference, and int and " + kind + " but " + a + ", " + b + ", " + c + " found"); } @@ -564,7 +565,7 @@ abstract class ICodeCheckers { case ArrayLength(kind) => popStack match { case ARRAY(elem) => checkType(elem, kind) - case arr => error(" array reference expected, but " + arr + " found") + case arr => icodeError(" array reference expected, but " + arr + " found") } pushStack(INT) @@ -695,16 +696,16 @@ abstract class ICodeCheckers { //////////////// Error reporting ///////////////////////// - def error(msg: String) { - ICodeCheckers.this.global.error( + def icodeError(msg: String) { + ICodeCheckers.this.global.globalError( "!! ICode checker fatality in " + method + "\n at: " + basicBlock.fullString + "\n error message: " + msg ) } - def error(msg: String, stack: TypeStack) { - error(msg + "\n type stack: " + stack) + def icodeError(msg: String, stack: TypeStack) { + icodeError(msg + "\n type stack: " + stack) } } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala index 9bb704f8b7..05259772f4 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala @@ -196,7 +196,7 @@ trait Linearizers { self: ICodes => m.code.blocks.toList; def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = { - error("not implemented") + system.error("not implemented") } } @@ -335,7 +335,7 @@ trait Linearizers { self: ICodes => } def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = { - error("not implemented") + system.error("not implemented") } } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 5ee4245e35..6da0279ffe 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -578,7 +578,7 @@ trait Opcodes { self: ICodes => * then pushes one exception instance. */ case class LOAD_EXCEPTION(clasz: Symbol) extends Instruction { - override def consumed = error("LOAD_EXCEPTION does clean the whole stack, no idea how many things it consumes!") + override def consumed = system.error("LOAD_EXCEPTION does clean the whole stack, no idea how many things it consumes!") override def produced = 1 override def producedTypes = REFERENCE(clasz) :: Nil } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index 5ac44380f2..3d7219923d 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -301,7 +301,7 @@ abstract class CopyPropagation { out.bindings += (LocalVar(local) -> v) } case Nil => - Predef.error("Incorrect icode in " + method + ". Expecting something on the stack.") + system.error("Incorrect icode in " + method + ". Expecting something on the stack.") } out.stack = out.stack drop 1; diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala index 98d9081624..be50640d9c 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala @@ -83,7 +83,7 @@ trait DataFlowAnalysis[L <: SemiLattice] { Console.println("in: " + in.mkString("", "\n", "")) Console.println("out: " + out.mkString("", "\n", "")) e.printStackTrace - Predef.error("Could not find element " + e.getMessage) + system.error("Could not find element " + e.getMessage) } /** ... diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index ec36e50205..03bb2bae3f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -46,7 +46,7 @@ abstract class TypeFlowAnalysis { def lub2(exceptional: Boolean)(s1: TypeStack, s2: TypeStack) = { if (s1 eq bottom) s2 else if (s2 eq bottom) s1 - else if ((s1 eq exceptionHandlerStack) || (s2 eq exceptionHandlerStack)) Predef.error("merging with exhan stack") + else if ((s1 eq exceptionHandlerStack) || (s2 eq exceptionHandlerStack)) system.error("merging with exhan stack") else { // if (s1.length != s2.length) // throw new CheckerException("Incompatible stacks: " + s1 + " and " + s2); diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index 4005b4e5c9..9b7bb3444a 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -300,7 +300,7 @@ abstract class Inliners extends SubComponent { def isMonadic = isMonadicMethod(sym) def handlers = m.exh - def blocks = if (m.code eq null) Predef.error("blocks = null + " + m) else m.code.blocks + def blocks = if (m.code eq null) system.error("blocks = null + " + m) else m.code.blocks def locals = m.locals def length = blocks.length def openBlocks = blocks filterNot (_.closed) diff --git a/src/compiler/scala/tools/nsc/interactive/BuildManager.scala b/src/compiler/scala/tools/nsc/interactive/BuildManager.scala index 302bba0e07..2827d97ae2 100644 --- a/src/compiler/scala/tools/nsc/interactive/BuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/BuildManager.scala @@ -51,7 +51,7 @@ object BuildManagerTest extends EvalLoop { def prompt = "builder > " - def error(msg: String) { + private def buildError(msg: String) { println(msg + "\n scalac -help gives more information") } @@ -67,7 +67,7 @@ object BuildManagerTest extends EvalLoop { Set.empty ++ result._1 } - val settings = new Settings(error) + val settings = new Settings(buildError) settings.Ybuildmanagerdebug.value = true val command = new CompilerCommand(args.toList, settings) // settings.make.value = "off" diff --git a/src/compiler/scala/tools/nsc/interactive/REPL.scala b/src/compiler/scala/tools/nsc/interactive/REPL.scala index 775b979851..4225460d1c 100644 --- a/src/compiler/scala/tools/nsc/interactive/REPL.scala +++ b/src/compiler/scala/tools/nsc/interactive/REPL.scala @@ -20,13 +20,13 @@ object REPL { var reporter: ConsoleReporter = _ - def error(msg: String) { + private def replError(msg: String) { reporter.error(/*new Position */FakePos("scalac"), msg + "\n scalac -help gives more information") } def process(args: Array[String]) { - val settings = new Settings(error) + val settings = new Settings(replError) reporter = new ConsoleReporter(settings) val command = new CompilerCommand(args.toList, settings) if (command.settings.version.value) @@ -56,7 +56,7 @@ object REPL { def main(args: Array[String]) { process(args) - exit(if (reporter.hasErrors) 1 else 0) + system.exit(if (reporter.hasErrors) 1 else 0) } def loop(action: (String) => Unit) { @@ -109,7 +109,7 @@ object REPL { case List("complete", file, off1) => doComplete(makePos(file, off1, off1)) case List("quit") => - System.exit(1) + system.exit(1) case _ => println("unrecongized command") } diff --git a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala index cf66c80b02..1853abebe8 100644 --- a/src/compiler/scala/tools/nsc/interactive/RangePositions.scala +++ b/src/compiler/scala/tools/nsc/interactive/RangePositions.scala @@ -190,7 +190,7 @@ self: scala.tools.nsc.Global => inform("") } - def error(msg: String)(body : => Unit) { + def positionError(msg: String)(body : => Unit) { inform("======= Bad positions: "+msg) inform("") body @@ -205,15 +205,15 @@ self: scala.tools.nsc.Global => def validate(tree: Tree, encltree: Tree): Unit = { if (!tree.isEmpty) { if (!tree.pos.isDefined) - error("Unpositioned tree ["+tree.id+"]") { reportTree("Unpositioned", tree) } + positionError("Unpositioned tree ["+tree.id+"]") { reportTree("Unpositioned", tree) } if (tree.pos.isRange) { if (!encltree.pos.isRange) - error("Synthetic tree ["+encltree.id+"] contains nonsynthetic tree ["+tree.id+"]") { + positionError("Synthetic tree ["+encltree.id+"] contains nonsynthetic tree ["+tree.id+"]") { reportTree("Enclosing", encltree) reportTree("Enclosed", tree) } if (!(encltree.pos includes tree.pos)) - error("Enclosing tree ["+encltree.id+"] does not include tree ["+tree.id+"]") { + positionError("Enclosing tree ["+encltree.id+"] does not include tree ["+tree.id+"]") { reportTree("Enclosing", encltree) reportTree("Enclosed", tree) } @@ -221,7 +221,7 @@ self: scala.tools.nsc.Global => findOverlapping(tree.children flatMap solidDescendants) match { case List() => ; case xs => { - error("Overlapping trees "+xs.map { case (x, y) => (x.id, y.id) }.mkString("", ", ", "")) { + positionError("Overlapping trees "+xs.map { case (x, y) => (x.id, y.id) }.mkString("", ", ", "")) { reportTree("Ancestor", tree) for((x, y) <- xs) { reportTree("First overlapping", x) diff --git a/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala b/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala index 57c38b209d..6e380027b6 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala @@ -199,6 +199,6 @@ object Tester { println("filenames = "+filenames) val files = filenames.toArray map (str => new BatchSourceFile(AbstractFile.getFile(str)): SourceFile) new Tester(args(0).toInt, files, settings).run() - System.exit(0) + system.exit(0) } } diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala index 840e457dd4..014fd62a0c 100644 --- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala @@ -21,7 +21,7 @@ trait InteractiveReader { def readLine(prompt: String): String = { def handler: Catcher[String] = { - case e: ClosedByInterruptException => error("Reader closed by interrupt.") + case e: ClosedByInterruptException => system.error("Reader closed by interrupt.") // Terminal has to be re-initialized after SIGSTP or up arrow etc. stop working. case e: IOException if restartSystemCall(e) => init() ; readLine(prompt) } diff --git a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala index fd090db89e..70f1ffa5a7 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala @@ -21,12 +21,12 @@ trait ReflectionCompletion extends CompletionAware { def reflectName(m: AccessibleObject) = m match { case x: reflect.Method => x.getName case x: reflect.Field => x.getName - case x => error(x.toString) + case x => system.error(x.toString) } def isPublic(m: AccessibleObject) = m match { case x: reflect.Method => Modifier isPublic x.getModifiers case x: reflect.Field => Modifier isPublic x.getModifiers - case x => error(x.toString) + case x => system.error(x.toString) } lazy val (staticMethods, instanceMethods) = clazz.getMethods.toList partition (x => isStatic(x.getModifiers)) diff --git a/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala b/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala index b4b1eca439..eac7530aa3 100644 --- a/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala +++ b/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala @@ -27,8 +27,8 @@ extends AbstractFile { var lastModified: Long = System.currentTimeMillis override def file = null - override def input = error("directories cannot be read") - override def output = error("directories cannot be written") + override def input = system.error("directories cannot be read") + override def output = system.error("directories cannot be written") /** Does this abstract file denote an existing file? */ def create { unsupported } diff --git a/src/compiler/scala/tools/nsc/plugins/Plugins.scala b/src/compiler/scala/tools/nsc/plugins/Plugins.scala index 5823a09995..c798fa89e1 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugins.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugins.scala @@ -75,7 +75,7 @@ trait Plugins /** Verify requirements are present. */ for (req <- settings.require.value ; if !(plugs exists (_.name == req))) - error("Missing required plugin: " + req) + globalError("Missing required plugin: " + req) /** Process plugin options. */ def namec(plug: Plugin) = plug.name + ":" @@ -86,12 +86,12 @@ trait Plugins for (p <- plugs) { val opts = doOpts(p) if (!opts.isEmpty) - p.processOptions(opts, error) + p.processOptions(opts, globalError) } /** Verify no non-existent plugin given with -P */ for (opt <- settings.pluginOptions.value ; if plugs forall (p => optList(List(opt), p).isEmpty)) - error("bad option: -P:" + opt) + globalError("bad option: -P:" + opt) plugs } diff --git a/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala index 790f4cce00..2ef73dc9a7 100644 --- a/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala @@ -34,7 +34,7 @@ trait AbsScalaSettings { /** **/ abstract class SettingGroup(val prefix: String) extends AbsSetting { def name = prefix - def helpDescription: String = error("todo") + def helpDescription: String = system.error("todo") def unparse: List[String] = List(name) } } diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index d168c259e9..77428f127d 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -66,7 +66,7 @@ abstract class SymbolLoaders { ok = false if (settings.debug.value) ex.printStackTrace() val msg = ex.getMessage() - error( + globalError( if (msg eq null) "i/o error while loading " + root.name else "error while loading " + root.name + ", " + msg); } diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 3d19ceb04f..95d278a7a5 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -363,12 +363,12 @@ abstract class ICodeReader extends ClassfileParser { case JVM.pop => code.emit(DROP(INT)) // any 1-word type would do case JVM.pop2 => code.emit(DROP(LONG)) // any 2-word type would do case JVM.dup => code.emit(DUP(ObjectReference)) // TODO: Is the kind inside DUP ever needed? - case JVM.dup_x1 => code.emit(DUP_X1) // Predef.error("Unsupported JVM bytecode: dup_x1") - case JVM.dup_x2 => code.emit(DUP_X2) // Predef.error("Unsupported JVM bytecode: dup_x2") + case JVM.dup_x1 => code.emit(DUP_X1) // system.error("Unsupported JVM bytecode: dup_x1") + case JVM.dup_x2 => code.emit(DUP_X2) // system.error("Unsupported JVM bytecode: dup_x2") case JVM.dup2 => code.emit(DUP(LONG)) // TODO: Is the kind inside DUP ever needed? - case JVM.dup2_x1 => code.emit(DUP2_X1) // Predef.error("Unsupported JVM bytecode: dup2_x1") - case JVM.dup2_x2 => code.emit(DUP2_X2) // Predef.error("Unsupported JVM bytecode: dup2_x2") - case JVM.swap => Predef.error("Unsupported JVM bytecode: swap") + case JVM.dup2_x1 => code.emit(DUP2_X1) // system.error("Unsupported JVM bytecode: dup2_x1") + case JVM.dup2_x2 => code.emit(DUP2_X2) // system.error("Unsupported JVM bytecode: dup2_x2") + case JVM.swap => system.error("Unsupported JVM bytecode: swap") case JVM.iadd => code.emit(CALL_PRIMITIVE(Arithmetic(ADD, INT))) case JVM.ladd => code.emit(CALL_PRIMITIVE(Arithmetic(ADD, LONG))) @@ -455,8 +455,8 @@ abstract class ICodeReader extends ClassfileParser { case JVM.if_acmpne => code.emit(LCJUMP(parseJumpTarget, pc + size, NE, ObjectReference)) case JVM.goto => emit(LJUMP(parseJumpTarget)) - case JVM.jsr => Predef.error("Cannot handle jsr/ret") - case JVM.ret => Predef.error("Cannot handle jsr/ret") + case JVM.jsr => system.error("Cannot handle jsr/ret") + case JVM.ret => system.error("Cannot handle jsr/ret") case JVM.tableswitch => val padding = if ((pc + size) % 4 != 0) 4 - ((pc + size) % 4) else 0 size += padding @@ -581,14 +581,14 @@ abstract class ICodeReader extends ClassfileParser { case JVM.fstore => code.emit(STORE_LOCAL(code.getLocal(in.nextChar, FLOAT))); size += 2 case JVM.dstore => code.emit(STORE_LOCAL(code.getLocal(in.nextChar, DOUBLE))); size += 2 case JVM.astore => code.emit(STORE_LOCAL(code.getLocal(in.nextChar, ObjectReference))); size += 2 - case JVM.ret => Predef.error("Cannot handle jsr/ret") + case JVM.ret => system.error("Cannot handle jsr/ret") case JVM.iinc => size += 4 val local = code.getLocal(in.nextChar, INT) code.emit(CONSTANT(Constant(in.nextChar))) code.emit(CALL_PRIMITIVE(Arithmetic(ADD, INT))) code.emit(STORE_LOCAL(local)) - case _ => Predef.error("Invalid 'wide' operand") + case _ => system.error("Invalid 'wide' operand") } case JVM.multianewarray => @@ -601,9 +601,9 @@ abstract class ICodeReader extends ClassfileParser { case JVM.ifnull => code.emit(LCZJUMP(parseJumpTarget, pc + size, EQ, ObjectReference)) case JVM.ifnonnull => code.emit(LCZJUMP(parseJumpTarget, pc + size, NE, ObjectReference)) case JVM.goto_w => code.emit(LJUMP(parseJumpTargetW)) - case JVM.jsr_w => Predef.error("Cannot handle jsr/ret") + case JVM.jsr_w => system.error("Cannot handle jsr/ret") -// case _ => Predef.error("Unknown bytecode") +// case _ => system.error("Unknown bytecode") } pc += size } @@ -970,12 +970,12 @@ abstract class ICodeReader extends ClassfileParser { def checkValidIndex { locals.get(idx - 1) match { case Some(others) if others exists (_._2.isWideType) => - error("Illegal index: " + idx + " points in the middle of another local") + global.globalError("Illegal index: " + idx + " points in the middle of another local") case _ => () } kind match { case LONG | DOUBLE if (locals.isDefinedAt(idx + 1)) => - error("Illegal index: " + idx + " overlaps " + locals(idx + 1)) + global.globalError("Illegal index: " + idx + " overlaps " + locals(idx + 1)) case _ => () } } diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index ad07cd908c..8a94442d5a 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -450,7 +450,7 @@ abstract class ExplicitOuter extends InfoTransform if (sym.isClassConstructor) { rhs match { case Literal(_) => - Predef.error("unexpected case") //todo: remove + system.error("unexpected case") //todo: remove case _ => val clazz = sym.owner val vparamss1 = diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 497450c6c4..a9f6d39cc1 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -580,7 +580,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers with ast.Tr val args1 = transformTrees(fn.symbol.name match { case nme.unapply => args case nme.unapplySeq => transformArgs(tree.pos, fn.symbol, args, analyzer.unapplyTypeListFromReturnTypeSeq(fn.tpe)) - case _ => Predef.error("internal error: UnApply node has wrong symbol") + case _ => system.error("internal error: UnApply node has wrong symbol") }) treeCopy.UnApply(tree, fn1, args1) diff --git a/src/compiler/scala/tools/nsc/util/MsilClassPath.scala b/src/compiler/scala/tools/nsc/util/MsilClassPath.scala index 5511326a6b..019f40d72f 100644 --- a/src/compiler/scala/tools/nsc/util/MsilClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/MsilClassPath.scala @@ -112,7 +112,7 @@ class AssemblyClassPath(types: Array[MSILType], namespace: String, val context: else namespace drop (i + 1) } def asURLs = List(new java.net.URL(name)) - def asClasspathString = error("Unknown") // I don't know what if anything makes sense here? + def asClasspathString = system.error("Unknown") // I don't know what if anything makes sense here? private lazy val first: Int = { var m = 0 diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala index 58abd721c5..a11038104b 100644 --- a/src/compiler/scala/tools/nsc/util/ShowPickled.scala +++ b/src/compiler/scala/tools/nsc/util/ShowPickled.scala @@ -28,10 +28,10 @@ object ShowPickled extends Names { } def readName = if (isName) new String(bytes, "UTF-8") - else error("%s is no name" format tagName) + else system.error("%s is no name" format tagName) def nameIndex = if (hasName) readNat(bytes, 0) - else error("%s has no name" format tagName) + else system.error("%s has no name" format tagName) def tagName = tag2string(tag) override def toString = "%d,%d: %s".format(num, startIndex, tagName) diff --git a/src/compiler/scala/tools/reflect/Mock.scala b/src/compiler/scala/tools/reflect/Mock.scala index 1c5c880113..56bef2caa4 100644 --- a/src/compiler/scala/tools/reflect/Mock.scala +++ b/src/compiler/scala/tools/reflect/Mock.scala @@ -53,7 +53,7 @@ object Mock { /** Tries to implement all the class's interfaces. */ def fromClass(clazz: Class[_])(pf: PartialFunction[Invoked, AnyRef]): AnyRef = allInterfaces(clazz) match { - case Nil => Predef.error(clazz + " implements no interfaces.") + case Nil => system.error(clazz + " implements no interfaces.") case x :: xs => fromInterfaces(x, xs: _*)(pf) } } diff --git a/src/compiler/scala/tools/util/SocketServer.scala b/src/compiler/scala/tools/util/SocketServer.scala index 88d7013f36..f647660193 100644 --- a/src/compiler/scala/tools/util/SocketServer.scala +++ b/src/compiler/scala/tools/util/SocketServer.scala @@ -42,7 +42,7 @@ abstract class SocketServer def fatal(msg: String): Nothing = { System.err.println(msg) - exit(1) + system.exit(1) } private def warn(msg: String) { diff --git a/src/continuations/library/scala/util/continuations/ControlContext.scala b/src/continuations/library/scala/util/continuations/ControlContext.scala index 87a9bf1fc5..a97b8c8279 100644 --- a/src/continuations/library/scala/util/continuations/ControlContext.scala +++ b/src/continuations/library/scala/util/continuations/ControlContext.scala @@ -14,7 +14,7 @@ private class cpsMinus extends Annotation // implementation detail -@serializable final class ControlContext[+A,-B,+C](val fun: (A => B, Exception => B) => C, val x: A) { +final class ControlContext[+A,-B,+C](val fun: (A => B, Exception => B) => C, val x: A) extends Serializable { /* final def map[A1](f: A => A1): ControlContext[A1,B,C] = { diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala index e916f7c916..9f38b9c15a 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala @@ -326,7 +326,7 @@ abstract class CPSAnnotationChecker extends CPSUtils { def single(xs: List[AnnotationInfo]) = xs match { case List(x) => x case _ => - global.error("not a single cps annotation: " + xs)// FIXME: error message + global.globalError("not a single cps annotation: " + xs)// FIXME: error message xs(0) } diff --git a/src/dbc/scala/dbc/datatype/Factory.scala b/src/dbc/scala/dbc/datatype/Factory.scala index d652556722..a5e69d5471 100644 --- a/src/dbc/scala/dbc/datatype/Factory.scala +++ b/src/dbc/scala/dbc/datatype/Factory.scala @@ -234,17 +234,17 @@ object Factory { } /* Unsupported data types. */ case REF | ARRAY | STRUCT => - error ("I don't support composite data types yet."); + system.error ("I don't support composite data types yet."); case DATALINK | DISTINCT | JAVA_OBJECT | NULL => - error ("I won't support strange data types."); + system.error ("I won't support strange data types."); /* Unsupported binary string data types. */ case BINARY | BLOB | LONGVARBINARY | VARBINARY => - error ("I don't support binary string data types yet."); + system.error ("I don't support binary string data types yet."); /* Unsupported date and time data types. */ case DATE | TIME | TIMESTAMP => - error ("I don't support date and time data types yet."); + system.error ("I don't support date and time data types yet."); /* Default case */ - case x => error ("I don't know about this ("+metadata.getColumnTypeName(index)+") JDBC type.") + case x => system.error ("I don't know about this ("+metadata.getColumnTypeName(index)+") JDBC type.") } } } diff --git a/src/dbc/scala/dbc/datatype/Unknown.scala b/src/dbc/scala/dbc/datatype/Unknown.scala index ef8ab1036c..21afaea22d 100644 --- a/src/dbc/scala/dbc/datatype/Unknown.scala +++ b/src/dbc/scala/dbc/datatype/Unknown.scala @@ -29,6 +29,6 @@ class Unknown extends DataType { /** A SQL-99 compliant string representation of the type. */ override def sqlString: java.lang.String = - error("The 'UNKNOWN' data type cannot be represented."); + system.error("The 'UNKNOWN' data type cannot be represented."); } diff --git a/src/dbc/scala/dbc/result/Relation.scala b/src/dbc/scala/dbc/result/Relation.scala index 45f3b625d8..0427269ffd 100644 --- a/src/dbc/scala/dbc/result/Relation.scala +++ b/src/dbc/scala/dbc/result/Relation.scala @@ -75,7 +75,7 @@ abstract class Relation extends AnyRef with Iterable[Tuple] { resultNext = result.next() newTuple } - else error("next on empty iterator") + else system.error("next on empty iterator") } } diff --git a/src/dbc/scala/dbc/statement/Select.scala b/src/dbc/scala/dbc/statement/Select.scala index 1e432e2277..07d7d26c6f 100644 --- a/src/dbc/scala/dbc/statement/Select.scala +++ b/src/dbc/scala/dbc/statement/Select.scala @@ -67,7 +67,7 @@ abstract class Select extends Relation { ((name:String, dc:DerivedColumn) => name + ", " + dc.sqlString)) }) + (fromClause match { - case Nil => error("Empty from clause is not allowed") + case Nil => system.error("Empty from clause is not allowed") case _ => (" FROM " + fromClause.tail.foldLeft(fromClause.head.sqlInnerString) ((name:String, rel:Relation) => name + ", " + rel.sqlInnerString)) }) + @@ -78,7 +78,7 @@ abstract class Select extends Relation { (groupByClause match { case None => "" case Some(gbl) => gbl match { - case Nil => error("Empty group by clause is not allowed") + case Nil => system.error("Empty group by clause is not allowed") case _ => (" GROUP BY " + gbl.tail.foldLeft(gbl.head.sqlInnerString) diff --git a/src/dbc/scala/dbc/statement/expression/SetFunction.scala b/src/dbc/scala/dbc/statement/expression/SetFunction.scala index 36061b013c..48a675a405 100644 --- a/src/dbc/scala/dbc/statement/expression/SetFunction.scala +++ b/src/dbc/scala/dbc/statement/expression/SetFunction.scala @@ -35,6 +35,6 @@ object SetFunction { ); } abstract class Binary extends SetFunction { - def sqlString = error("Binary set function is not supported yet."); + def sqlString = system.error("Binary set function is not supported yet."); } } diff --git a/src/dbc/scala/dbc/value/Unknown.scala b/src/dbc/scala/dbc/value/Unknown.scala index 46e8a39e42..2c56bbf36e 100644 --- a/src/dbc/scala/dbc/value/Unknown.scala +++ b/src/dbc/scala/dbc/value/Unknown.scala @@ -16,7 +16,7 @@ abstract class Unknown extends Value { val dataType: datatype.Unknown; - def sqlString = error ("An 'ANY' value cannot be represented."); + def sqlString = system.error("An 'ANY' value cannot be represented."); } diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 55a488f625..700b5bfbac 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -181,7 +181,7 @@ object Predef extends LowPriorityImplicits { def print(x: Any) = Console.print(x) def println() = Console.println() def println(x: Any) = Console.println(x) - def printf(text: String, xs: Any*) = Console.print(format(text, xs: _*)) + def printf(text: String, xs: Any*) = Console.print(text.format(xs: _*)) @deprecated("Use formatString.format(args: _*) or arg.formatted(formatString) instead") def format(text: String, xs: Any*) = augmentString(text).format(xs: _*) diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala index 448210a330..4a7a10c6c1 100644 --- a/src/library/scala/collection/immutable/HashMap.scala +++ b/src/library/scala/collection/immutable/HashMap.scala @@ -467,7 +467,7 @@ time { mNew.iterator.foreach( p => ()) } new HashTrieMap[A, B1](this.bitmap | that.bitmap, merged, totalelems) case hm: HashMapCollision1[_, _] => that.merge0(this, level, merger) case hm: HashMap[_, _] => this - case _ => error("section supposed to be unreachable.") + case _ => system.error("section supposed to be unreachable.") } } @@ -586,7 +586,7 @@ time { mNew.iterator.foreach( p => ()) } val arr: Array[HashMap[A, B]] = arrayD(posD) match { case c: HashMapCollision1[a, b] => collisionToArray(c).asInstanceOf[Array[HashMap[A, B]]] case ht: HashTrieMap[_, _] => ht.asInstanceOf[HashTrieMap[A, B]].elems - case _ => error("cannot divide single element") + case _ => system.error("cannot divide single element") } arrayToIterators(arr) } else { diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala index 1fe790145d..8d52908349 100644 --- a/src/library/scala/collection/immutable/HashSet.scala +++ b/src/library/scala/collection/immutable/HashSet.scala @@ -168,12 +168,12 @@ object HashSet extends ImmutableSetFactory[HashSet] { // hash codes and remove the collision. however this is never called // because no references to this class are ever handed out to client code // and HashTrieSet serialization takes care of the situation - error("cannot serialize an immutable.HashSet where all items have the same 32-bit hash code") + system.error("cannot serialize an immutable.HashSet where all items have the same 32-bit hash code") //out.writeObject(kvs) } private def readObject(in: java.io.ObjectInputStream) { - error("cannot deserialize an immutable.HashSet where all items have the same 32-bit hash code") + system.error("cannot deserialize an immutable.HashSet where all items have the same 32-bit hash code") //kvs = in.readObject().asInstanceOf[ListSet[A]] //hash = computeHash(kvs.) } @@ -398,7 +398,7 @@ time { mNew.iterator.foreach( p => ()) } val arr: Array[HashSet[A]] = arrayD(posD) match { case c: HashSetCollision1[a] => collisionToArray(c).asInstanceOf[Array[HashSet[A]]] case ht: HashTrieSet[_] => ht.asInstanceOf[HashTrieSet[A]].elems - case _ => error("cannot divide single element") + case _ => system.error("cannot divide single element") } arrayToIterators(arr) } else { diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala index d4605d3e1f..e16c287345 100644 --- a/src/library/scala/collection/immutable/IntMap.scala +++ b/src/library/scala/collection/immutable/IntMap.scala @@ -141,7 +141,7 @@ private[immutable] abstract class IntMapIterator[V, T](it : IntMap[V]) extends I case t@IntMap.Tip(_, _) => valueOf(t); // This should never happen. We don't allow IntMap.Nil in subtrees of the IntMap // and don't return an IntMapIterator for IntMap.Nil. - case IntMap.Nil => error("Empty maps not allowed as subtrees"); + case IntMap.Nil => system.error("Empty maps not allowed as subtrees"); } } @@ -277,8 +277,8 @@ sealed abstract class IntMap[+T] extends Map[Int, T] with MapLike[Int, T, IntMap final override def apply(key : Int) : T = this match { case IntMap.Bin(prefix, mask, left, right) => if (zero(key, mask)) left(key) else right(key); - case IntMap.Tip(key2, value) => if (key == key2) value else error("Key not found"); - case IntMap.Nil => error("key not found"); + case IntMap.Tip(key2, value) => if (key == key2) value else system.error("Key not found"); + case IntMap.Nil => system.error("key not found"); } def + [S >: T] (kv: (Int, S)): IntMap[S] = updated(kv._1, kv._2) @@ -440,7 +440,7 @@ sealed abstract class IntMap[+T] extends Map[Int, T] with MapLike[Int, T, IntMap final def firstKey : Int = this match { case Bin(_, _, l, r) => l.firstKey; case Tip(k, v) => k; - case IntMap.Nil => error("Empty set") + case IntMap.Nil => system.error("Empty set") } /** @@ -449,6 +449,6 @@ sealed abstract class IntMap[+T] extends Map[Int, T] with MapLike[Int, T, IntMap final def lastKey : Int = this match { case Bin(_, _, l, r) => r.lastKey; case Tip(k, v) => k; - case IntMap.Nil => error("Empty set") + case IntMap.Nil => system.error("Empty set") } } diff --git a/src/library/scala/collection/immutable/LongMap.scala b/src/library/scala/collection/immutable/LongMap.scala index dcdc6e948f..54538b6b2d 100644 --- a/src/library/scala/collection/immutable/LongMap.scala +++ b/src/library/scala/collection/immutable/LongMap.scala @@ -138,7 +138,7 @@ private[immutable] abstract class LongMapIterator[V, T](it : LongMap[V]) extends case t@LongMap.Tip(_, _) => valueOf(t); // This should never happen. We don't allow LongMap.Nil in subtrees of the LongMap // and don't return an LongMapIterator for LongMap.Nil. - case LongMap.Nil => error("Empty maps not allowed as subtrees"); + case LongMap.Nil => system.error("Empty maps not allowed as subtrees"); } } @@ -275,8 +275,8 @@ sealed abstract class LongMap[+T] extends Map[Long, T] with MapLike[Long, T, Lon final override def apply(key : Long) : T = this match { case LongMap.Bin(prefix, mask, left, right) => if (zero(key, mask)) left(key) else right(key); - case LongMap.Tip(key2, value) => if (key == key2) value else error("Key not found"); - case LongMap.Nil => error("key not found"); + case LongMap.Tip(key2, value) => if (key == key2) value else system.error("Key not found"); + case LongMap.Nil => system.error("key not found"); } def + [S >: T] (kv: (Long, S)): LongMap[S] = updated(kv._1, kv._2) diff --git a/src/library/scala/collection/immutable/RedBlack.scala b/src/library/scala/collection/immutable/RedBlack.scala index d8c16f5ac1..3c09db7407 100644 --- a/src/library/scala/collection/immutable/RedBlack.scala +++ b/src/library/scala/collection/immutable/RedBlack.scala @@ -98,7 +98,7 @@ abstract class RedBlack[A] extends Serializable { } def subl(t: Tree[B]) = t match { case BlackTree(x, xv, a, b) => RedTree(x, xv, a, b) - case _ => error("Defect: invariance violation; expected black, got "+t) + case _ => system.error("Defect: invariance violation; expected black, got "+t) } def balLeft(x: A, xv: B, tl: Tree[B], tr: Tree[B]) = (tl, tr) match { case (RedTree(y, yv, a, b), c) => @@ -107,7 +107,7 @@ abstract class RedBlack[A] extends Serializable { balance(x, xv, bl, RedTree(y, yv, a, b)) case (bl, RedTree(y, yv, BlackTree(z, zv, a, b), c)) => RedTree(z, zv, BlackTree(x, xv, bl, a), balance(y, yv, b, subl(c))) - case _ => error("Defect: invariance violation at "+right) + case _ => system.error("Defect: invariance violation at "+right) } def balRight(x: A, xv: B, tl: Tree[B], tr: Tree[B]) = (tl, tr) match { case (a, RedTree(y, yv, b, c)) => @@ -116,7 +116,7 @@ abstract class RedBlack[A] extends Serializable { balance(x, xv, RedTree(y, yv, a, b), bl) case (RedTree(y, yv, a, BlackTree(z, zv, b, c)), bl) => RedTree(z, zv, balance(y, yv, subl(a), b), BlackTree(x, xv, c, bl)) - case _ => error("Defect: invariance violation at "+left) + case _ => system.error("Defect: invariance violation at "+left) } def delLeft = left match { case _: BlackTree[_] => balLeft(key, value, left.del(k), right) @@ -237,7 +237,7 @@ abstract class RedBlack[A] extends Serializable { case (_: BlackTree[B]) :: tail => if (depth == 1) zipper else findDepth(tail, depth - 1) case _ :: tail => findDepth(tail, depth) - case Nil => error("Defect: unexpected empty zipper while computing range") + case Nil => system.error("Defect: unexpected empty zipper while computing range") } // Blackening the smaller tree avoids balancing problems on union; diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala index 909324f87c..9de466e04c 100644 --- a/src/library/scala/collection/mutable/ArrayStack.scala +++ b/src/library/scala/collection/mutable/ArrayStack.scala @@ -114,7 +114,7 @@ extends Seq[T] * @return the element on top of the stack */ def pop: T = { - if (index == 0) error("Stack empty") + if (index == 0) system.error("Stack empty") index -= 1 val x = table(index).asInstanceOf[T] table(index) = null diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala index b10b88049e..418c35d7d6 100644 --- a/src/library/scala/collection/mutable/OpenHashMap.scala +++ b/src/library/scala/collection/mutable/OpenHashMap.scala @@ -196,7 +196,7 @@ extends Map[Key, Value] val initialModCount = modCount; private[this] def advance { - if (initialModCount != modCount) error("Concurrent modification"); + if (initialModCount != modCount) system.error("Concurrent modification"); while((index <= mask) && (table(index) == null || table(index).value == None)) index+=1; } @@ -233,7 +233,7 @@ extends Map[Key, Value] override def foreach[U](f : ((Key, Value)) => U) { val startModCount = modCount; foreachUndeletedEntry(entry => { - if (modCount != startModCount) error("Concurrent Modification") + if (modCount != startModCount) system.error("Concurrent Modification") f((entry.key, entry.value.get))} ); } diff --git a/src/library/scala/collection/parallel/Tasks.scala b/src/library/scala/collection/parallel/Tasks.scala index c58bc8b734..6f0fe47a6a 100644 --- a/src/library/scala/collection/parallel/Tasks.scala +++ b/src/library/scala/collection/parallel/Tasks.scala @@ -204,7 +204,7 @@ trait ForkJoinTasks extends Tasks with HavingForkJoinPool { * $fjdispatch */ def execute[R, Tp](fjtask: Task[R, Tp]): () => R = { - if (currentThread.isInstanceOf[ForkJoinWorkerThread]) { + if (Thread.currentThread.isInstanceOf[ForkJoinWorkerThread]) { fjtask.fork } else { forkJoinPool.execute(fjtask) @@ -225,7 +225,7 @@ trait ForkJoinTasks extends Tasks with HavingForkJoinPool { * @return the result of the task */ def executeAndWaitResult[R, Tp](fjtask: Task[R, Tp]): R = { - if (currentThread.isInstanceOf[ForkJoinWorkerThread]) { + if (Thread.currentThread.isInstanceOf[ForkJoinWorkerThread]) { fjtask.fork } else { forkJoinPool.execute(fjtask) diff --git a/src/library/scala/collection/parallel/package.scala b/src/library/scala/collection/parallel/package.scala index e1556a1092..8cd54e6083 100644 --- a/src/library/scala/collection/parallel/package.scala +++ b/src/library/scala/collection/parallel/package.scala @@ -211,7 +211,7 @@ package object parallel { afterCombine(other) this - } else error("Unexpected combiner type.") + } else system.error("Unexpected combiner type.") } else this } diff --git a/src/library/scala/mobile/Code.scala b/src/library/scala/mobile/Code.scala index fb43de27ab..677248aabb 100644 --- a/src/library/scala/mobile/Code.scala +++ b/src/library/scala/mobile/Code.scala @@ -196,7 +196,7 @@ class Code(clazz: java.lang.Class[_]) { if (cs.length > 0) { cs(0).newInstance("").asInstanceOf[AnyRef] } else { - error("class " + clazz.getName() + " has no public constructor") + system.error("class " + clazz.getName() + " has no public constructor") null } } diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala index 3ad5b30f7b..ad90b222c2 100644 --- a/src/library/scala/util/control/Exception.scala +++ b/src/library/scala/util/control/Exception.scala @@ -23,16 +23,17 @@ import java.lang.reflect.InvocationTargetException object Exception { type Catcher[+T] = PartialFunction[Throwable, T] - def mkCatcher[Ex <: Throwable, T](isDef: Ex => Boolean, f: Ex => T) = new Catcher[T] { + def mkCatcher[Ex <: Throwable: ClassManifest, T](isDef: Ex => Boolean, f: Ex => T) = new Catcher[T] { private def downcast(x: Throwable): Option[Ex] = - if (x.isInstanceOf[Ex]) Some(x.asInstanceOf[Ex]) else None + if (classManifest[Ex].erasure.isAssignableFrom(x.getClass)) Some(x.asInstanceOf[Ex]) + else None def isDefinedAt(x: Throwable) = downcast(x) exists isDef def apply(x: Throwable): T = f(downcast(x).get) } def mkThrowableCatcher[T](isDef: Throwable => Boolean, f: Throwable => T) = mkCatcher(isDef, f) - implicit def throwableSubtypeToCatcher[Ex <: Throwable, T](pf: PartialFunction[Ex, T]) = + implicit def throwableSubtypeToCatcher[Ex <: Throwable: ClassManifest, T](pf: PartialFunction[Ex, T]) = mkCatcher(pf.isDefinedAt _, pf.apply _) /** !!! Not at all sure of every factor which goes into this, diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala index 3de283107e..9e69d73f44 100644 --- a/src/library/scala/util/parsing/combinator/Parsers.scala +++ b/src/library/scala/util/parsing/combinator/Parsers.scala @@ -137,7 +137,7 @@ trait Parsers { def flatMapWithNext[U](f: Nothing => Input => ParseResult[U]): ParseResult[U] = this - def get: Nothing = error("No result when parsing failed") + def get: Nothing = system.error("No result when parsing failed") } /** An extractor so NoSuccess(msg, next) can be used in matches. */ diff --git a/src/library/scala/xml/dtd/ContentModelParser.scala b/src/library/scala/xml/dtd/ContentModelParser.scala index 199aa3492d..d98b031744 100644 --- a/src/library/scala/xml/dtd/ContentModelParser.scala +++ b/src/library/scala/xml/dtd/ContentModelParser.scala @@ -21,10 +21,10 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning # def accept(tok: Int) = { if (token != tok) { if ((tok == STAR) && (token == END)) // common mistake - error("in DTDs, \n"+ + system.error("in DTDs, \n"+ "mixed content models must be like (#PCDATA|Name|Name|...)*"); else - error("expected "+token2string(tok)+ + system.error("expected "+token2string(tok)+ ", got unexpected token:"+token2string(token)); } nextToken @@ -45,7 +45,7 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning # case NAME => value match { case "ANY" => ANY case "EMPTY" => EMPTY - case _ => error("expected ANY, EMPTY or '(' instead of " + value ); + case _ => system.error("expected ANY, EMPTY or '(' instead of " + value ); } case LPAREN => @@ -65,12 +65,12 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning # accept( STAR ); res case _ => - error("unexpected token:" + token2string(token) ); + system.error("unexpected token:" + token2string(token) ); } } case _ => - error("unexpected token:" + token2string(token) ); + system.error("unexpected token:" + token2string(token) ); } // sopt ::= S? def sOpt = if( token == S ) nextToken; @@ -118,12 +118,12 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning # def particle = token match { case LPAREN => nextToken; sOpt; regexp; case NAME => val a = Letter(ElemName(value)); nextToken; maybeSuffix(a) - case _ => error("expected '(' or Name, got:"+token2string(token)); + case _ => system.error("expected '(' or Name, got:"+token2string(token)); } // atom ::= name def atom = token match { case NAME => val a = Letter(ElemName(value)); nextToken; a - case _ => error("expected Name, got:"+token2string(token)); + case _ => system.error("expected Name, got:"+token2string(token)); } } diff --git a/src/library/scala/xml/dtd/Scanner.scala b/src/library/scala/xml/dtd/Scanner.scala index b8dc2b070b..0b2daa3284 100644 --- a/src/library/scala/xml/dtd/Scanner.scala +++ b/src/library/scala/xml/dtd/Scanner.scala @@ -44,7 +44,7 @@ class Scanner extends Tokens with parsing.TokenTests { final def next = if (it.hasNext) c = it.next else c = ENDCH final def acc(d: Char) { - if (c == d) next else error("expected '"+d+"' found '"+c+"' !"); + if (c == d) next else system.error("expected '"+d+"' found '"+c+"' !"); } final def accS(ds: Seq[Char]) { ds foreach acc } @@ -65,7 +65,7 @@ class Scanner extends Tokens with parsing.TokenTests { case ENDCH => END case _ => if (isNameStart(c)) name; // NAME - else { error("unexpected character:"+c); END } + else { system.error("unexpected character:"+c); END } } final def name = { diff --git a/src/library/scala/xml/include/sax/Main.scala b/src/library/scala/xml/include/sax/Main.scala index ed2e5ebf37..8dcdb34084 100644 --- a/src/library/scala/xml/include/sax/Main.scala +++ b/src/library/scala/xml/include/sax/Main.scala @@ -29,12 +29,12 @@ object Main { */ def main(args: Array[String]) { def saxe[T](body: => T) = catching[T](classOf[SAXException]) opt body - def error(msg: String) = System.err.println(msg) + def fail(msg: String) = System.err.println(msg) val parser: XMLReader = saxe[XMLReader](XMLReaderFactory.createXMLReader()) getOrElse ( saxe[XMLReader](XMLReaderFactory.createXMLReader(XercesClassName)) getOrElse ( - return error("Could not find an XML parser") + return fail("Could not find an XML parser") ) ) @@ -53,7 +53,7 @@ object Main { val r = Class.forName(args(1)).newInstance().asInstanceOf[EntityResolver] parser setEntityResolver r r - } orElse (return error("Could not load requested EntityResolver")) + } orElse (return fail("Could not load requested EntityResolver")) for (arg <- args2) { try { @@ -72,10 +72,10 @@ object Main { } catch { case e: SAXParseException => - error(e.toString) - error("Problem in %s at line %d".format(e.getSystemId, e.getLineNumber)) + fail(e.toString) + fail("Problem in %s at line %d".format(e.getSystemId, e.getLineNumber)) case e: SAXException => - error(e.toString) + fail(e.toString) } } } diff --git a/src/library/scala/xml/parsing/MarkupParser.scala b/src/library/scala/xml/parsing/MarkupParser.scala index 4d9edcee66..c1cb5a197a 100644 --- a/src/library/scala/xml/parsing/MarkupParser.scala +++ b/src/library/scala/xml/parsing/MarkupParser.scala @@ -866,7 +866,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests new PublicID(pubID, sysID); } else { reportSyntaxError("PUBLIC or SYSTEM expected"); - error("died parsing notationdecl") + system.error("died parsing notationdecl") } xSpaceOpt xToken('>') diff --git a/src/library/scala/xml/parsing/MarkupParserCommon.scala b/src/library/scala/xml/parsing/MarkupParserCommon.scala index 936515852b..df7b4b83e9 100644 --- a/src/library/scala/xml/parsing/MarkupParserCommon.scala +++ b/src/library/scala/xml/parsing/MarkupParserCommon.scala @@ -24,7 +24,7 @@ import MarkupParserCommon._ * All members should be accessed through those. */ private[scala] trait MarkupParserCommon extends TokenTests { - protected def unreachable = Predef.error("Cannot be reached.") + protected def unreachable = system.error("Cannot be reached.") // type HandleType // MarkupHandler, SymbolicXMLBuilder type InputType // Source, CharArrayReader @@ -85,7 +85,7 @@ private[scala] trait MarkupParserCommon extends TokenTests { case `end` => return buf.toString case ch => buf append ch } - error("Expected '%s'".format(end)) + system.error("Expected '%s'".format(end)) } /** [42] '<' xmlEndTag ::= '<' '/' Name S? '>' diff --git a/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala b/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala index c02d1e1242..12d0205469 100644 --- a/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala +++ b/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala @@ -35,7 +35,7 @@ abstract class ValidatingMarkupHandler extends MarkupHandler with Logged { val res = decl.contentModel.validate(ns); Console.println("res = "+res); if(!res) - //error("invalid!"); + //system.error("invalid!"); } */ diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala index 4f829a99ed..043c48e968 100644 --- a/src/partest/scala/tools/partest/PartestTask.scala +++ b/src/partest/scala/tools/partest/PartestTask.scala @@ -192,7 +192,7 @@ class PartestTask extends Task with CompilationPathProperty { srcDir foreach (x => setProp("partest.srcdir", x)) - val classpath = this.compilationPath getOrElse error("Mandatory attribute 'compilationPath' is not set.") + val classpath = this.compilationPath getOrElse system.error("Mandatory attribute 'compilationPath' is not set.") val scalaLibrary = { (classpath.list map { fs => new File(fs) }) find { f => @@ -202,7 +202,7 @@ class PartestTask extends Task with CompilationPathProperty { case _ => false } } - } getOrElse error("Provided classpath does not contain a Scala library.") + } getOrElse system.error("Provided classpath does not contain a Scala library.") val antRunner = new scala.tools.partest.nest.AntRunner val antFileManager = antRunner.fileManager @@ -262,7 +262,7 @@ class PartestTask extends Task with CompilationPathProperty { val allFailures = _results map (_._2) sum val allFailedPaths = _results flatMap (_._3) - def f = if (errorOnFailed && allFailures > 0) error(_) else log(_: String) + def f = if (errorOnFailed && allFailures > 0) (system error _) else log(_: String) def s = if (allFailures > 1) "s" else "" val msg = if (allFailures > 0) diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala index 58d16a3f45..01b4d848f8 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala @@ -62,7 +62,7 @@ class ConsoleFileManager extends FileManager { if (!srcDir.isDirectory) { NestUI.failure("Source directory \"" + srcDir.path + "\" not found") - exit(1) + system.exit(1) } CLASSPATH = { diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala index 4a632a98d5..df8f1a5f74 100644 --- a/src/partest/scala/tools/partest/nest/NestUI.scala +++ b/src/partest/scala/tools/partest/nest/NestUI.scala @@ -98,7 +98,7 @@ object NestUI { println println(utils.Properties.versionString) println("maintained by Philipp Haller (EPFL)") - exit(1) + system.exit(1) } var _verbose = false diff --git a/src/partest/scala/tools/partest/nest/PathSettings.scala b/src/partest/scala/tools/partest/nest/PathSettings.scala index 5ae1ed05ce..ea44d30613 100644 --- a/src/partest/scala/tools/partest/nest/PathSettings.scala +++ b/src/partest/scala/tools/partest/nest/PathSettings.scala @@ -15,14 +15,14 @@ import java.net.URLClassLoader object PathSettings { import PartestDefaults.{ testRootDir, srcDirName } - private def cwd = Directory.Current getOrElse error("user.dir property not set") + private def cwd = Directory.Current getOrElse system.error("user.dir property not set") private def isPartestDir(d: Directory) = (d.name == "test") && (d / srcDirName isDirectory) // Directory <root>/test lazy val testRoot: Directory = testRootDir getOrElse { val candidates: List[Directory] = (cwd :: cwd.parents) flatMap (d => List(d, Directory(d / "test"))) - candidates find isPartestDir getOrElse error("Directory 'test' not found.") + candidates find isPartestDir getOrElse system.error("Directory 'test' not found.") } // Directory <root>/test/files @@ -38,7 +38,7 @@ object PathSettings { // but in the postmodern "sbt" build, it is called target. Look for both. val dirs = Path.onlyDirs(bases flatMap (x => List(x / "build", x / "target"))) - dirs.headOption getOrElse error("Neither 'build' nor 'target' dir found under test root " + testRoot + ".") + dirs.headOption getOrElse system.error("Neither 'build' nor 'target' dir found under test root " + testRoot + ".") } // Directory <root>/build/pack/lib @@ -46,7 +46,7 @@ object PathSettings { lazy val scalaCheck: File = buildPackLibDir.files ++ srcLibDir.files find (_.name startsWith "scalacheck") getOrElse { - error("No scalacheck jar found in '%s' or '%s'".format(buildPackLibDir, srcLibDir)) + system.error("No scalacheck jar found in '%s' or '%s'".format(buildPackLibDir, srcLibDir)) } } diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index cac6f2dafa..8d4a8f1a5b 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -115,7 +115,7 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor else fileManager.JAVAC_CMD - def error(msg: String): Unit = reporter.error( + def workerError(msg: String): Unit = reporter.error( FakePos("scalac"), msg + "\n scalac -help gives more information" ) @@ -618,7 +618,7 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor val logConsoleWriter = new PrintWriter(logWriter) // create proper settings for the compiler - val settings = new Settings(error) + val settings = new Settings(workerError) settings.outdir.value = outDir.getCanonicalFile.getAbsolutePath settings.sourcepath.value = sourcepath settings.classpath.value = fileManager.CLASSPATH @@ -753,7 +753,7 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor val logConsoleWriter = new PrintWriter(new OutputStreamWriter(logOut)) // create compiler - val settings = new Settings(error) + val settings = new Settings(workerError) settings.sourcepath.value = sourcepath settings.classpath.value = fileManager.CLASSPATH reporter = new ConsoleReporter(settings, scala.Console.in, logConsoleWriter) @@ -767,7 +767,7 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor NestUI.verbose("compiling "+line) val cmdArgs = (line split ' ').toList map (fs => new File(dir, fs).getAbsolutePath) NestUI.verbose("cmdArgs: "+cmdArgs) - val sett = new Settings(error) + val sett = new Settings(workerError) sett.sourcepath.value = sourcepath val command = new CompilerCommand(cmdArgs, sett) (new compiler.Run) compile command.files diff --git a/src/scalacheck/org/scalacheck/Arbitrary.scala b/src/scalacheck/org/scalacheck/Arbitrary.scala index 14d2b9b924..388c3dccff 100644 --- a/src/scalacheck/org/scalacheck/Arbitrary.scala +++ b/src/scalacheck/org/scalacheck/Arbitrary.scala @@ -98,7 +98,7 @@ object Arbitrary { /** Arbitrary instance of Float */ implicit lazy val arbFloat: Arbitrary[Float] = Arbitrary( Gen.chooseNum( - Float.MinValue, Float.MaxValue + Float.MinNegativeValue, Float.MaxValue // I find that including these by default is a little TOO testy. // Float.Epsilon, Float.NaN, Float.PositiveInfinity, Float.NegativeInfinity ) @@ -107,7 +107,7 @@ object Arbitrary { /** Arbitrary instance of Double */ implicit lazy val arbDouble: Arbitrary[Double] = Arbitrary( Gen.chooseNum( - Double.MinValue / 2, Double.MaxValue / 2 + Double.MinNegativeValue / 2, Double.MaxValue / 2 // As above. Perhaps behind some option? // Double.Epsilon, Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity ) diff --git a/src/scalacheck/org/scalacheck/Commands.scala b/src/scalacheck/org/scalacheck/Commands.scala index 0d16505d96..5602eea151 100644 --- a/src/scalacheck/org/scalacheck/Commands.scala +++ b/src/scalacheck/org/scalacheck/Commands.scala @@ -26,7 +26,7 @@ trait Commands extends Prop { class Binding(private val key: State) { def get: Any = bindings.find(_._1 eq key) match { - case None => error("No value bound") + case None => system.error("No value bound") case Some(x) => x } } @@ -139,7 +139,7 @@ trait Commands extends Prop { case Cmds(Nil, _) => proved case Cmds(c::cs, s::ss) => c.postCondition(s,c.nextState(s),c.run(s)) && runCommands(Cmds(cs,ss)) - case _ => error("Should not be here") + case _ => system.error("Should not be here") } private def commandsProp: Prop = { diff --git a/src/scalacheck/org/scalacheck/ConsoleReporter.scala b/src/scalacheck/org/scalacheck/ConsoleReporter.scala index ed2a08d3ae..5dc02b90ad 100644 --- a/src/scalacheck/org/scalacheck/ConsoleReporter.scala +++ b/src/scalacheck/org/scalacheck/ConsoleReporter.scala @@ -79,10 +79,10 @@ object ConsoleReporter { res.status match { case Test.Proved(_) => {} case Test.Passed => {} - case f @ Test.Failed(_, _) => error(m + f) + case f @ Test.Failed(_, _) => system.error(m + f) case Test.Exhausted => {} - case f @ Test.GenException(_) => error(m + f) - case f @ Test.PropException(_, _, _) => error(m + f) + case f @ Test.GenException(_) => system.error(m + f) + case f @ Test.PropException(_, _, _) => system.error(m + f) } } diff --git a/src/scalap/scala/tools/scalap/Arguments.scala b/src/scalap/scala/tools/scalap/Arguments.scala index 39f74cbfac..ebe3d972f0 100644 --- a/src/scalap/scala/tools/scalap/Arguments.scala +++ b/src/scalap/scala/tools/scalap/Arguments.scala @@ -21,7 +21,7 @@ object Arguments { val prefixedBindings: Map[String, Char] = new HashMap val optionalBindings: Map[String, Char] = new HashMap - def error(message: String): Unit = Console.println(message) + def argumentError(message: String): Unit = Console.println(message) def withOption(option: String): Parser = { options += option @@ -51,7 +51,7 @@ object Arguments { def parseBinding(str: String, separator: Char): (String, String) = { val eqls = str.indexOf(separator) if (eqls < 0) { - error("missing '" + separator + "' in binding '" + str + "'") + argumentError("missing '" + separator + "' in binding '" + str + "'") Pair("", "") } else Pair(str.substring(0, eqls).trim(), @@ -78,7 +78,7 @@ object Arguments { i += 1 } else if (optionalArgs contains args(i)) { if ((i + 1) == args.length) { - error("missing argument for '" + args(i) + "'") + argumentError("missing argument for '" + args(i) + "'") i += 1 } else { res.addArgument(args(i), args(i + 1)) @@ -86,7 +86,7 @@ object Arguments { } } else if (optionalBindings contains args(i)) { if ((i + 1) == args.length) { - error("missing argument for '" + args(i) + "'") + argumentError("missing argument for '" + args(i) + "'") i += 1 } else { res.addBinding(args(i), @@ -115,7 +115,7 @@ object Arguments { } } if (i == j) { - error("unknown option '" + args(i) + "'") + argumentError("unknown option '" + args(i) + "'") i = i + 1 } } diff --git a/src/scalap/scala/tools/scalap/CodeWriter.scala b/src/scalap/scala/tools/scalap/CodeWriter.scala index aee7e84e97..6f00df7660 100644 --- a/src/scalap/scala/tools/scalap/CodeWriter.scala +++ b/src/scalap/scala/tools/scalap/CodeWriter.scala @@ -58,7 +58,7 @@ class CodeWriter(writer: Writer) { try { writer.write(nl) } catch { - case e => error("IO error") + case e => system.error("IO error") } line = align align = true @@ -127,7 +127,7 @@ class CodeWriter(writer: Writer) { line = false this } catch { - case e => error("IO error") + case e => system.error("IO error") } override def toString(): String = writer.toString() diff --git a/src/swing/scala/swing/MainFrame.scala b/src/swing/scala/swing/MainFrame.scala index 4bc855d1c3..13c3aacbd0 100644 --- a/src/swing/scala/swing/MainFrame.scala +++ b/src/swing/scala/swing/MainFrame.scala @@ -17,5 +17,5 @@ import event._ * framework and quits the application when closed. */ class MainFrame extends Frame { - override def closeOperation { System.exit(0) } + override def closeOperation { system.exit(0) } } diff --git a/src/swing/scala/swing/SwingApplication.scala b/src/swing/scala/swing/SwingApplication.scala index e4a51ca5b3..02fd8dc737 100644 --- a/src/swing/scala/swing/SwingApplication.scala +++ b/src/swing/scala/swing/SwingApplication.scala @@ -4,6 +4,6 @@ abstract class SwingApplication extends Reactor { def main(args: Array[String]) = Swing.onEDT { startup(args) } def startup(args: Array[String]) - def quit() { shutdown(); System.exit(0) } + def quit() { shutdown(); system.exit(0) } def shutdown() {} } |