summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-01-13 11:32:11 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-01-13 11:32:11 +0000
commitd27d64aa3087f119b570116019891e8a4e50934f (patch)
treef712f85d647a1070d577a6635b924669ff835074
parenta85358f76adc5d9346b78c8a1d8a189918a4e7f5 (diff)
downloadscala-d27d64aa3087f119b570116019891e8a4e50934f.tar.gz
scala-d27d64aa3087f119b570116019891e8a4e50934f.tar.bz2
scala-d27d64aa3087f119b570116019891e8a4e50934f.zip
Moved the checks for executing JVM versus targe...
Moved the checks for executing JVM versus target JVM into better locations.
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala7
-rw-r--r--src/compiler/scala/tools/nsc/InterpreterLoop.scala5
-rw-r--r--src/compiler/scala/tools/nsc/ScriptRunner.scala17
3 files changed, 14 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index fb20106aaf..9ec9b8b60d 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -60,6 +60,13 @@ import nsc.{InterpreterResults=>IR}
class Interpreter(val settings: Settings, out: PrintWriter) {
import symtab.Names
+ /* If the interpreter is running on pre-jvm-1.5 JVM,
+ it is necessary to force the target setting to jvm-1.4 */
+ val major = System.getProperty("java.class.version").split("\\.")(0)
+ if (Integer.valueOf(major).intValue < 49) {
+ this.settings.target.value = "jvm-1.4"
+ }
+
/** the compiler to compile expressions with */
val compiler: scala.tools.nsc.Global = newCompiler(settings, reporter)
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
index 562da8441f..50973bfb71 100644
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
@@ -278,11 +278,6 @@ class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) {
def main(settings: Settings) {
this.settings = settings
- val major = System.getProperty("java.class.version").split("\\.")(0)
- if (Integer.valueOf(major).intValue < 49) {
- this.settings.target.value = "jvm-1.4"
- }
-
in =
in0 match {
case Some(in0) =>
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index 6acccc14a2..46a59a0391 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -272,6 +272,13 @@ object ScriptRunner {
{
import Interpreter.deleteRecursively
+ /* If the script is running on pre-jvm-1.5 JVM,
+ it is necessary to force the target setting to jvm-1.4 */
+ val major = System.getProperty("java.class.version").split("\\.")(0)
+ if (Integer.valueOf(major).intValue < 49) {
+ settings.target.value = "jvm-1.4"
+ }
+
/** Compiles the script file, and returns two things:
* the directory with the compiled class files,
* and a flag for whether the compilation succeeded.
@@ -385,11 +392,6 @@ object ScriptRunner {
return
}
- val major = System.getProperty("java.class.version").split("\\.")(0)
- if (Integer.valueOf(major).intValue < 49) {
- settings.target.value = "jvm-1.4"
- }
-
withCompiledScript(settings, scriptFile){compiledLocation =>
runCompiled(settings, compiledLocation, scriptArgs)
}
@@ -410,11 +412,6 @@ object ScriptRunner {
str.close()
}
- val major = System.getProperty("java.class.version").split("\\.")(0)
- if (Integer.valueOf(major).intValue < 49) {
- settings.target.value = "jvm-1.4"
- }
-
withCompiledScript(settings, scriptFile.getPath){compiledLocation =>
scriptFile.delete()
runCompiled(settings, compiledLocation, scriptArgs)