You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/07/25 14:08:25 UTC

[PR] feat: add jspecify null-safety annotations to actor-typed, cluster-sharding-typed, and testkit javadsl [pekko]

He-Pin opened a new pull request, #3380:
URL: https://github.com/apache/pekko/pull/3380

   ### Motivation
   
   Extend jspecify coverage to remaining Java DSL modules (#2563), following the pattern established in streams (#2617) and persistence (#2850). JSpecify annotations help Java consumers understand null-safety contracts at compile time.
   
   ### Modification
   
   - Add `@NullMarked` package-info.java for `actor-typed`, `cluster-sharding-typed`, and `testkit` javadsl packages
   - Add `@Nullable` to `Behaviors.withMdc` `staticMdc` and `mdcForMessage` parameters (both explicitly checked for null in implementation)
   - Add `@Nullable` to `Entity.with*` methods in ClusterSharding (all wrapped in `Optional.ofNullable`, explicitly accepting null)
   - Add jspecify dependency to `actorTyped`, `testkit`, and `clusterShardingTyped` modules
   
   Annotations were added only where code logic provides clear evidence of nullable semantics (null checks, `Optional.ofNullable` wrapping). Return type annotations are not included because Scala 2.13 does not support type annotation syntax on return types.
   
   ### Result
   
   Java consumers get null-safety signals via JSpecify annotations for actor-typed, cluster-sharding-typed, and testkit Java DSLs.
   
   ### Tests
   
   - `sbt actor-typed/compile testkit/compile cluster-sharding-typed/compile` — all pass
   - `sbt "actor-typed-tests/testOnly org.apache.pekko.actor.typed.javadsl.*"` — 41 tests pass
   - `sbt actor-typed/mimaReportBinaryIssues testkit/mimaReportBinaryIssues cluster-sharding-typed/mimaReportBinaryIssues` — no issues
   - `sbt actor-typed/headerCheck testkit/headerCheck cluster-sharding-typed/headerCheck` — pass
   - `scalafmt --mode diff-ref=origin/main` — formatted
   - `git diff --check` — clean
   
   ### References
   
   Refs #2563


-- 
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] feat: add jspecify null-safety annotations to actor-typed, cluster-sharding-typed, and testkit javadsl [pekko]

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


-- 
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