Skip to content

Commit 78a8fe5

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 4d39ba2 commit 78a8fe5

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
@@ -118,9 +118,6 @@ object CompilerCommand extends DotClass {
118118
else if (settings.version.value) {
119119
ctx.echo(versionMsg)
120120
Nil
121-
} else if (!Properties.isJavaAtLeast("1.8")) {
122-
ctx.error("Dotty requires Java 8 to run")
123-
Nil
124121
}
125122
else if (shouldStopWithInfo) {
126123
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
@@ -121,19 +121,4 @@ trait PropertiesTrait {
121121
def versionMsg = "Scala %s %s -- %s".format(propCategory, versionString, copyrightString)
122122
def scalaCmd = if (isWin) "dotr.bat" else "dotr"
123123
def scalacCmd = if (isWin) "dotc.bat" else "dotc"
124-
125-
/** Can the java version be determined to be at least as high as the argument?
126-
* Hard to properly future proof this but at the rate 1.7 is going we can leave
127-
* the issue for our cyborg grandchildren to solve.
128-
*/
129-
def isJavaAtLeast(version: String) = {
130-
val okVersions = version match {
131-
case "1.5" => List("1.5", "1.6", "1.7", "1.8")
132-
case "1.6" => List("1.6", "1.7", "1.8")
133-
case "1.7" => List("1.7", "1.8")
134-
case "1.8" => List("1.8")
135-
case _ => Nil
136-
}
137-
okVersions exists (javaVersion startsWith _)
138-
}
139124
}

0 commit comments

Comments
 (0)