This is an automated email from the ASF dual-hosted git repository. He-Pin pushed a commit to branch fix/resolve-compiler-warnings in repository https://gitbox.apache.org/repos/asf/pekko-persistence-jdbc.git
commit e500e05c7a5470e597f4de393b70129d876f6ba2 Author: 虎鸣 <[email protected]> AuthorDate: Tue Jun 16 11:49:13 2026 +0800 chore: resolve all compiler warnings in core module and build Motivation: Several compiler warnings were emitted during compilation, including a type inferred as Any, a class defined inside a package object, an unused private method, a non-exhaustive match, and an sbt lint warning about an unused key. Modification: - JdbcAsyncWriteJournal: add .map(_ => ()) before .recover to avoid Future[Any] inference when f is Future[?] - legacy/package.scala: add @nowarn for JournalRow class in package object (known Scala pattern, safe to suppress) - JdbcDurableStateStore: remove unused private updateDurableState method (upsertObject already calls queries.updateDbWithDurableState directly) - TrySeq: add @nowarn for non-exhaustive match warning (Try is sealed, so the match is exhaustive in practice) - build.sbt: add Global / excludeLintKeys += previewPath to suppress sbt lint warning about the previewPath key used by ParadoxSitePlugin Result: Clean compilation with zero warnings from both Scala compiler and sbt lint checks. Tests: - sbt "clean; compile" passes with no warnings References: None - compiler warning cleanup --- build.sbt | 2 ++ .../pekko/persistence/jdbc/journal/JdbcAsyncWriteJournal.scala | 2 +- .../pekko/persistence/jdbc/journal/dao/legacy/package.scala | 2 ++ .../persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala | 9 --------- .../scala/org/apache/pekko/persistence/jdbc/util/TrySeq.scala | 2 ++ 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 4e9351d7..71e610a1 100644 --- a/build.sbt +++ b/build.sbt @@ -23,6 +23,8 @@ ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo ThisBuild / javafmtFormatterCompatibleJavaVersion := 17 +Global / excludeLintKeys += previewPath + lazy val `pekko-persistence-jdbc` = project .in(file(".")) .enablePlugins(ScalaUnidocPlugin) diff --git a/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/JdbcAsyncWriteJournal.scala b/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/JdbcAsyncWriteJournal.scala index b151d6b1..b5589f1e 100644 --- a/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/JdbcAsyncWriteJournal.scala +++ b/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/JdbcAsyncWriteJournal.scala @@ -112,7 +112,7 @@ class JdbcAsyncWriteJournal(config: Config) extends AsyncWriteJournal { case f => // we must fetch the highest sequence number after the previous write has completed // If the previous write failed then we can ignore this - f.recover { case _ => () }.flatMap(_ => fetchHighestSeqNr()) + f.map(_ => ()).recover { case _ => () }.flatMap(_ => fetchHighestSeqNr()) } } diff --git a/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/dao/legacy/package.scala b/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/dao/legacy/package.scala index f3eaf6e4..c20ab49b 100644 --- a/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/dao/legacy/package.scala +++ b/core/src/main/scala/org/apache/pekko/persistence/jdbc/journal/dao/legacy/package.scala @@ -14,9 +14,11 @@ package org.apache.pekko.persistence.jdbc.journal.dao +import scala.annotation.nowarn import scala.collection.immutable.Set package object legacy { + @nowarn("msg=it is not recommended to define classes/objects inside of package objects") final case class JournalRow( ordering: Long, deleted: Boolean, diff --git a/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala b/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala index c534a8f2..6c61a54e 100644 --- a/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala +++ b/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateStore.scala @@ -244,15 +244,6 @@ class JdbcDurableStateStore[A]( row.stateTimestamp)) } - private def updateDurableState(row: DurableStateTables.DurableStateRow) = { - import queries._ - - for { - s <- getSequenceNextValueExpr() - u <- updateDbWithDurableState(row, s.head) - } yield u - } - private def insertDurableState(row: DurableStateTables.DurableStateRow) = { import queries._ diff --git a/core/src/main/scala/org/apache/pekko/persistence/jdbc/util/TrySeq.scala b/core/src/main/scala/org/apache/pekko/persistence/jdbc/util/TrySeq.scala index ce0c030f..0710c49b 100644 --- a/core/src/main/scala/org/apache/pekko/persistence/jdbc/util/TrySeq.scala +++ b/core/src/main/scala/org/apache/pekko/persistence/jdbc/util/TrySeq.scala @@ -14,11 +14,13 @@ package org.apache.pekko.persistence.jdbc.util +import scala.annotation.nowarn import scala.collection.immutable._ import scala.util.{ Failure, Success, Try } object TrySeq { def sequence[A](seq: Seq[Try[A]]): Try[Seq[A]] = { + @nowarn("msg=match may not be exhaustive") def recurse(remaining: Seq[Try[A]], processed: Seq[A]): Try[Seq[A]] = remaining match { case Seq() => Success(processed) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
