You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/05/08 23:59:38 UTC

[PR] Support ActorSystem/ClassicActorSystemProvider serializer constructors, improve error message [pekko]

pjfanning opened a new pull request, #2948:
URL: https://github.com/apache/pekko/pull/2948

   part of https://github.com/akka/akka-core/releases/tag/v2.8.2 that is now available under Apache License, v2.0
   
   ### Motivation
   
   Port of [akka/akka-core#31936](https://github.com/akka/akka-core/pull/31936).
   
   When `serializerOf` cascades through all constructor shapes and finds none, the user gets a `NoSuchMethodException` for `ClassicActorSystemProvider` and `String`, giving the impression that this is the only supported constructor shape. It would be better to have a personalized message saying none of the supported constructors were found, listing all the shapes that are tried.
   
   Additionally, serializers with `ActorSystem` or `ClassicActorSystemProvider` constructors (instead of `ExtendedActorSystem`) were not supported even though `ExtendedActorSystem` is a subtype.
   
   ### Modification
   
   - `serializerOf` now tries constructors in this order:
     1. `(ExtendedActorSystem)`
     2. `(ActorSystem)`
     3. `(ClassicActorSystemProvider)`
     4. `()` (no-arg)
     5. `(ExtendedActorSystem, String)` – binding name, only when bindingName is non-empty
     6. `(ActorSystem, String)`
     7. `(ClassicActorSystemProvider, String)`
   - On total failure, a `NoSuchMethodException` with an informative message listing all supported shapes (in try order) is returned.
   - Added `ConstructorSerializer` test helper classes (No1–No7 marker types + Constructor1Serializer–Constructor7Serializer covering each constructor shape) to `SerializeSpec.scala`.
   - Added config entries and a `"look for various constructors"` test case to `SerializeSpec`.
   
   ### Result
   
   Serializers with `ActorSystem` or `ClassicActorSystemProvider` constructors are now accepted. Failures produce a clear list of supported constructor shapes in the order they are tried.
   
   ### Tests
   
   - `sbt "actor-tests / Test / testOnly org.apache.pekko.serialization.SerializeSpec"` — All 18 tests passed.
   
   ### References
   
   Refs https://github.com/akka/akka-core/pull/31936


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Support ActorSystem/ClassicActorSystemProvider serializer constructors, improve error message [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #2948:
URL: https://github.com/apache/pekko/pull/2948


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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