Skip to content

Commit d050346

Browse files
committed
Incorrect Java version check
The dotty implementation of Properties.isJavaAtLeast is broken for Java 9 (Fixed in Scalac at scala/scala#5276, but maybe we just shouldn't have a copy of Properties.scala in Dotty). The test is useless now anyway since we only compile with 2.12 which requires Java 8, so this code is never going to run on an older version of the JVM.
1 parent 33afaa2 commit d050346

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

compiler/src/dotty/tools/dotc/config/CompilerCommand.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ object CompilerCommand extends DotClass {
137137
else if (settings.version.value) {
138138
ctx.echo(versionMsg)
139139
Nil
140-
} else if (!Properties.isJavaAtLeast("1.8")) {
141-
ctx.error("Dotty requires Java 8 to run")
142-
Nil
143140
}
144141
else if (shouldStopWithInfo) {
145142
ctx.echo(infoMessage)

compiler/src/dotty/tools/dotc/config/Properties.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,4 @@ trait PropertiesTrait {
131131
def versionMsg = "Scala %s %s -- %s".format(propCategory, versionString, copyrightString)
132132
def scalaCmd = if (isWin) "dotr.bat" else "dotr"
133133
def scalacCmd = if (isWin) "dotc.bat" else "dotc"
134-
135-
/** Can the java version be determined to be at least as high as the argument?
136-
* Hard to properly future proof this but at the rate 1.7 is going we can leave
137-
* the issue for our cyborg grandchildren to solve.
138-
*/
139-
def isJavaAtLeast(version: String) = {
140-
val okVersions = version match {
141-
case "1.5" => List("1.5", "1.6", "1.7", "1.8")
142-
case "1.6" => List("1.6", "1.7", "1.8")
143-
case "1.7" => List("1.7", "1.8")
144-
case "1.8" => List("1.8")
145-
case _ => Nil
146-
}
147-
okVersions exists (javaVersion startsWith _)
148-
}
149134
}

0 commit comments

Comments
 (0)