diff --git a/http/src/main/scala/org/apache/pekko/http/javadsl/server/RoutingJavaMapping.scala b/http/src/main/scala/org/apache/pekko/http/javadsl/server/RoutingJavaMapping.scala index 6fd3ab250..0b371c547 100644 --- a/http/src/main/scala/org/apache/pekko/http/javadsl/server/RoutingJavaMapping.scala +++ b/http/src/main/scala/org/apache/pekko/http/javadsl/server/RoutingJavaMapping.scala @@ -99,7 +99,7 @@ private[http] object RoutingJavaMapping { // val javaToScalaResponseEntity extends Inherited[javadsl.model.ResponseEntity, scaladsl.model.ResponseEntity] implicit final class ConvertCompletionStage[T](val stage: CompletionStage[T]) extends AnyVal { - import pekko.util.FutureConverters - def asScala = FutureConverters.asScala(stage) + import pekko.util.FutureConverters._ + def asScala = CompletionStageOps(stage).asScala } } diff --git a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala index eb269c968..2af03fedb 100644 --- a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala +++ b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala @@ -48,7 +48,6 @@ import java.util.function.Predicate import pekko.dispatch.ExecutionContexts import pekko.event.LoggingAdapter import pekko.http.javadsl.server -import pekko.util.FutureConverters import pekko.util.FutureConverters._ import scala.concurrent.duration.FiniteDuration @@ -98,8 +97,8 @@ abstract class BasicDirectives { def mapRouteResultFuture(f: JFunction[CompletionStage[RouteResult], CompletionStage[RouteResult]], inner: Supplier[Route]): Route = RouteAdapter { D.mapRouteResultFuture(stage => - FutureConverters.asScala( - f(stage.fast.map(_.asJava)(ExecutionContexts.parasitic).asJava)).fast.map(_.asScala)( + CompletionStageOps( + f(stage.fast.map(_.asJava)(ExecutionContexts.parasitic).asJava)).asScala.fast.map(_.asScala)( ExecutionContexts.parasitic)) { inner.get.delegate } @@ -108,7 +107,7 @@ abstract class BasicDirectives { def mapRouteResultWith(f: JFunction[RouteResult, CompletionStage[RouteResult]], inner: Supplier[Route]): Route = RouteAdapter { D.mapRouteResultWith(r => - FutureConverters.asScala(f(r.asJava)).fast.map(_.asScala)(ExecutionContexts.parasitic)) { + CompletionStageOps(f(r.asJava)).asScala.fast.map(_.asScala)(ExecutionContexts.parasitic)) { inner.get.delegate } } @@ -116,7 +115,7 @@ abstract class BasicDirectives { def mapRouteResultWithPF( f: PartialFunction[RouteResult, CompletionStage[RouteResult]], inner: Supplier[Route]): Route = RouteAdapter { D.mapRouteResultWith(r => - FutureConverters.asScala(f(r.asJava)).fast.map(_.asScala)(ExecutionContexts.parasitic)) { + CompletionStageOps(f(r.asJava)).asScala.fast.map(_.asScala)(ExecutionContexts.parasitic)) { inner.get.delegate } } @@ -174,7 +173,7 @@ abstract class BasicDirectives { def recoverRejectionsWith( f: JFunction[JIterable[Rejection], CompletionStage[RouteResult]], inner: Supplier[Route]): Route = RouteAdapter { D.recoverRejectionsWith(rs => - FutureConverters.asScala(f.apply(Util.javaArrayList(rs.map(_.asJava)))).fast.map(_.asScala)( + CompletionStageOps(f.apply(Util.javaArrayList(rs.map(_.asJava)))).asScala.fast.map(_.asScala)( ExecutionContexts.parasitic)) { inner.get.delegate } }