pjfanning commented on code in PR #3720:
URL: https://github.com/apache/pekko/pull/3720#discussion_r4394209036


##########
actor-typed/src/main/scala/org/apache/pekko/actor/typed/javadsl/Adapter.scala:
##########
@@ -153,7 +153,7 @@ object Adapter {
    * takes a classic [[pekko.actor.Props]] parameter. Cluster Sharding is an
    * example of that.
    */
-  def props[T](behavior: Creator[Behavior[T]], deploy: Props): 
pekko.actor.Props =
+  def props[T](behavior: Creator[? <: Behavior[T]], deploy: Props): 
pekko.actor.Props =

Review Comment:
   Here `T` is otherwise unconstrained - `props` returns untyped classic 
`Props` - so Java simply infers `T` from whatever `Creator<Behavior<X>>` is 
passed, and any behavior is already accepted. `Behavior[? >: T]` would not 
admit anything more (and `Behavior` itself is invariant), so I have left it as 
is.



##########
persistence-typed/src/main/scala/org/apache/pekko/persistence/typed/state/javadsl/Effect.scala:
##########
@@ -189,7 +189,7 @@ import pekko.persistence.typed.state.internal.SideEffect
    */
   def thenReply[ReplyMessage](
       replyTo: ActorRef[ReplyMessage],
-      replyWithMessage: function.Function[State, ReplyMessage]): 
ReplyEffectWithStop[State] =
+      replyWithMessage: function.Function[? >: State, ? <: ReplyMessage]): 
ReplyEffectWithStop[State] =

Review Comment:
   Added `persistThenReplyWithFunctionOverSupertypeOfState` to both 
`DurableStateReplyEffectTest` and `EventSourcedReplyEffectTest` in d64247e9a4 - 
they pass a pre-typed `Function<Number, Integer>` reply function where the 
state is `Integer`, which only compiles with the widened parameter. `thenRun` 
was already covered by 
`EventSourcedBehaviorJavaDslTest.acceptHandlersTypedOverSupertypes`.



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

Reply via email to