Skip to content

Commit 0852c0c

Browse files
authored
Merge pull request #873 from nafg/patch-1
ProblemReporting: support more non-wildcard digits
2 parents 813057f + d7869ac commit 0852c0c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

core/src/main/scala/com/typesafe/tools/mima/core/ProblemReporting.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import scala.util.Try
44

55
private[mima] object ProblemReporting {
66
val versionOrdering: Ordering[String] = {
7-
// version string "x.y.z" is converted to an Int tuple (x, y, z) for comparison
7+
// version string "x.y.z" is converted to a Long tuple (x, y, z) for comparison
88
val VersionRegex = """(\d+)\.?(\d+)?\.?(.*)?""".r
9-
def int(versionPart: String) =
10-
Try(versionPart.replace("x", Short.MaxValue.toString).filter(_.isDigit).toInt).getOrElse(0)
11-
Ordering[(Int, Int, Int)].on[String] {
12-
case VersionRegex(x, y, z) => (int(x), int(y), int(z))
9+
def long(versionPart: String) =
10+
Try(versionPart.replace("x", Long.MaxValue.toString).filter(_.isDigit).toLong).getOrElse(0L)
11+
Ordering[(Long, Long, Long)].on[String] {
12+
case VersionRegex(x, y, z) => (long(x), long(y), long(z))
1313
case bad => throw new IllegalArgumentException(bad)
1414
}
1515
}

0 commit comments

Comments
 (0)