He-Pin opened a new pull request, #3386: URL: https://github.com/apache/pekko/pull/3386
### Motivation Java users can extend sealed traits and sealed abstract classes since Java has no `sealed` keyword. These types are designed under a closed-world assumption and should not be extended by user code. Marking them with `@DoNotInherit` clearly signals this intent and allows MiMa to safely permit adding methods to these interfaces in future releases. ### Modification Add `@DoNotInherit` annotation to ~110 public sealed types across 54 files in the following modules: - `actor` (ActorPath, ByteString, NotUsed, Status, FSM.Reason, Directive, LogEvent, Tcp/Udp/UdpConnected messages, DNS types) - `actor-typed` (PreRestart, PostStop, delivery Command traits) - `stream` (ThrottleMode, StreamSubscriptionTimeoutTerminationMode, Supervision.Directive, SslTlsOptions types, Shape ports, FlowMonitor.StreamState, FanIn/FanOutShape.Init, DrainingControl, CombinerBase) - `cluster` (MemberStatus, SubscriptionInitialStateMode, MemberEvent, ReachabilityEvent, DataCenterReachabilityEvent) - `cluster-tools` (ClusterClient messages, ClusterSingletonMessage, DistributedPubSubMediator types) - `cluster-sharding` (ShardRegionCommand/Query, ClusterShardingSettings types) - `cluster-sharding-typed` (ClusterShardingQuery, settings types, ShardingProducerController.Command) - `cluster-metrics` (CollectionControlMessage) - `cluster-typed` (javadsl Replicator types) - `distributed-data` (Replicator protocol types, VersionVector, ORMap/ORSet DeltaOp) - `persistence` (StashOverflowStrategy, EventSeq) - `persistence-typed` (EventSeq, ORSet.DeltaOp) - `persistence-tck` (CapabilityFlag, CapabilityFlags) - `persistence-testkit` (ExpectedRejection, ExpectedFailure, PersistenceProbeBehavior) - `testkit` (TestEvent, SocketUtil.Protocol) - `stream-testkit` (StageMessage) Types excluded (already annotated or not public API): - Types already having `@DoNotInherit` - Types with `@InternalApi` or `private[pekko]` visibility - Deprecated types (RemotingLifecycleEvent, PersistentFSM.Reason) - Types inside `private[pekko]` objects (ShardCoordinator.Internal types) ### Result Java users are clearly signaled that these sealed types are not for extension. Binary compatibility is preserved since `@DoNotInherit` is a class-retention marker annotation. ### Tests - `sbt actor/compile actor-typed/compile stream/compile cluster/compile` — success - `sbt cluster-tools/compile cluster-sharding/compile cluster-sharding-typed/compile` — success - `sbt cluster-metrics/compile distributed-data/compile cluster-typed/compile` — success - `sbt persistence/compile persistence-typed/compile testkit/compile` — success - `sbt stream-testkit/compile persistence-testkit/compile persistence-tck/compile` — success - `sbt actor/mimaReportBinaryIssues stream/mimaReportBinaryIssues cluster/mimaReportBinaryIssues` — success - `sbt actor-typed/mimaReportBinaryIssues cluster-tools/mimaReportBinaryIssues cluster-sharding/mimaReportBinaryIssues` — success - `sbt cluster-sharding-typed/mimaReportBinaryIssues distributed-data/mimaReportBinaryIssues cluster-typed/mimaReportBinaryIssues` — success - `sbt persistence/mimaReportBinaryIssues persistence-typed/mimaReportBinaryIssues testkit/mimaReportBinaryIssues` — success - `scalafmt --mode diff-ref=origin/main` — formatted - `git diff --check` — no whitespace errors ### References Fixes #1270 -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
