From 2b5539bfabe63a342b88e076ab5d4426981ef42e Mon Sep 17 00:00:00 2001 From: Naftoli Gugenheim <98384+nafg@users.noreply.github.com> Date: Wed, 9 Jul 2025 00:14:29 -0400 Subject: [PATCH] ProblemReporting: support more non-wildcard digits Currently this doesn't work correctly for version strings like from sbt-dynver, because it looks at all the digits after the last period. However the digits of a version string like `3.6.1+42-c80fbe6a+20250708-2356-SNAPSHOT` create a number far greater than `Short.MaxValue`. It's even larger than `Int.MaxValue.` So the easiest fix seems to be to just go with `Long.MaxValue`. --- .../scala/com/typesafe/tools/mima/core/ProblemReporting.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/com/typesafe/tools/mima/core/ProblemReporting.scala b/core/src/main/scala/com/typesafe/tools/mima/core/ProblemReporting.scala index 0758ee46..b929cc1b 100644 --- a/core/src/main/scala/com/typesafe/tools/mima/core/ProblemReporting.scala +++ b/core/src/main/scala/com/typesafe/tools/mima/core/ProblemReporting.scala @@ -7,7 +7,7 @@ private[mima] object ProblemReporting { // version string "x.y.z" is converted to an Int tuple (x, y, z) for comparison val VersionRegex = """(\d+)\.?(\d+)?\.?(.*)?""".r def int(versionPart: String) = - Try(versionPart.replace("x", Short.MaxValue.toString).filter(_.isDigit).toInt).getOrElse(0) + Try(versionPart.replace("x", Long.MaxValue.toString).filter(_.isDigit).toInt).getOrElse(0) Ordering[(Int, Int, Int)].on[String] { case VersionRegex(x, y, z) => (int(x), int(y), int(z)) case bad => throw new IllegalArgumentException(bad)