You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2025/10/26 12:25:02 UTC

(pekko) 01/01: chore: Silence pekko serializer warnings

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

hepin pushed a commit to branch serilization
in repository https://gitbox.apache.org/repos/asf/pekko.git

commit 63ee10fc5e2f57f573cf2da074c2e3f94bf6a216
Author: He-Pin <he...@gmail.com>
AuthorDate: Sun Oct 26 20:24:39 2025 +0800

    chore: Silence pekko serializer warnings
---
 .../org/apache/pekko/serialization/Serialization.scala      | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala
index 72e9c98062..f761186d7a 100644
--- a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala
+++ b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala
@@ -442,14 +442,21 @@ class Serialization(val system: ExtendedActorSystem) extends Extension {
     }
   }
 
+  private val PekkoPackagePrefix = "org.apache.pekko."
+  private val PekkoHttpPackagePrefix = "org.apache.pekko.http."
+  private val PekkoGrpcPackagePrefix = "org.apache.pekko.grpc."
+
   private def warnUnexpectedNonPekkoSerializer(clazz: Class[_], ser: Serializer): Boolean = {
-    if (clazz.getName.startsWith("org.apache.pekko.") && !ser.getClass.getName.startsWith("org.apache.pekko.")) {
+    val clazzName = clazz.getName
+    if (clazzName.startsWith(PekkoPackagePrefix) && !ser.getClass.getName.startsWith(PekkoPackagePrefix)
+      // no serializers for these in Pekko
+      && !(clazzName.startsWith(PekkoHttpPackagePrefix) || clazzName.startsWith(PekkoGrpcPackagePrefix))) {
       log.warning(
         "Using serializer [{}] for message [{}]. Note that this serializer " +
         "is not implemented by Apache Pekko. It's not recommended to replace serializers for messages " +
         "provided by Apache Pekko.",
         ser.getClass.getName,
-        clazz.getName)
+        clazzName)
       true
     } else false
   }
@@ -550,7 +557,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension {
 
     isJavaSerializationWarningEnabled &&
     (serializer.isInstanceOf[JavaSerializer] || serializer.isInstanceOf[DisabledJavaSerializer]) &&
-    !serializedClass.getName.startsWith("org.apache.pekko.") &&
+    !serializedClass.getName.startsWith(PekkoPackagePrefix) &&
     !serializedClass.getName.startsWith("java.lang.") &&
     !suppressWarningOnNonSerializationVerification(serializedClass)
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org