Update Scala to 2.13.10 Change-Id: I6e9fd3d045cb2f48d489a4e9d045a3cdcb16fe67
diff --git a/build.sbt b/build.sbt index 23b5f1d..d24135d 100644 --- a/build.sbt +++ b/build.sbt
@@ -16,7 +16,7 @@ resolvers += Resolver.mavenLocal, version := gerritApiVersion, - scalaVersion := "2.11.12", + scalaVersion := "2.13.10", libraryDependencies ++= Seq( "io.fabric8" % "gitective-core" % "0.9.54"
diff --git a/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/BranchesExtractor.scala b/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/BranchesExtractor.scala index 9703da1..de45f80 100644 --- a/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/BranchesExtractor.scala +++ b/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/BranchesExtractor.scala
@@ -19,18 +19,18 @@ import org.eclipse.jgit.lib.{Constants, ObjectId, Repository} import org.eclipse.jgit.revwalk.RevWalk -import scala.collection.JavaConversions._ +import scala.jdk.CollectionConverters._ case class BranchesExtractor(repo: Repository) { lazy val branchesOfCommit: Map[ObjectId, Set[String]] = { use(new Git(repo)) { git => - git.branchList.call.foldLeft(Map.empty[ObjectId, Set[String]]) { (branchesAcc, ref) => + git.branchList.call.asScala.foldLeft(Map.empty[ObjectId, Set[String]]) { (branchesAcc, ref) => val branchName = ref.getName.drop(Constants.R_HEADS.length) use(new RevWalk(repo)) { rw: RevWalk => rw.markStart(rw.parseCommit(ref.getObjectId)) - rw.foldLeft(branchesAcc) { (thisBranchAcc, rev) => + rw.asScala.foldLeft(branchesAcc) { (thisBranchAcc, rev) => val sha1 = rev.getId thisBranchAcc.get(sha1) match { case Some(set) => thisBranchAcc + (sha1 -> (set + branchName))
diff --git a/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/CommitsStatisticsLoader.scala b/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/CommitsStatisticsLoader.scala index 6adb617..c9478b2 100644 --- a/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/CommitsStatisticsLoader.scala +++ b/src/main/scala/com/googlesource/gerrit/plugins/analytics/common/CommitsStatisticsLoader.scala
@@ -26,9 +26,9 @@ import org.eclipse.jgit.revwalk.RevWalk import org.eclipse.jgit.treewalk.{CanonicalTreeParser, EmptyTreeIterator} import org.eclipse.jgit.util.io.DisabledOutputStream -import scala.compat.java8.OptionConverters._ -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ +import scala.jdk.OptionConverters._ import scala.util.matching.Regex class CommitsStatisticsLoader @Inject() ( @@ -45,7 +45,7 @@ val objectId = cacheKey.commitId val nameKey = Project.nameKey(cacheKey.projectName) val commentInfoList: Seq[CommentLinkInfo] = - if(config.isExtractIssues) projectCache.get(nameKey).asScala.toList.flatMap(_.getCommentLinks.asScala) else Seq.empty + if(config.isExtractIssues) projectCache.get(nameKey).toScala.toList.flatMap(_.getCommentLinks.asScala) else Seq.empty val replacers = commentInfoList.map(info => Replacer( info.`match`.r,
diff --git a/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/CommitStatisticsCommentLinkSpec.scala b/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/CommitStatisticsCommentLinkSpec.scala index 2e5b756..9266b07 100644 --- a/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/CommitStatisticsCommentLinkSpec.scala +++ b/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/CommitStatisticsCommentLinkSpec.scala
@@ -24,7 +24,7 @@ import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.should.Matchers -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ @UseLocalDisk class CommitStatisticsCommentLinkSpec extends AnyFlatSpecLike with GerritTestDaemon with TestCommitStatisticsNoCache with Matchers with Inside {
diff --git a/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/ContributorsServiceSpec.scala b/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/ContributorsServiceSpec.scala index dea1ef8..a5d5558 100644 --- a/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/ContributorsServiceSpec.scala +++ b/src/test/scala/com/googlesource/gerrit/plugins/analytics/test/ContributorsServiceSpec.scala
@@ -26,7 +26,7 @@ import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.should.Matchers -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ @UseLocalDisk class ContributorsServiceSpec extends AnyFlatSpecLike with Matchers with GerritTestDaemon with Inside {