From 71ec0275712d34ed6a07485ad983502e64e6f846 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 6 Oct 2024 19:49:17 +0900 Subject: [PATCH 1/4] avoid deprecated collection.mutable.MultiMap --- .../src/main/scala/xsbti/TestCallback.scala | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/zinc-testing/src/main/scala/xsbti/TestCallback.scala b/internal/zinc-testing/src/main/scala/xsbti/TestCallback.scala index 484407c2f..8ccc840a7 100644 --- a/internal/zinc-testing/src/main/scala/xsbti/TestCallback.scala +++ b/internal/zinc-testing/src/main/scala/xsbti/TestCallback.scala @@ -181,11 +181,18 @@ object TestCallback { } private def pairsToMultiMap[A, B](pairs: Seq[(A, B)]): Map[A, Set[B]] = { - import scala.collection.mutable.{ HashMap, MultiMap } - val emptyMultiMap = new HashMap[A, scala.collection.mutable.Set[B]] with MultiMap[A, B] - val multiMap = pairs.foldLeft(emptyMultiMap) { - case (acc, (key, value)) => - acc.addBinding(key, value) + import scala.collection.mutable.HashMap + val multiMap = HashMap.empty[A, scala.collection.mutable.Set[B]] + pairs.foreach { + case (key, value) => + multiMap.get(key) match { + case None => + val set = collection.mutable.Set.empty[B] + set += value + multiMap(key) = set + case Some(set) => + set += value + } } // convert all collections to immutable variants multiMap.toMap.mapValues(_.toSet).toMap.withDefaultValue(Set.empty) From 9689180509f219cc172165ef4fc351e06f723b29 Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:29:51 -0700 Subject: [PATCH 2/4] Remove deprecated OpenHashMap --- .../src/main/scala/sbt/internal/inc/ReflectUtilities.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala index 61f376182..06b9e2aec 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala @@ -13,6 +13,7 @@ package sbt package internal package inc +import java.lang.reflect.Field import scala.collection._ object ReflectUtilities { @@ -33,10 +34,10 @@ object ReflectUtilities { def ancestry(clazz: Class[?]): List[Class[?]] = if (clazz == classOf[AnyRef] || !classOf[AnyRef].isAssignableFrom(clazz)) List(clazz) - else clazz :: ancestry(clazz.getSuperclass); + else clazz :: ancestry(clazz.getSuperclass) - def fields(clazz: Class[?]) = - mutable.OpenHashMap(ancestry(clazz).flatMap(_.getDeclaredFields).map(f => (f.getName, f)): _*) + def fields(clazz: Class[?]): mutable.Map[String, Field] = + mutable.AnyRefMap(ancestry(clazz).flatMap(_.getDeclaredFields).map(f => (f.getName, f)): _*) /** * Collects all `val`s of type `T` defined on value `self`. From 92b1cbfd088bedfaaff818153e4bd33b32ee9220 Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:43:26 -0700 Subject: [PATCH 3/4] Add MIMA exclusion rule --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index 79775dc50..9c8e872f2 100644 --- a/build.sbt +++ b/build.sbt @@ -641,6 +641,9 @@ lazy val zincClasspath = (projectMatrix in internalPath / "zinc-classpath") exclude[IncompatibleResultTypeProblem]( "sbt.internal.inc.classpath.NativeCopyConfig.*" ), + exclude[IncompatibleResultTypeProblem]( + "sbt.internal.inc.ReflectUtilities.fields" + ), exclude[IncompatibleSignatureProblem]( "sbt.internal.inc.classpath.NativeCopyConfig.*" ), From 7aa4a1f95d0bf69fc828b22c40849316ad1b3efb Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:53:53 -0700 Subject: [PATCH 4/4] Add all major zinc versions to mimaPreviousArtifacts --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index 9c8e872f2..4f2dea499 100644 --- a/build.sbt +++ b/build.sbt @@ -29,6 +29,9 @@ def mimaSettings: Seq[Setting[?]] = Seq( "1.5.0", "1.6.0", "1.7.0", + "1.8.0", + "1.9.0", + "1.10.0", ) val versions = if (scalaVersion.value.startsWith("2.12.")) pre140 ++ post140