Moved the checks for executing JVM versus target JVM into better locations.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@13695 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
washburn 2008-01-13 11:32:11 +00:00
parent c2a0477a94
commit 12a5c97511
3 changed files with 14 additions and 15 deletions

View File

@ -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)

View File

@ -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) =>

View File

@ -271,6 +271,13 @@ object ScriptRunner {
: Unit =
{
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,
@ -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)