OnFailure with SupervisorStrategy.resume throws a compile error


i am trying to follow the example provided on https://doc.akka.io/docs/akka/current/typed/guide/tutorial_1.html (Failure handling section). The java code doesn’t compile though.

private SupervisingActor(ActorContext<String> context) {
    child =

Compile error is

Error:(22, 25) java: no suitable method found for onFailure(akka.actor.SupervisorStrategy.Restart$)
    method akka.actor.typed.javadsl.Behaviors.Supervise.<Thr>onFailure(java.lang.Class<Thr>,akka.actor.typed.SupervisorStrategy) is not applicable
      (cannot infer type-variable(s) Thr
        (actual and formal argument lists differ in length))
    method akka.actor.typed.javadsl.Behaviors.Supervise.onFailure(akka.actor.typed.SupervisorStrategy) is not applicable
      (argument mismatch; akka.actor.SupervisorStrategy.Restart$ cannot be converted to akka.actor.typed.SupervisorStrategy)

I searched online and no one has reported this. :frowning:Is this just me then?

Thanks, p

I think it is that you have imported the wrong SupervisorStrategy, should be akka.actor.typed.SupervisorStrategy.

By clicking at the little document in the top right of the code sample in the docs you can see the full sources (which is compiled as a part of the Akka build) and compare imports.

That worked. Just me then :stuck_out_tongue:
Thank you, Johan! Much appreciated.