Skip to content

Commit e71dc97

Browse files
committed
handle JDK 11's format of java.specification.version
it's just a lone integer
1 parent bd9584a commit e71dc97

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

project/Version.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ object Version {
77
private val versionRegex0 = "v?([0-9]+)\\.([0-9]+)\\.([0-9]+)".r
88
private val versionRegex1 = "v?([0-9]+)\\.([0-9]+)\\.([0-9]+)-M([0-9]+)".r
99
private val versionRegex2 = "([0-9]+)\\.([0-9]+)".r
10+
private val versionRegex3 = "([0-9]+)".r
1011
def parse(raw: String): Option[Version] = {
1112
raw match {
1213
case versionRegex0(major, minor, patch) =>
1314
Some(Version(major.toInt, minor.toInt, patch.toInt))
1415
case versionRegex1(major, minor, patch, _) =>
1516
Some(Version(major.toInt, minor.toInt, patch.toInt))
16-
case versionRegex2(major, minor) => Some(Version(major.toInt, minor.toInt, 0))
17-
case _ => None
17+
case versionRegex2(major, minor) =>
18+
Some(Version(major.toInt, minor.toInt, 0))
19+
case versionRegex3(major) =>
20+
Some(Version(major.toInt, 0, 0))
21+
case _ =>
22+
None
1823
}
1924
}
2025
}

0 commit comments

Comments
 (0)