From 6a8eb6bacc67c38d2a2a48880d6bf63526f7c880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andr=C3=A9n?= Date: Tue, 27 Mar 2018 10:42:35 +0200 Subject: [PATCH] Fix type parameters in Java API to work with latest Akka #1952 (#1965) --- .../src/main/java/akka/http/javadsl/model/Multiparts.java | 2 +- .../src/main/scala/akka/http/scaladsl/model/Multipart.scala | 4 ++-- .../src/main/scala/akka/http/javadsl/testkit/WSProbe.scala | 2 +- .../akka/http/javadsl/testkit/WSTestRequestBuilding.scala | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/akka-http-core/src/main/java/akka/http/javadsl/model/Multiparts.java b/akka-http-core/src/main/java/akka/http/javadsl/model/Multiparts.java index 81b0159bbac..edcc9bd96f3 100644 --- a/akka-http-core/src/main/java/akka/http/javadsl/model/Multiparts.java +++ b/akka-http-core/src/main/java/akka/http/javadsl/model/Multiparts.java @@ -31,7 +31,7 @@ public static Multipart.FormData createFormDataFromParts(Multipart.FormData.Body * Constructor for `multipart/form-data` content as defined in http://tools.ietf.org/html/rfc2388. * All parts must have distinct names. (This is not verified!) */ - public static Multipart.FormData createFormDataFromSourceParts(Source parts) { + public static Multipart.FormData createFormDataFromSourceParts(Source parts) { return akka.http.scaladsl.model.Multipart.FormData$.MODULE$.createSource(parts.asScala()); } diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/Multipart.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/Multipart.scala index 429ec0a9088..3e0c9234e18 100644 --- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/Multipart.scala +++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/Multipart.scala @@ -256,7 +256,7 @@ object Multipart { /** Java API */ override def getParts: JSource[jm.Multipart.General.BodyPart.Strict, AnyRef] = - super.getParts.asInstanceOf[JSource[_ <: jm.Multipart.General.BodyPart.Strict, AnyRef]] + super.getParts.asInstanceOf[JSource[jm.Multipart.General.BodyPart.Strict, AnyRef]] /** Java API */ override def getStrictParts: java.lang.Iterable[jm.Multipart.General.BodyPart.Strict] = @@ -361,7 +361,7 @@ object Multipart { } /** INTERNAL API */ @InternalApi - private[akka] def createSource(parts: Source[akka.http.javadsl.model.Multipart.FormData.BodyPart, Any]): Multipart.FormData = { + private[akka] def createSource(parts: Source[akka.http.javadsl.model.Multipart.FormData.BodyPart, _]): Multipart.FormData = { apply(parts.asInstanceOf[Source[Multipart.FormData.BodyPart, Any]]) } diff --git a/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSProbe.scala b/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSProbe.scala index 8b740711e93..374369381ee 100644 --- a/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSProbe.scala +++ b/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSProbe.scala @@ -26,7 +26,7 @@ import scala.concurrent.duration._ */ class WSProbe(delegate: st.WSProbe) { - def flow: Flow[Message, Message, Any] = { + def flow: Flow[Message, Message, NotUsed] = { val underlying = scaladsl.Flow[Message].map(_.asScala).via(delegate.flow).map(_.asJava) new Flow[Message, Message, NotUsed](underlying) } diff --git a/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSTestRequestBuilding.scala b/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSTestRequestBuilding.scala index dc47d64dfc6..c79c772b378 100644 --- a/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSTestRequestBuilding.scala +++ b/akka-http-testkit/src/main/scala/akka/http/javadsl/testkit/WSTestRequestBuilding.scala @@ -17,13 +17,13 @@ import akka.stream.{ Materializer, scaladsl } trait WSTestRequestBuilding { - def WS(uri: Uri, clientSideHandler: Flow[Message, Message, Any], materializer: Materializer): HttpRequest = { + def WS[T](uri: Uri, clientSideHandler: Flow[Message, Message, T], materializer: Materializer): HttpRequest = { WS(uri, clientSideHandler, materializer, java.util.Collections.emptyList()) } - def WS( + def WS[T]( uri: Uri, - clientSideHandler: Flow[Message, Message, Any], + clientSideHandler: Flow[Message, Message, T], materializer: Materializer, subprotocols: java.util.List[String]): HttpRequest = {