This is an automated email from the ASF dual-hosted git repository.

He-Pin pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/pekko-persistence-cassandra.git


The following commit(s) were added to refs/heads/main by this push:
     new e7ccd03  fix: resolve compiler warnings in Cassandra journal and 
snapshot store (#425)
e7ccd03 is described below

commit e7ccd037581eac700ef97e08e67c722272b9589f
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Tue Jun 16 17:18:52 2026 +0800

    fix: resolve compiler warnings in Cassandra journal and snapshot store 
(#425)
    
    Motivation:
    Compilation produces several warnings: "a type was inferred to be Any"
    in CassandraJournal and CassandraSnapshotStore log calls, "match may not
    be exhaustive" in CassandraSnapshotStore.loadNAsync, and sbt lint
    warnings about unused keys projectInfoVersion and previewPath.
    
    Modification:
    - Add explicit Array[AnyRef] type annotation and Long.box/Int.box for
      primitive values in log.warning Array arguments
    - Add @nowarn("msg=match may not be exhaustive") on loadNAsync where the
      Seq() and +: patterns are exhaustive for immutable.Seq but the compiler
      does not recognize this
    - Add excludeLintKeys for projectInfoVersion in Common.scala and
      previewPath in build.sbt
    
    Result:
    Clean compilation with no warnings.
    
    Tests:
    - sbt "clean; compile" passes with no warnings
    
    References:
    None - compiler warning cleanup
---
 build.sbt                                                         | 1 +
 .../pekko/persistence/cassandra/journal/CassandraJournal.scala    | 6 +++---
 .../persistence/cassandra/snapshot/CassandraSnapshotStore.scala   | 8 +++++---
 project/Common.scala                                              | 3 ++-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/build.sbt b/build.sbt
index fefe53a..e05c661 100644
--- a/build.sbt
+++ b/build.sbt
@@ -20,6 +20,7 @@ val mimaCompareVersion = "1.0.0"
 ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo
 ThisBuild / javafmtFormatterCompatibleJavaVersion := 17
 ThisBuild / evictionErrorLevel := Level.Info
+Global / excludeLintKeys += previewPath
 
 addCommandAlias("checkCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; 
javafmtCheckAll; +headerCheckAll")
 addCommandAlias("applyCodeStyle", "+headerCreateAll; scalafmtAll; scalafmtSbt; 
javafmtAll")
diff --git 
a/core/src/main/scala/org/apache/pekko/persistence/cassandra/journal/CassandraJournal.scala
 
b/core/src/main/scala/org/apache/pekko/persistence/cassandra/journal/CassandraJournal.scala
index a9d3914..e18e9c4 100644
--- 
a/core/src/main/scala/org/apache/pekko/persistence/cassandra/journal/CassandraJournal.scala
+++ 
b/core/src/main/scala/org/apache/pekko/persistence/cassandra/journal/CassandraJournal.scala
@@ -895,10 +895,10 @@ import scala.util.{ Failure, Success, Try }
                   case Failure(ex) =>
                     log.warning(
                       "Deserialization of event metadata failed (pid: [{}], 
seq_nr: [{}], meta_ser_id: [{}], meta_ser_manifest: [{}], ignoring metadata 
content. Exception: {}",
-                      Array(
+                      Array[AnyRef](
                         row.getString("persistence_id"),
-                        row.getLong("sequence_nr"),
-                        metaSerId,
+                        Long.box(row.getLong("sequence_nr")),
+                        Int.box(metaSerId),
                         metaSerManifest,
                         ex.toString))
                     OptionVal.None
diff --git 
a/core/src/main/scala/org/apache/pekko/persistence/cassandra/snapshot/CassandraSnapshotStore.scala
 
b/core/src/main/scala/org/apache/pekko/persistence/cassandra/snapshot/CassandraSnapshotStore.scala
index 3d8cc98..33713b4 100644
--- 
a/core/src/main/scala/org/apache/pekko/persistence/cassandra/snapshot/CassandraSnapshotStore.scala
+++ 
b/core/src/main/scala/org/apache/pekko/persistence/cassandra/snapshot/CassandraSnapshotStore.scala
@@ -16,6 +16,7 @@ package org.apache.pekko.persistence.cassandra.snapshot
 import com.datastax.oss.driver.api.core.cql._
 import com.datastax.oss.protocol.internal.util.Bytes
 import com.typesafe.config.Config
+import scala.annotation.nowarn
 import org.apache.pekko
 import pekko.{ Done, NotUsed }
 import pekko.actor._
@@ -120,6 +121,7 @@ import scala.util.{ Failure, Success }
     } yield res
   }
 
+  @nowarn("msg=match may not be exhaustive")
   private def loadNAsync(metadata: immutable.Seq[SnapshotMetadata]): 
Future[Option[SelectedSnapshot]] = metadata match {
     case Seq()     => Future.successful(None) // no snapshots stored
     case md +: mds =>
@@ -371,10 +373,10 @@ import scala.util.{ Failure, Success }
                   case Failure(ex) =>
                     log.warning(
                       "Deserialization of snapshot metadata failed (pid: [{}], 
seq_nr: [{}], meta_ser_id: [{}], meta_ser_manifest: [{}], ignoring metadata 
content. Exception: {}",
-                      Array(
+                      Array[AnyRef](
                         row.getString("persistence_id"),
-                        row.getLong("sequence_nr"),
-                        metaSerId,
+                        Long.box(row.getLong("sequence_nr")),
+                        Int.box(metaSerId),
                         metaSerManifest,
                         ex.toString))
                     OptionVal.None
diff --git a/project/Common.scala b/project/Common.scala
index 5e66d77..82c87a7 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -36,7 +36,8 @@ object Common extends AutoPlugin {
         "Contributors",
         "[email protected]",
         
url("https://github.com/apache/pekko-persistence-cassandra/graphs/contributors";)),
-      description := "A Cassandra plugin for Apache Pekko Persistence.")
+      description := "A Cassandra plugin for Apache Pekko Persistence.",
+      excludeLintKeys += projectInfoVersion)
 
   override lazy val projectSettings = Seq(
     projectInfoVersion := (if (isSnapshot.value) "snapshot" else 
version.value),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to