diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index 0e52e867cae7..5062bfa44ce5 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.scala
@@ -543,7 +543,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
received = Some(TIMEOUT)
senders = this :: senders
} else
- system.error("unhandled timeout")
+ sys.error("unhandled timeout")
}
var done = false
diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala
index d41d2ea9e82e..792eae40a4b9 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
- system.error("scheduler does not implement snapshot")
+ sys.error("scheduler does not implement snapshot")
}
/* Only ForkJoinScheduler implements this method.
@@ -55,7 +55,7 @@ object Scheduler extends DelegatingScheduler {
if (sched.isInstanceOf[ForkJoinScheduler]) {
sched.asInstanceOf[ForkJoinScheduler].restart()
} else
- system.error("scheduler does not implement restart")
+ sys.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 c31026c3e820..ba0f88c668ca 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)
- system.error("snapshot has not been invoked")
+ sys.error("snapshot has not been invoked")
else if (isActive)
- system.error("scheduler is still active")
+ sys.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 575a2698e55c..a317cf0a86d7 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)
- system.error("snapshot has not been invoked")
+ sys.error("snapshot has not been invoked")
else if (isActive)
- system.error("scheduler is still active")
+ sys.error("scheduler is still active")
else
suspending = false
diff --git a/src/actors/scala/actors/threadpool/helpers/ThreadHelpers.java b/src/actors/scala/actors/threadpool/helpers/ThreadHelpers.java
index 13da20c4d656..9577537f30fd 100644
--- a/src/actors/scala/actors/threadpool/helpers/ThreadHelpers.java
+++ b/src/actors/scala/actors/threadpool/helpers/ThreadHelpers.java
@@ -45,7 +45,7 @@ public void run() {
/**
* Abstraction of the exception handler which receives notifications of
- * exceptions occurred possibly in various parts of the system. Exception
+ * exceptions occurred possibly in various parts of the sys. Exception
* handlers present attractive approach to exception handling in multi-threaded
* systems, as they can handle exceptions that occurred in different threads.
*
diff --git a/src/compiler/scala/tools/ant/Same.scala b/src/compiler/scala/tools/ant/Same.scala
index 2c68e12ba824..deaa9135a15b 100644
--- a/src/compiler/scala/tools/ant/Same.scala
+++ b/src/compiler/scala/tools/ant/Same.scala
@@ -90,8 +90,8 @@ class Same extends ScalaMatchingTask {
/** Tests if all mandatory attributes are set and valid. */
private def validateAttributes = {
- if (origin.isEmpty) system.error("Mandatory attribute 'dir' is not set.")
- if (destination.isEmpty) system.error("Mandatory attribute 'todir' is not set.")
+ if (origin.isEmpty) sys.error("Mandatory attribute 'dir' is not set.")
+ if (destination.isEmpty) sys.error("Mandatory attribute 'todir' is not set.")
}
private def reportDiff(f1: File, f2: File) = {
@@ -150,7 +150,7 @@ class Same extends ScalaMatchingTask {
}
if (!allEqualNow)
if (failing)
- system.error("There were differences between '" + origin.get + "' and '" + destination.get + "'")
+ sys.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/sabbus/Break.scala b/src/compiler/scala/tools/ant/sabbus/Break.scala
index 5d1f82e77a2e..e22d804f9359 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) system.error("Attribute 'id' is not set")
+ if (id.isEmpty) sys.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 31244ea7b40d..88b4b371fb14 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) system.error("Mandatory attribute 'id' is not set.")
- if (compilerPath.isEmpty) system.error("Mandatory attribute 'compilerpath' is not set.")
+ if (id.isEmpty) sys.error("Mandatory attribute 'id' is not set.")
+ if (compilerPath.isEmpty) sys.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 f83f476695a2..5ce42326e22f 100644
--- a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala
+++ b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala
@@ -62,9 +62,9 @@ class ScalacFork extends ScalaMatchingTask with ScalacShared with TaskArgs {
log("Executing ant task scalacfork, origin: %s".format(originOfThis), Project.MSG_VERBOSE)
- 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 compilerPath = this.compilerPath getOrElse sys.error("Mandatory attribute 'compilerpath' is not set.")
+ val sourceDir = this.sourceDir getOrElse sys.error("Mandatory attribute 'srcdir' is not set.")
+ val destinationDir = this.destinationDir getOrElse sys.error("Mandatory attribute 'destdir' is not set.")
val settings = new Settings
settings.d = destinationDir
@@ -114,7 +114,7 @@ class ScalacFork extends ScalaMatchingTask with ScalacShared with TaskArgs {
val res = execWithArgFiles(java, paths)
if (failOnError && res != 0)
- system.error("Compilation failed because of an internal compiler error;"+
+ sys.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 703cf233e1b5..ed93bcdcceb3 100644
--- a/src/compiler/scala/tools/ant/sabbus/Use.scala
+++ b/src/compiler/scala/tools/ant/sabbus/Use.scala
@@ -39,8 +39,8 @@ class Use extends ScalaMatchingTask {
private var failOnError: Boolean = true
override def execute() {
- if (id.isEmpty) system.error("Mandatory attribute 'id' is not set.")
- if (sourceDir.isEmpty) system.error("Mandatory attribute 'srcdir' is not set.")
+ if (id.isEmpty) sys.error("Mandatory attribute 'id' is not set.")
+ if (sourceDir.isEmpty) sys.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 ScalaMatchingTask {
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)
- system.error("Compilation failed with " + errors + " error" + (if (errors > 1) "s" else "") + ".")
+ sys.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 ScalaMatchingTask {
ex.printStackTrace
val errorMsg =
"Compilation failed because of an internal compiler error (" + msg + "); see the error output for details."
- if (failOnError) system.error(errorMsg) else log(errorMsg)
+ if (failOnError) sys.error(errorMsg) else log(errorMsg)
}
}
diff --git a/src/compiler/scala/tools/cmd/Demo.scala b/src/compiler/scala/tools/cmd/Demo.scala
index c471c455aed4..c01338f91669 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) ; sys.exit(0) }
}
}
diff --git a/src/compiler/scala/tools/cmd/package.scala b/src/compiler/scala/tools/cmd/package.scala
index a5cd7c1bc2c6..089e473546fa 100644
--- a/src/compiler/scala/tools/cmd/package.scala
+++ b/src/compiler/scala/tools/cmd/package.scala
@@ -12,7 +12,7 @@ package object cmd {
def runAndExit(body: => Unit): Nothing = {
body
- system.exit(0)
+ sys.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 a38239a11961..9d687083c704 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 = system.error("unreachable")
- def onlyKnownOptions_=(x: Boolean): Unit = system.error("unreachable")
+ def enforceArity_=(x: Boolean): Unit = sys.error("unreachable")
+ def onlyKnownOptions_=(x: Boolean): Unit = sys.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 db5dae0cd915..7fca0687feb1 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 =
- system.exit(try main0(args) catch { case e: Exception => 1 })
+ sys.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 a1198409dc6c..108a54ca833e 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -36,7 +36,7 @@ class StandardCompileServer extends SocketServer {
private def exit(code: Int): Nothing = {
System.err.close()
System.out.close()
- system.exit(code)
+ sys.exit(code)
}
private val runtime = Runtime.getRuntime()
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 56fe04055cbf..aca34ec3a045 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -236,7 +236,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
// XXX: short term, but I can't bear to add another option.
// scalac -Dscala.timings will make this true.
- def timings = system.props contains "scala.timings"
+ def timings = sys.props contains "scala.timings"
def debug = settings.debug.value
def deprecation = settings.deprecation.value
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 9fa77baeacb3..3425c04277e3 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -1367,7 +1367,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 sys.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 55f361cf1f9a..aba4d6616556 100644
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
@@ -117,7 +117,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)
+ sys.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 7f79c69f5275..22d884a04e30 100644
--- a/src/compiler/scala/tools/nsc/Main.scala
+++ b/src/compiler/scala/tools/nsc/Main.scala
@@ -120,7 +120,7 @@ object Main extends AnyRef with EvalLoop {
def main(args: Array[String]) {
process(args)
- system exit (if (reporter.hasErrors) 1 else 0)
+ sys.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 116c06179abd..7fa41a5803da 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)
+ sys.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 33e91759f82c..0137b33cd018 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(system.error)
+ val settings = new Settings(sys.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)
- system.exit(if (reporter.hasErrors) 1 else 0)
+ sys.exit(if (reporter.hasErrors) 1 else 0)
}
}
diff --git a/src/compiler/scala/tools/nsc/ScalaDoc.scala b/src/compiler/scala/tools/nsc/ScalaDoc.scala
index 0549e2c758ed..6cc30eb8c8fa 100644
--- a/src/compiler/scala/tools/nsc/ScalaDoc.scala
+++ b/src/compiler/scala/tools/nsc/ScalaDoc.scala
@@ -79,6 +79,6 @@ object ScalaDoc {
def main(args: Array[String]): Unit = {
process(args)
- system.exit(if (reporter.hasErrors) 1 else 0)
+ sys.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 a3a04e34b9de..e7fd22d00ca9 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(system.error).visibleSettings.toList map (_.name)
+ val compSettingNames = new Settings(sys.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)
@@ -178,7 +178,7 @@ object ScriptRunner {
val compiledPath = Directory makeTemp "scalascript"
// delete the directory after the user code has finished
- system.addShutdownHook(compiledPath.deleteRecursively())
+ sys.addShutdownHook(compiledPath.deleteRecursively())
settings.outdir.value = compiledPath.path
@@ -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 sys.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 cdc18ed566ec..8fa27c04f6ae 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 _ =>
- system.error("Unknown case: " + t.toString() +", "+ t.getClass)
+ sys.error("Unknown case: " + t.toString() +", "+ t.getClass)
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
index 70ab35b13ce9..54e6acb082b5 100644
--- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
+++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
@@ -581,7 +581,7 @@ abstract class ScalaPrimitives {
val arrayParent = tpe :: tpe.parents collectFirst {
case TypeRef(_, ArrayClass, elem :: Nil) => elem
}
- arrayParent getOrElse system.error(fun.fullName + " : " + (tpe :: tpe.baseTypeSeq.toList).mkString(", "))
+ arrayParent getOrElse sys.error(fun.fullName + " : " + (tpe :: tpe.baseTypeSeq.toList).mkString(", "))
}
code match {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala
index e38d14c10b87..993002dc1dcc 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, "", NoPosition) {
- 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 startBlock: BasicBlock = sys.error("NoFinalizer cannot have a start block.");
+ override def setStartBlock(b: BasicBlock): Unit = sys.error("NoFinalizer cannot have a start block.");
override def dup = this
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
index ad85ded12bd8..9f22a6de906f 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala
@@ -191,7 +191,7 @@ trait Linearizers {
*/
class DumpLinearizer extends Linearizer {
def linearize(m: IMethod): List[BasicBlock] = m.code.blocks.toList
- def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = system.error("not implemented")
+ def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = sys.error("not implemented")
}
/** The MSIL linearizer is used only for methods with at least one exception handler.
@@ -328,7 +328,7 @@ trait Linearizers {
}
def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = {
- system.error("not implemented")
+ sys.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 6da0279ffe2c..3f7383daf96c 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 = system.error("LOAD_EXCEPTION does clean the whole stack, no idea how many things it consumes!")
+ override def consumed = sys.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 43ab35b83e73..49f5cf78c99a 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 =>
- system.error("Incorrect icode in " + method + ". Expecting something on the stack.")
+ sys.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 c45983d5b661..58ca18335900 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala
@@ -82,7 +82,7 @@ trait DataFlowAnalysis[L <: SemiLattice] {
Console.println("in: " + in.mkString("", "\n", ""))
Console.println("out: " + out.mkString("", "\n", ""))
e.printStackTrace
- system.error("Could not find element " + e.getMessage)
+ sys.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 03bb2bae3fa5..acc28bd4458c 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)) system.error("merging with exhan stack")
+ else if ((s1 eq exceptionHandlerStack) || (s2 eq exceptionHandlerStack)) sys.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 66dc3c78b2c2..aeea6b545265 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
@@ -296,7 +296,7 @@ abstract class Inliners extends SubComponent {
def isMonadic = isMonadicMethod(sym)
def handlers = m.exh
- def blocks = if (m.code eq null) system.error("blocks = null + " + m) else m.code.blocks
+ def blocks = if (m.code eq null) sys.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/doc/SourcelessComments.scala b/src/compiler/scala/tools/nsc/doc/SourcelessComments.scala
index 46e45a861b36..647a17b66bc1 100644
--- a/src/compiler/scala/tools/nsc/doc/SourcelessComments.scala
+++ b/src/compiler/scala/tools/nsc/doc/SourcelessComments.scala
@@ -214,7 +214,7 @@ abstract class SourcelessComments {
/** Class `AnyVal` is the root class of all ''value types''.
*
* `AnyVal` has a fixed number of subclasses, which describe values which are not implemented as objects in the
- * underlying host system.
+ * underlying host sys.
*
* Classes [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]], [[scala.Short]],
* and [[scala.Byte]] are together called ''numeric value types''. Classes [[scala.Byte]], [[scala.Short]], and
@@ -235,7 +235,7 @@ abstract class SourcelessComments {
val minValue = "MIN_" + sym.name.toString().toUpperCase()
comment(sym) = new DocComment("""
/** Class `""" + sym.name + """` belongs to the value classes whose instances are not represented as objects by
- * the underlying host system. There is an implicit conversion from instances of `""" + sym.name + """` to
+ * the underlying host sys. There is an implicit conversion from instances of `""" + sym.name + """` to
* instances of [[scala.runtime.Rich""" + sym.name + """]] which provides useful non-primitive operations.
* All value classes inherit from class [[scala.AnyVal]].
*
diff --git a/src/compiler/scala/tools/nsc/interactive/REPL.scala b/src/compiler/scala/tools/nsc/interactive/REPL.scala
index 47807ccdac9e..4e5d5668cb70 100644
--- a/src/compiler/scala/tools/nsc/interactive/REPL.scala
+++ b/src/compiler/scala/tools/nsc/interactive/REPL.scala
@@ -56,7 +56,7 @@ object REPL {
def main(args: Array[String]) {
process(args)
- system.exit(if (reporter.hasErrors) 1 else 0)
+ sys.exit(if (reporter.hasErrors) 1 else 0)
}
def loop(action: (String) => Unit) {
@@ -125,7 +125,7 @@ object REPL {
doComplete(makePos(file, off1, off1))
case List("quit") =>
comp.askShutdown()
- system.exit(1)
+ sys.exit(1)
case _ =>
println("unrecongized command")
}
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala b/src/compiler/scala/tools/nsc/interactive/tests/Tester.scala
index 6e380027b6a5..36a715ba26e5 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)
+ sys.exit(0)
}
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
index 4fdcbafa835b..5e78cb4ebbce 100644
--- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -23,7 +23,7 @@ trait InteractiveReader {
def readLine(prompt: String): String = {
def handler: Catcher[String] = {
- case e: ClosedByInterruptException => system.error("Reader closed by interrupt.")
+ case e: ClosedByInterruptException => sys.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) => reset() ; readLine(prompt)
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
index 440f2933f9d8..932326ecc7f7 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
@@ -19,12 +19,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 => system.error(x.toString)
+ case x => sys.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 => system.error(x.toString)
+ case x => sys.error(x.toString)
}
lazy val (staticMethods, instanceMethods) = clazz.getMethods.toList partition (x => isStatic(x.getModifiers))
diff --git a/src/compiler/scala/tools/nsc/interpreter/package.scala b/src/compiler/scala/tools/nsc/interpreter/package.scala
index 9d131f4786ac..dcbc84334c26 100644
--- a/src/compiler/scala/tools/nsc/interpreter/package.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/package.scala
@@ -8,7 +8,7 @@ package scala.tools.nsc
package object interpreter {
private[nsc] val DebugProperty = "scala.repl.debug"
private[nsc] var _debug = false
- private[nsc] def isReplDebug = _debug || (system.props contains DebugProperty)
+ private[nsc] def isReplDebug = _debug || (sys.props contains DebugProperty)
/** Debug output */
def repldbg(msg: String) = if (isReplDebug) Console println msg
diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
index 01aaa6c0078e..c2b73b2831f4 100644
--- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala
+++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
@@ -61,7 +61,7 @@ object AbstractFile {
*
* This class and its children serve to unify handling of files and
* directories. These files and directories may or may not have some
- * real counter part within the file system. For example, some file
+ * real counter part within the file sys. For example, some file
* handles reference files within a zip archive or virtual ones
* that exist only in memory.
*
diff --git a/src/compiler/scala/tools/nsc/io/File.scala b/src/compiler/scala/tools/nsc/io/File.scala
index 7bf04cbe5cb6..eddc9c0de68b 100644
--- a/src/compiler/scala/tools/nsc/io/File.scala
+++ b/src/compiler/scala/tools/nsc/io/File.scala
@@ -112,6 +112,12 @@ class File(jfile: JFile)(implicit constructorCodec: Codec) extends Path(jfile) w
finally out close
}
+ def writeBytes(bytes: Array[Byte]): Unit = {
+ val out = bufferedOutput()
+ try out write bytes
+ finally out close
+ }
+
def appendAll(strings: String*): Unit = {
val out = bufferedWriter(append = true)
try strings foreach (out write _)
diff --git a/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala b/src/compiler/scala/tools/nsc/io/VirtualDirectory.scala
index eac7530aa347..8f5ad5c820b4 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 = system.error("directories cannot be read")
- override def output = system.error("directories cannot be written")
+ override def input = sys.error("directories cannot be read")
+ override def output = sys.error("directories cannot be written")
/** Does this abstract file denote an existing file? */
def create { unsupported }
diff --git a/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala
index 3131c78bd0b4..a4699cfd88f6 100644
--- a/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/AbsScalaSettings.scala
@@ -32,7 +32,7 @@ trait AbsScalaSettings {
/** **/
abstract class SettingGroup(val prefix: String) extends AbsSetting {
def name = prefix
- def helpDescription: String = system.error("todo")
+ def helpDescription: String = sys.error("todo")
def unparse: List[String] = List(name)
}
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Scopes.scala b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
index b5e23d61f055..6ce244b772bf 100644
--- a/src/compiler/scala/tools/nsc/symtab/Scopes.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
@@ -227,7 +227,7 @@ trait Scopes {
/** lookup a symbol entry matching given name.
* @note from Martin: I believe this is a hotspot or will be one
- * in future versions of the type system. I have reverted the previous
+ * in future versions of the type sys. I have reverted the previous
* change to use iterators as too costly.
*/
def lookupEntry(name: Name): ScopeEntry = {
@@ -248,7 +248,7 @@ trait Scopes {
/** lookup next entry with same name as this one
* @note from Martin: I believe this is a hotspot or will be one
- * in future versions of the type system. I have reverted the previous
+ * in future versions of the type sys. I have reverted the previous
* change to use iterators as too costly.
*/
def lookupNextEntry(entry: ScopeEntry): ScopeEntry = {
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index f944a168e9e8..5bc10a4fef9e 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -360,12 +360,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) // system.error("Unsupported JVM bytecode: dup_x1")
- case JVM.dup_x2 => code.emit(DUP_X2) // system.error("Unsupported JVM bytecode: dup_x2")
+ case JVM.dup_x1 => code.emit(DUP_X1) // sys.error("Unsupported JVM bytecode: dup_x1")
+ case JVM.dup_x2 => code.emit(DUP_X2) // sys.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) // 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.dup2_x1 => code.emit(DUP2_X1) // sys.error("Unsupported JVM bytecode: dup2_x1")
+ case JVM.dup2_x2 => code.emit(DUP2_X2) // sys.error("Unsupported JVM bytecode: dup2_x2")
+ case JVM.swap => sys.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)))
@@ -452,8 +452,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 => system.error("Cannot handle jsr/ret")
- case JVM.ret => system.error("Cannot handle jsr/ret")
+ case JVM.jsr => sys.error("Cannot handle jsr/ret")
+ case JVM.ret => sys.error("Cannot handle jsr/ret")
case JVM.tableswitch =>
val padding = if ((pc + size) % 4 != 0) 4 - ((pc + size) % 4) else 0
size += padding
@@ -578,14 +578,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 => system.error("Cannot handle jsr/ret")
+ case JVM.ret => sys.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 _ => system.error("Invalid 'wide' operand")
+ case _ => sys.error("Invalid 'wide' operand")
}
case JVM.multianewarray =>
@@ -598,9 +598,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 => system.error("Cannot handle jsr/ret")
+ case JVM.jsr_w => sys.error("Cannot handle jsr/ret")
-// case _ => system.error("Unknown bytecode")
+// case _ => sys.error("Unknown bytecode")
}
pc += size
}
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 6e5a8ac817ef..153aa0faf5f3 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(_) =>
- system.error("unexpected case") //todo: remove
+ sys.error("unexpected case") //todo: remove
case _ =>
val clazz = sym.owner
val vparamss1 =
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 758c28a238b8..0e190a0da17f 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -301,7 +301,7 @@ abstract class TailCalls extends Transform {
rewriteApply(fun, fun, Nil, args)
case Alternative(_) | Star(_) | Bind(_, _) =>
- system.error("We should've never gotten inside a pattern")
+ sys.error("We should've never gotten inside a pattern")
case EmptyTree | Super(_, _) | This(_) | Select(_, _) | Ident(_) | Literal(_) | Function(_, _) | TypeTree() =>
tree
case _ =>
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index c06d2ce7dc76..2f56180c8d4b 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -587,7 +587,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 _ => system.error("internal error: UnApply node has wrong symbol")
+ case _ => sys.error("internal error: UnApply node has wrong symbol")
})
treeCopy.UnApply(tree, fn1, args1)
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 95bf16db5b0e..3e8f7bd2c75e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -39,7 +39,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
private var accDefs: List[(Symbol, ListBuffer[Tree])] = List()
private def accDefBuf(clazz: Symbol) =
- accDefs collectFirst { case (`clazz`, buf) => buf } getOrElse system.error("no acc def buf for "+clazz)
+ accDefs collectFirst { case (`clazz`, buf) => buf } getOrElse sys.error("no acc def buf for "+clazz)
private def transformArgs(args: List[Tree], params: List[Symbol]) =
((args, params).zipped map { (arg, param) =>
@@ -406,7 +406,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
* self type is a Java class, and a protected accessor is needed, we issue
* an error. If the self type is a Scala class, we don't add an accessor.
* An accessor is not needed if the access boundary is larger than the
- * enclosing package, since that translates to 'public' on the host system.
+ * enclosing package, since that translates to 'public' on the host sys.
* (as Java has no real package nesting).
*
* If the access happens inside a 'trait', access is more problematic since
diff --git a/src/compiler/scala/tools/nsc/util/MsilClassPath.scala b/src/compiler/scala/tools/nsc/util/MsilClassPath.scala
index 019f40d72fe4..fb03f8d1594d 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 = system.error("Unknown") // I don't know what if anything makes sense here?
+ def asClasspathString = sys.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/Origins.scala b/src/compiler/scala/tools/nsc/util/Origins.scala
index 29ef9f3f035f..62fb0dab0007 100644
--- a/src/compiler/scala/tools/nsc/util/Origins.scala
+++ b/src/compiler/scala/tools/nsc/util/Origins.scala
@@ -85,7 +85,7 @@ object Origins {
{
// Console.println("\nOrigins loaded: registering shutdown hook to display results.")
- system.addShutdownHook(counters foreach (_.purge()))
+ sys.addShutdownHook(counters foreach (_.purge()))
}
def apply[T: Manifest](tag: String): Origins = apply(tag, manifest[T].erasure)
diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala
index a11038104b62..dfa9f1c7cf13 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 system.error("%s is no name" format tagName)
+ else sys.error("%s is no name" format tagName)
def nameIndex =
if (hasName) readNat(bytes, 0)
- else system.error("%s has no name" format tagName)
+ else sys.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/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala
index 6de2f35796f6..06e4de80f9de 100644
--- a/src/compiler/scala/tools/nsc/util/package.scala
+++ b/src/compiler/scala/tools/nsc/util/package.scala
@@ -22,9 +22,9 @@ package object util {
* execution to complete.
*/
def waitingForThreads[T](body: => T) = {
- val ts1 = system.allThreads()
+ val ts1 = sys.allThreads()
val result = body
- val ts2 = system.allThreads()
+ val ts2 = sys.allThreads()
val newThreads = ts2.toSet -- ts1 filterNot (_.isDaemon())
newThreads foreach (_.join())
diff --git a/src/compiler/scala/tools/reflect/Mock.scala b/src/compiler/scala/tools/reflect/Mock.scala
index 56bef2caa478..2b06d808aeda 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 => system.error(clazz + " implements no interfaces.")
+ case Nil => sys.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 f64766019397..cc3024d3e473 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)
- system.exit(1)
+ sys.exit(1)
}
private def warn(msg: String) {
diff --git a/src/dbc/scala/dbc/datatype/Factory.scala b/src/dbc/scala/dbc/datatype/Factory.scala
index a5e69d547157..9eb8d25b26eb 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 =>
- system.error ("I don't support composite data types yet.");
+ sys.error ("I don't support composite data types yet.");
case DATALINK | DISTINCT | JAVA_OBJECT | NULL =>
- system.error ("I won't support strange data types.");
+ sys.error ("I won't support strange data types.");
/* Unsupported binary string data types. */
case BINARY | BLOB | LONGVARBINARY | VARBINARY =>
- system.error ("I don't support binary string data types yet.");
+ sys.error ("I don't support binary string data types yet.");
/* Unsupported date and time data types. */
case DATE | TIME | TIMESTAMP =>
- system.error ("I don't support date and time data types yet.");
+ sys.error ("I don't support date and time data types yet.");
/* Default case */
- case x => system.error ("I don't know about this ("+metadata.getColumnTypeName(index)+") JDBC type.")
+ case x => sys.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 21afaea22dbd..9a509251fbce 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 =
- system.error("The 'UNKNOWN' data type cannot be represented.");
+ sys.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 0427269ffd41..3dab6f481002 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 system.error("next on empty iterator")
+ else sys.error("next on empty iterator")
}
}
diff --git a/src/dbc/scala/dbc/statement/Select.scala b/src/dbc/scala/dbc/statement/Select.scala
index 07d7d26c6fd1..74b05ed2a1b1 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 => system.error("Empty from clause is not allowed")
+ case Nil => sys.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 => system.error("Empty group by clause is not allowed")
+ case Nil => sys.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 48a675a40541..334e6bf1ed10 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 = system.error("Binary set function is not supported yet.");
+ def sqlString = sys.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 2c56bbf36ed0..2cb791566ff6 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 = system.error("An 'ANY' value cannot be represented.");
+ def sqlString = sys.error("An 'ANY' value cannot be represented.");
}
diff --git a/src/detach/library/scala/remoting/Channel.scala b/src/detach/library/scala/remoting/Channel.scala
index ba3f3c31e00d..541e45a47722 100644
--- a/src/detach/library/scala/remoting/Channel.scala
+++ b/src/detach/library/scala/remoting/Channel.scala
@@ -51,7 +51,7 @@ class Channel protected (socket: Socket) {
}
catch {
case e: Exception =>
- system.error("Class loader undefined: " + e.getMessage)
+ sys.error("Class loader undefined: " + e.getMessage)
null
}
def classLoader: ClassLoader = cl
@@ -82,7 +82,7 @@ class Channel protected (socket: Socket) {
}
catch {
case e: IOException =>
- system.error("Input stream undefined: "+e.getMessage+" ("+this+")")
+ sys.error("Input stream undefined: "+e.getMessage+" ("+this+")")
null
}
private lazy val out =
@@ -91,7 +91,7 @@ class Channel protected (socket: Socket) {
}
catch {
case e: IOException =>
- system.error("Output stream undefined: "+e.getMessage+" ("+this+")")
+ sys.error("Output stream undefined: "+e.getMessage+" ("+this+")")
null
}
diff --git a/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala b/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala
index baf4249bbe10..814d50e91041 100644
--- a/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala
+++ b/src/detach/library/scala/runtime/remoting/RegistryDelegate.scala
@@ -62,7 +62,7 @@ import java.rmi.server.UnicastRemoteObject
* Thread.sleep(Long.MAX_VALUE)
* } catch {
* case e: InterruptedException => // do nothing
- * case e: Throwable => e.printStackTrace(); system.exit(1)
+ * case e: Throwable => e.printStackTrace(); sys.exit(1)
* }
* } while (true)
* }
@@ -115,14 +115,14 @@ object RMIDelegate {
if (args.length > 0) {
if (args(0) equals "-help") {
println("Usage: rmidelegate ")
- system.exit(0)
+ sys.exit(0)
}
try {
port = args(0).toInt
} catch {
case e: NumberFormatException =>
println("Usage: rmidelegate ")
- system.exit(1)
+ sys.exit(1)
}
val opts = args filter (_ startsWith "-J-D")
for (opt <- opts) {
@@ -149,7 +149,7 @@ object RMIDelegate {
// do nothing
case e: Throwable =>
e.printStackTrace()
- system.exit(1)
+ sys.exit(1)
}
} while (true)
}
diff --git a/src/jline/src/main/java/jline/UnixTerminal.java b/src/jline/src/main/java/jline/UnixTerminal.java
index 755d899765d9..37f18aea4ee9 100644
--- a/src/jline/src/main/java/jline/UnixTerminal.java
+++ b/src/jline/src/main/java/jline/UnixTerminal.java
@@ -28,7 +28,7 @@
* /dev/tty file to disable character echoing and enable
* character input. All known unix systems (including
* Linux and Macintosh OS X) support the stty), so this
- * implementation should work for an reasonable POSIX system.
+ * implementation should work for an reasonable POSIX sys.
*
* @author Marc Prud'hommeaux
* @author Dale Kemp
diff --git a/src/jline/src/main/java/jline/WindowsTerminal.java b/src/jline/src/main/java/jline/WindowsTerminal.java
index dcaa3a9cde92..4304d6d47330 100644
--- a/src/jline/src/main/java/jline/WindowsTerminal.java
+++ b/src/jline/src/main/java/jline/WindowsTerminal.java
@@ -302,7 +302,7 @@ public static enum ConsoleMode
* control keys are processed by the system and are not returned in the
* ReadFile or ReadConsole buffer. If the ENABLE_LINE_INPUT mode is also
* enabled, backspace, carriage return, and linefeed characters are handled
- * by the system.
+ * by the sys.
*/
ENABLE_PROCESSED_INPUT(1),
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index e8768fd1508b..f07582c3561d 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -58,14 +58,14 @@ object Predef extends LowPriorityImplicits {
// Deprecated
- @deprecated("Use system.error(message) instead")
- def error(message: String): Nothing = system.error(message)
+ @deprecated("Use sys.error(message) instead")
+ def error(message: String): Nothing = sys.error(message)
- @deprecated("Use system.exit() instead")
- def exit(): Nothing = system.exit()
+ @deprecated("Use sys.exit() instead")
+ def exit(): Nothing = sys.exit()
- @deprecated("Use system.exit(status) instead")
- def exit(status: Int): Nothing = system.exit(status)
+ @deprecated("Use sys.exit(status) instead")
+ def exit(status: Int): Nothing = sys.exit(status)
@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 26d7ff2eed94..2f95c4fb8073 100644
--- a/src/library/scala/collection/immutable/HashMap.scala
+++ b/src/library/scala/collection/immutable/HashMap.scala
@@ -452,7 +452,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 _ => system.error("section supposed to be unreachable.")
+ case _ => sys.error("section supposed to be unreachable.")
}
}
diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala
index 1bf3b795f231..aa9f99b4cb41 100644
--- a/src/library/scala/collection/immutable/HashSet.scala
+++ b/src/library/scala/collection/immutable/HashSet.scala
@@ -186,12 +186,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
- system.error("cannot serialize an immutable.HashSet where all items have the same 32-bit hash code")
+ sys.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) {
- system.error("cannot deserialize an immutable.HashSet where all items have the same 32-bit hash code")
+ sys.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.)
}
diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala
index 6baa05c21afd..86b3b9f1e41d 100644
--- a/src/library/scala/collection/immutable/IntMap.scala
+++ b/src/library/scala/collection/immutable/IntMap.scala
@@ -118,7 +118,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 => system.error("Empty maps not allowed as subtrees");
+ case IntMap.Nil => sys.error("Empty maps not allowed as subtrees");
}
}
@@ -254,8 +254,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 system.error("Key not found");
- case IntMap.Nil => system.error("key not found");
+ case IntMap.Tip(key2, value) => if (key == key2) value else sys.error("Key not found");
+ case IntMap.Nil => sys.error("key not found");
}
def + [S >: T] (kv: (Int, S)): IntMap[S] = updated(kv._1, kv._2)
@@ -417,7 +417,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 => system.error("Empty set")
+ case IntMap.Nil => sys.error("Empty set")
}
/**
@@ -426,6 +426,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 => system.error("Empty set")
+ case IntMap.Nil => sys.error("Empty set")
}
}
diff --git a/src/library/scala/collection/immutable/LongMap.scala b/src/library/scala/collection/immutable/LongMap.scala
index f02c6fce664c..0d454a4ba264 100644
--- a/src/library/scala/collection/immutable/LongMap.scala
+++ b/src/library/scala/collection/immutable/LongMap.scala
@@ -115,7 +115,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 => system.error("Empty maps not allowed as subtrees");
+ case LongMap.Nil => sys.error("Empty maps not allowed as subtrees");
}
}
@@ -252,8 +252,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 system.error("Key not found");
- case LongMap.Nil => system.error("key not found");
+ case LongMap.Tip(key2, value) => if (key == key2) value else sys.error("Key not found");
+ case LongMap.Nil => sys.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 1c2d4ba36280..58a698261530 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 _ => system.error("Defect: invariance violation; expected black, got "+t)
+ case _ => sys.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 _ => system.error("Defect: invariance violation at "+right)
+ case _ => sys.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 _ => system.error("Defect: invariance violation at "+left)
+ case _ => sys.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(_, _, _, _) :: tail =>
if (depth == 1) zipper else findDepth(tail, depth - 1)
case _ :: tail => findDepth(tail, depth)
- case Nil => system.error("Defect: unexpected empty zipper while computing range")
+ case Nil => sys.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 9de466e04c3a..3a38f831b222 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) system.error("Stack empty")
+ if (index == 0) sys.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 29dfc3ad19ed..5bd220f81fac 100644
--- a/src/library/scala/collection/mutable/OpenHashMap.scala
+++ b/src/library/scala/collection/mutable/OpenHashMap.scala
@@ -180,7 +180,7 @@ extends Map[Key, Value]
val initialModCount = modCount;
private[this] def advance {
- if (initialModCount != modCount) system.error("Concurrent modification");
+ if (initialModCount != modCount) sys.error("Concurrent modification");
while((index <= mask) && (table(index) == null || table(index).value == None)) index+=1;
}
@@ -217,7 +217,7 @@ extends Map[Key, Value]
override def foreach[U](f : ((Key, Value)) => U) {
val startModCount = modCount;
foreachUndeletedEntry(entry => {
- if (modCount != startModCount) system.error("Concurrent Modification")
+ if (modCount != startModCount) sys.error("Concurrent Modification")
f((entry.key, entry.value.get))}
);
}
diff --git a/src/library/scala/collection/parallel/mutable/ParArray.scala b/src/library/scala/collection/parallel/mutable/ParArray.scala
index 536976f5e3b3..ccd693a2415d 100644
--- a/src/library/scala/collection/parallel/mutable/ParArray.scala
+++ b/src/library/scala/collection/parallel/mutable/ParArray.scala
@@ -630,7 +630,7 @@ self =>
new ScanToArray(left, z, op, targetarr),
new ScanToArray(right, z, op, targetarr)
)
- case _ => system.error("Can only split scan tree internal nodes.")
+ case _ => sys.error("Can only split scan tree internal nodes.")
}
def shouldSplitFurther = tree match {
case ScanNode(_, _) => true
diff --git a/src/library/scala/collection/parallel/package.scala b/src/library/scala/collection/parallel/package.scala
index 757f5d2686db..acced246da49 100644
--- a/src/library/scala/collection/parallel/package.scala
+++ b/src/library/scala/collection/parallel/package.scala
@@ -210,7 +210,7 @@ package object parallel {
afterCombine(other)
this
- } else system.error("Unexpected combiner type.")
+ } else sys.error("Unexpected combiner type.")
} else this
}
diff --git a/src/library/scala/mobile/Code.scala b/src/library/scala/mobile/Code.scala
index e1d04eafa5a0..6f96130568bb 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 {
- system.error("class " + clazz.getName() + " has no public constructor")
+ sys.error("class " + clazz.getName() + " has no public constructor")
}
}
}
diff --git a/src/library/scala/system/PropertiesMap.scala b/src/library/scala/sys/PropertiesMap.scala
similarity index 98%
rename from src/library/scala/system/PropertiesMap.scala
rename to src/library/scala/sys/PropertiesMap.scala
index a01eee693193..e840f2846773 100644
--- a/src/library/scala/system/PropertiesMap.scala
+++ b/src/library/scala/sys/PropertiesMap.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-package scala.system
+package scala.sys
import scala.collection.mutable
import scala.collection.JavaConverters._
diff --git a/src/library/scala/system/ShutdownHookThread.scala b/src/library/scala/sys/ShutdownHookThread.scala
similarity index 98%
rename from src/library/scala/system/ShutdownHookThread.scala
rename to src/library/scala/sys/ShutdownHookThread.scala
index 17a5e398efb7..af79d95a2aab 100644
--- a/src/library/scala/system/ShutdownHookThread.scala
+++ b/src/library/scala/sys/ShutdownHookThread.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-package scala.system
+package scala.sys
/** A minimal Thread wrapper to enhance shutdown hooks. It knows
* how to unregister itself.
diff --git a/src/library/scala/system/package.scala b/src/library/scala/sys/package.scala
similarity index 95%
rename from src/library/scala/system/package.scala
rename to src/library/scala/sys/package.scala
index 1e989f86ec93..85deba62b686 100644
--- a/src/library/scala/system/package.scala
+++ b/src/library/scala/sys/package.scala
@@ -11,7 +11,7 @@ package scala
import scala.collection.immutable
import collection.JavaConverters._
-/** The package object `scala.system` contains methods for reading
+/** The package object `scala.sys` contains methods for reading
* and altering core aspects of the virtual machine as well as the
* world outside of it.
*
@@ -19,7 +19,7 @@ import collection.JavaConverters._
* @version 2.9
* @since 2.9
*/
-package object system {
+package object sys {
/** Throw a new RuntimeException with the supplied message.
*
* @return Nothing.
@@ -50,7 +50,7 @@ package object system {
/** A bidirectional, mutable Map representing the current system Properties.
*
* @return a PropertiesMap.
- * @see `scala.system.PropertiesMap`
+ * @see `scala.sys.PropertiesMap`
*/
def props: PropertiesMap = new PropertiesMap
diff --git a/src/library/scala/sys/process/BasicIO.scala b/src/library/scala/sys/process/BasicIO.scala
new file mode 100644
index 000000000000..505a859377f9
--- /dev/null
+++ b/src/library/scala/sys/process/BasicIO.scala
@@ -0,0 +1,81 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.sys
+package process
+
+import processAliases._
+import java.io.{ BufferedReader, InputStreamReader }
+
+object BasicIO {
+ final val BufferSize = 8192
+ final val Newline = props("line.separator")
+
+ def apply(buffer: StringBuffer, log: Option[ProcessLogger], withIn: Boolean) =
+ new ProcessIO(input(withIn), processFully(buffer), getErr(log))
+ def apply(log: ProcessLogger, withIn: Boolean) =
+ new ProcessIO(input(withIn), processInfoFully(log), processErrFully(log))
+
+ def getErr(log: Option[ProcessLogger]) = log match {
+ case Some(lg) => processErrFully(lg)
+ case None => toStdErr
+ }
+
+ private def processErrFully(log: ProcessLogger) = processFully(log error _)
+ private def processInfoFully(log: ProcessLogger) = processFully(log info _)
+
+ def ignoreOut = (i: OutputStream) => ()
+
+ def close(c: Closeable) = try c.close() catch { case _: IOException => () }
+ def processFully(buffer: Appendable): InputStream => Unit = processFully(appendLine(buffer))
+ def processFully(processLine: String => Unit): InputStream => Unit = in => {
+ val reader = new BufferedReader(new InputStreamReader(in))
+ processLinesFully(processLine)(reader.readLine)
+ }
+
+ def processLinesFully(processLine: String => Unit)(readLine: () => String) {
+ def readFully() {
+ val line = readLine()
+ if (line != null) {
+ processLine(line)
+ readFully()
+ }
+ }
+ readFully()
+ }
+ def connectToIn(o: OutputStream): Unit = transferFully(System.in, o)
+ def input(connect: Boolean): OutputStream => Unit = if (connect) connectToIn else ignoreOut
+ def standard(connectInput: Boolean): ProcessIO = standard(input(connectInput))
+ def standard(in: OutputStream => Unit): ProcessIO = new ProcessIO(in, toStdOut, toStdErr)
+
+ def toStdErr = (in: InputStream) => transferFully(in, System.err)
+ def toStdOut = (in: InputStream) => transferFully(in, System.out)
+
+ def transferFully(in: InputStream, out: OutputStream): Unit =
+ try transferFullyImpl(in, out)
+ catch { case _: InterruptedException => () }
+
+ private[this] def appendLine(buffer: Appendable): String => Unit = line => {
+ buffer.append(line)
+ buffer.append(Newline)
+ }
+
+ private[this] def transferFullyImpl(in: InputStream, out: OutputStream) {
+ val buffer = new Array[Byte](BufferSize)
+ def loop() {
+ val byteCount = in.read(buffer)
+ if (byteCount > 0) {
+ out.write(buffer, 0, byteCount)
+ out.flush()
+ loop()
+ }
+ }
+ loop()
+ }
+}
+
diff --git a/src/library/scala/sys/process/Process.scala b/src/library/scala/sys/process/Process.scala
new file mode 100644
index 000000000000..6453002ae44d
--- /dev/null
+++ b/src/library/scala/sys/process/Process.scala
@@ -0,0 +1,85 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.sys
+package process
+
+import processAliases._
+import ProcessBuilder._
+
+/** Represents a process that is running or has finished running.
+ * It may be a compound process with several underlying native processes (such as 'a #&& b`).
+ */
+trait Process {
+ /** Blocks until this process exits and returns the exit code.*/
+ def exitValue(): Int
+ /** Destroys this process. */
+ def destroy(): Unit
+}
+
+/** Methods for constructing simple commands that can then be combined. */
+object Process extends ProcessCreation { }
+
+trait ProcessCreation {
+ def apply(command: String): ProcessBuilder = apply(command, None)
+ def apply(command: Seq[String]): ProcessBuilder = apply(command, None)
+ def apply(command: String, arguments: Seq[String]): ProcessBuilder = apply(command +: arguments, None)
+
+ /** create ProcessBuilder with working dir set to File and extra environment variables */
+ def apply(command: String, cwd: File, extraEnv: (String, String)*): ProcessBuilder =
+ apply(command, Some(cwd), extraEnv: _*)
+
+ /** create ProcessBuilder with working dir set to File and extra environment variables */
+ def apply(command: Seq[String], cwd: File, extraEnv: (String, String)*): ProcessBuilder =
+ apply(command, Some(cwd), extraEnv: _*)
+
+ /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
+ def apply(command: String, cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
+ apply(command.split("""\s+"""), cwd, extraEnv : _*)
+ // not smart to use this on windows, because CommandParser uses \ to escape ".
+ /*CommandParser.parse(command) match {
+ case Left(errorMsg) => error(errorMsg)
+ case Right((cmd, args)) => apply(cmd :: args, cwd, extraEnv : _*)
+ }*/
+ }
+
+ /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
+ def apply(command: Seq[String], cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
+ val jpb = new JProcessBuilder(command.toArray : _*)
+ cwd foreach (jpb directory _)
+ extraEnv foreach { case (k, v) => jpb.environment.put(k, v) }
+ apply(jpb)
+ }
+
+ def apply(builder: JProcessBuilder): ProcessBuilder = new Simple(builder)
+ def apply(file: File): FileBuilder = new FileImpl(file)
+ def apply(url: URL): URLBuilder = new URLImpl(url)
+ def apply(command: scala.xml.Elem): ProcessBuilder = apply(command.text.trim)
+ def apply(value: Boolean): ProcessBuilder = apply(value.toString, if (value) 0 else 1)
+
+ def apply(name: String, exitValue: => Int): ProcessBuilder = new Dummy(name, exitValue)
+ def applySeq[T](builders: Seq[T])(implicit convert: T => Source): Seq[Source] = builders.map(convert)
+
+ def cat(file: Source, files: Source*): ProcessBuilder = cat(file +: files)
+ def cat(files: Seq[Source]): ProcessBuilder = {
+ require(files.nonEmpty)
+ files map (_.cat) reduceLeft (_ #&& _)
+ }
+}
+
+trait ProcessImplicits {
+ import Process._
+
+ implicit def buildersToProcess[T](builders: Seq[T])(implicit convert: T => Source): Seq[Source] = applySeq(builders)
+ implicit def builderToProcess(builder: JProcessBuilder): ProcessBuilder = apply(builder)
+ implicit def fileToProcess(file: File): FileBuilder = apply(file)
+ implicit def urlToProcess(url: URL): URLBuilder = apply(url)
+ implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = apply(command)
+ implicit def stringToProcess(command: String): ProcessBuilder = apply(command)
+ implicit def stringSeqToProcess(command: Seq[String]): ProcessBuilder = apply(command)
+}
diff --git a/src/library/scala/sys/process/ProcessBuilder.scala b/src/library/scala/sys/process/ProcessBuilder.scala
new file mode 100644
index 000000000000..798796b29cdf
--- /dev/null
+++ b/src/library/scala/sys/process/ProcessBuilder.scala
@@ -0,0 +1,113 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+package scala.sys
+package process
+
+import processAliases._
+import ProcessBuilder._
+
+/** Represents a runnable process. */
+trait ProcessBuilder extends Source with Sink {
+ /** Starts the process represented by this builder, blocks until it exits, and returns the output as a String. Standard error is
+ * sent to the console. If the exit code is non-zero, an exception is thrown.*/
+ def !! : String
+ /** Starts the process represented by this builder, blocks until it exits, and returns the output as a String. Standard error is
+ * sent to the provided ProcessLogger. If the exit code is non-zero, an exception is thrown.*/
+ def !!(log: ProcessLogger): String
+ /** Starts the process represented by this builder. The output is returned as a Stream that blocks when lines are not available
+ * but the process has not completed. Standard error is sent to the console. If the process exits with a non-zero value,
+ * the Stream will provide all lines up to termination and then throw an exception. */
+ def lines: Stream[String]
+ /** Starts the process represented by this builder. The output is returned as a Stream that blocks when lines are not available
+ * but the process has not completed. Standard error is sent to the provided ProcessLogger. If the process exits with a non-zero value,
+ * the Stream will provide all lines up to termination but will not throw an exception. */
+ def lines(log: ProcessLogger): Stream[String]
+ /** Starts the process represented by this builder. The output is returned as a Stream that blocks when lines are not available
+ * but the process has not completed. Standard error is sent to the console. If the process exits with a non-zero value,
+ * the Stream will provide all lines up to termination but will not throw an exception. */
+ def lines_! : Stream[String]
+ /** Starts the process represented by this builder. The output is returned as a Stream that blocks when lines are not available
+ * but the process has not completed. Standard error is sent to the provided ProcessLogger. If the process exits with a non-zero value,
+ * the Stream will provide all lines up to termination but will not throw an exception. */
+ def lines_!(log: ProcessLogger): Stream[String]
+ /** Starts the process represented by this builder, blocks until it exits, and returns the exit code. Standard output and error are
+ * sent to the console.*/
+ def ! : Int
+ /** Starts the process represented by this builder, blocks until it exits, and returns the exit code. Standard output and error are
+ * sent to the given ProcessLogger.*/
+ def !(log: ProcessLogger): Int
+ /** Starts the process represented by this builder, blocks until it exits, and returns the exit code. Standard output and error are
+ * sent to the console. The newly started process reads from standard input of the current process.*/
+ def !< : Int
+ /** Starts the process represented by this builder, blocks until it exits, and returns the exit code. Standard output and error are
+ * sent to the given ProcessLogger. The newly started process reads from standard input of the current process.*/
+ def !<(log: ProcessLogger): Int
+ /** Starts the process represented by this builder. Standard output and error are sent to the console.*/
+ def run(): Process
+ /** Starts the process represented by this builder. Standard output and error are sent to the given ProcessLogger.*/
+ def run(log: ProcessLogger): Process
+ /** Starts the process represented by this builder. I/O is handled by the given ProcessIO instance.*/
+ def run(io: ProcessIO): Process
+ /** Starts the process represented by this builder. Standard output and error are sent to the console.
+ * The newly started process reads from standard input of the current process if `connectInput` is true.*/
+ def run(connectInput: Boolean): Process
+ /** Starts the process represented by this builder, blocks until it exits, and returns the exit code. Standard output and error are
+ * sent to the given ProcessLogger.
+ * The newly started process reads from standard input of the current process if `connectInput` is true.*/
+ def run(log: ProcessLogger, connectInput: Boolean): Process
+
+ /** Constructs a command that runs this command first and then `other` if this command succeeds.*/
+ def #&& (other: ProcessBuilder): ProcessBuilder
+ /** Constructs a command that runs this command first and then `other` if this command does not succeed.*/
+ def #|| (other: ProcessBuilder): ProcessBuilder
+ /** Constructs a command that will run this command and pipes the output to `other`. `other` must be a simple command.*/
+ def #| (other: ProcessBuilder): ProcessBuilder
+ /** Constructs a command that will run this command and then `other`. The exit code will be the exit code of `other`.*/
+ def ### (other: ProcessBuilder): ProcessBuilder
+
+ def canPipeTo: Boolean
+}
+
+object ProcessBuilder extends ProcessBuilderImpl {
+ trait URLBuilder extends Source {
+
+ }
+ trait FileBuilder extends Sink with Source {
+ def #<<(f: File): ProcessBuilder
+ def #<<(u: URL): ProcessBuilder
+ def #<<(i: => InputStream): ProcessBuilder
+ def #<<(p: ProcessBuilder): ProcessBuilder
+ }
+ trait Source {
+ protected def toSource: ProcessBuilder
+ /** Writes the output stream of this process to the given file. */
+ def #> (f: File): ProcessBuilder = toFile(f, false)
+ /** Appends the output stream of this process to the given file. */
+ def #>> (f: File): ProcessBuilder = toFile(f, true)
+ /** Writes the output stream of this process to the given OutputStream. The
+ * argument is call-by-name, so the stream is recreated, written, and closed each
+ * time this process is executed. */
+ def #>(out: => OutputStream): ProcessBuilder = #> (new OStreamBuilder(out, "