Merge branch 'stable-3.2'

* stable-3.2:
  Upgrade Gerrit API to 3.2.5.1
  Set Gerrit to v3.2.0-rc1

Change-Id: I11ba40a6f2b08d193d99f576c2d3ab34cd714a45
diff --git a/build.sbt b/build.sbt
index 24ddfd2..8bb7715 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,6 +1,6 @@
 enablePlugins(GitVersioning)
 
-val gerritApiVersion = "3.1.0-rc1"
+val gerritApiVersion = "3.2.5.1"
 
 val pluginName = "analytics"
 
@@ -20,15 +20,16 @@
       "io.fabric8" % "gitective-core" % "0.9.54"
         exclude ("org.eclipse.jgit", "org.eclipse.jgit"),
 
-      "com.google.inject" % "guice" % "4.2.0" % Provided,
+      "com.google.inject" % "guice" % "4.2.3" % Provided,
       "com.google.gerrit" % "gerrit-plugin-api" % gerritApiVersion % Provided withSources(),
       "com.google.code.gson" % "gson" % "2.8.5" % Provided,
       "joda-time" % "joda-time" % "2.9.9",
+      "org.scala-lang.modules" %% "scala-java8-compat" % "0.9.1",
 
       "com.google.gerrit" % "gerrit-acceptance-framework" % gerritApiVersion % Test,
-      "org.bouncycastle" % "bcpg-jdk15on" % "1.60" % Test,
+      "org.bouncycastle" % "bcpg-jdk15on" % "1.61" % Test,
       "org.scalatest" %% "scalatest" % "3.0.1" % Test,
-      "net.codingwell" %% "scala-guice" % "4.1.0" % Test),
+      "net.codingwell" %% "scala-guice" % "4.2.6" % Test),
 
     assemblyJarName in assembly := s"$pluginName.jar",
 
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 4e8a43e..6adb617 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,6 +26,7 @@
 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.util.matching.Regex
@@ -44,7 +45,7 @@
     val objectId = cacheKey.commitId
     val nameKey = Project.nameKey(cacheKey.projectName)
     val commentInfoList: Seq[CommentLinkInfo] =
-      if(config.isExtractIssues) projectCache.get(nameKey).getCommentLinks.asScala else Seq.empty
+      if(config.isExtractIssues) projectCache.get(nameKey).asScala.toList.flatMap(_.getCommentLinks.asScala) else Seq.empty
     val replacers = commentInfoList.map(info =>
       Replacer(
         info.`match`.r,