You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by jr...@apache.org on 2022/11/03 11:23:42 UTC

[incubator-pekko-http] 12/47: core: fix remaining compilation errors (not related to parsing)

This is an automated email from the ASF dual-hosted git repository.

jrudolph pushed a commit to branch scala-3
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-http.git

commit ebd17d4dce37ffd7d08f7f5ea1159db406600356
Author: Johannes Rudolph <jo...@gmail.com>
AuthorDate: Wed Feb 16 12:17:12 2022 +0100

    core: fix remaining compilation errors (not related to parsing)
---
 .../akka/http/impl/engine/http2/BufferedOutletSupport.scala   |  2 +-
 .../akka/http/impl/engine/http2/Http2StreamHandling.scala     |  2 +-
 .../scala/akka/http/impl/engine/rendering/RenderSupport.scala | 11 +++++++----
 .../src/main/scala/akka/http/impl/util/Rendering.scala        |  2 +-
 .../scala/akka/http/impl/util/StageLoggingWithOverride.scala  |  2 +-
 .../src/main/scala/akka/http/impl/util/StreamUtils.scala      |  2 +-
 .../akka/http/javadsl/settings/Http2ServerSettings.scala      |  2 +-
 .../src/main/scala/akka/http/scaladsl/model/HttpMessage.scala |  2 +-
 .../src/main/scala/akka/http/scaladsl/model/MediaType.scala   |  2 +-
 .../akka/http/scaladsl/settings/ConnectionPoolSettings.scala  |  3 ++-
 10 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/http2/BufferedOutletSupport.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/http2/BufferedOutletSupport.scala
index 1b64123fb..d64fbbf21 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/engine/http2/BufferedOutletSupport.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/engine/http2/BufferedOutletSupport.scala
@@ -98,7 +98,7 @@ private[http2] class BufferedOutletExtended[T](outlet: GenericOutlet[T]) extends
  * INTERNAL API
  */
 @InternalApi
-private[http2] trait GenericOutletSupport { logic: GraphStageLogic =>
+private[http2] trait GenericOutletSupport extends GraphStageLogic { logic =>
   def fromSubSourceOutlet[T](subSourceOutlet: SubSourceOutlet[T]): GenericOutlet[T] =
     new GenericOutlet[T] {
       def setHandler(handler: OutHandler): Unit = subSourceOutlet.setHandler(handler)
diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/http2/Http2StreamHandling.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/http2/Http2StreamHandling.scala
index 83b1f03ce..41e3640e3 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/engine/http2/Http2StreamHandling.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/engine/http2/Http2StreamHandling.scala
@@ -29,7 +29,7 @@ import scala.util.control.NoStackTrace
  * Mixed into the Http2ServerDemux graph logic.
  */
 @InternalApi
-private[http2] trait Http2StreamHandling { self: GraphStageLogic with LogHelper =>
+private[http2] trait Http2StreamHandling extends GraphStageLogic with LogHelper { self =>
   // required API from demux
   def isServer: Boolean
   def multiplexer: Http2Multiplexer
diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/rendering/RenderSupport.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/rendering/RenderSupport.scala
index d52330388..64666be6b 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/engine/rendering/RenderSupport.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/engine/rendering/RenderSupport.scala
@@ -49,10 +49,13 @@ private[http] object RenderSupport {
   val defaultLastChunkBytes: ByteString = renderChunk(HttpEntity.LastChunk)
 
   def CancelSecond[T, Mat](first: Source[T, Mat], second: Source[T, Any]): Source[T, Mat] = {
-    Source.fromGraph(GraphDSL.create(first) { implicit b => (frst: SourceShape[T]) =>
-      import GraphDSL.Implicits._
-      second ~> Sink.cancelled
-      SourceShape(frst.out)
+    Source.fromGraph(GraphDSL.create[SourceShape[T], Mat](first) { implicit b =>
+      {
+        case frst: SourceShape[T] =>
+          import GraphDSL.Implicits._
+          second ~> Sink.cancelled
+          SourceShape(frst.out)
+      }
     })
   }
 
diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/Rendering.scala b/akka-http-core/src/main/scala/akka/http/impl/util/Rendering.scala
index 2dead05bb..afd600345 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/util/Rendering.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/util/Rendering.scala
@@ -218,7 +218,7 @@ private[http] trait Rendering {
   /**
    * Renders the given string in double quotes.
    */
-  def ~~#!(s: String): this.type = ~~('"').putEscaped(s) ~~ '"'
+  def ~~#!(s: String): this.type = this.~~('"').putEscaped(s, Rendering.`\"`, '\\').~~('"')
 
   def putEscaped(s: String, escape: CharPredicate = Rendering.`\"`, escChar: Char = '\\'): this.type = {
     @tailrec def rec(ix: Int = 0): this.type =
diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala b/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala
index 7b99a8ecb..83f8aa932 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/util/StageLoggingWithOverride.scala
@@ -19,7 +19,7 @@ import akka.stream.ActorMaterializer
  * INTERNAL API
  */
 @InternalApi
-private[akka] trait StageLoggingWithOverride { self: GraphStageLogic =>
+private[akka] trait StageLoggingWithOverride extends GraphStageLogic {
   def logOverride: LoggingAdapter = DefaultNoLogging
 
   private var _log: LoggingAdapter = null
diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala b/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala
index 29c1792c1..597a3988a 100644
--- a/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala
+++ b/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala
@@ -260,7 +260,7 @@ private[http] object StreamUtils {
   def statefulAttrsMap[T, U](functionConstructor: Attributes => T => U): Flow[T, U, NotUsed] =
     Flow[T].via(ExposeAttributes[T, U](functionConstructor))
 
-  trait ScheduleSupport { self: GraphStageLogic =>
+  trait ScheduleSupport extends GraphStageLogic { self =>
     /**
      * Schedule a block to be run once after the given duration in the context of this graph stage.
      */
diff --git a/akka-http-core/src/main/scala/akka/http/javadsl/settings/Http2ServerSettings.scala b/akka-http-core/src/main/scala/akka/http/javadsl/settings/Http2ServerSettings.scala
index 4845481d4..92fc9eaff 100644
--- a/akka-http-core/src/main/scala/akka/http/javadsl/settings/Http2ServerSettings.scala
+++ b/akka-http-core/src/main/scala/akka/http/javadsl/settings/Http2ServerSettings.scala
@@ -12,7 +12,7 @@ import com.typesafe.config.Config
 import scala.concurrent.duration._
 
 @DoNotInherit
-trait Http2ServerSettings { self: scaladsl.settings.Http2ServerSettings =>
+trait Http2ServerSettings { self: scaladsl.settings.Http2ServerSettings with akka.http.scaladsl.settings.Http2ServerSettings.Http2ServerSettingsImpl =>
   def getRequestEntityChunkSize: Int = requestEntityChunkSize
   def withRequestEntityChunkSize(newRequestEntityChunkSize: Int): Http2ServerSettings
 
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala
index 85aafc83c..9ddf40e8a 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala
@@ -217,7 +217,7 @@ sealed trait HttpMessage extends jm.HttpMessage {
   def addHeaders(headers: JIterable[jm.HttpHeader]): Self = withHeaders(this.headers ++ headers.asScala.asInstanceOf[Iterable[HttpHeader]])
   /** Java API */
   def withHeaders(headers: JIterable[jm.HttpHeader]): Self =
-    withHeaders(headers.asScala.toVector.map(x => JavaMapping.toScala(x))
+    withHeaders(headers.asScala.toVector.map(x => JavaMapping.toScala(x)))
   /** Java API */
   def getAttribute[T](attributeKey: jm.AttributeKey[T]): Optional[T] =
     Util.convertOption(attribute(attributeKey))
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala
index 1c03d9551..78fda309a 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/MediaType.scala
@@ -320,7 +320,7 @@ object MediaTypes extends ObjectRegistry[(String, String), MediaType] {
     mediaType
   }
 
-  private def register[T <: MediaType](mediaType: T): T = {
+  private def register(mediaType: MediaType): mediaType.type = {
     registerFileExtensions(mediaType)
     register(mediaType.mainType.toRootLowerCase -> mediaType.subType.toRootLowerCase, mediaType)
   }
diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala
index 603142903..f91b724b8 100644
--- a/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala
+++ b/akka-http-core/src/main/scala/akka/http/scaladsl/settings/ConnectionPoolSettings.scala
@@ -53,7 +53,8 @@ abstract class ConnectionPoolSettings extends js.ConnectionPoolSettings { self:
   // ---
 
   @ApiMayChange
-  def withHostOverrides(hostOverrides: immutable.Seq[(String, ConnectionPoolSettings)]): ConnectionPoolSettings = self.copy(hostOverrides = self.hostOverrides.map { case (h, s) => ConnectionPoolSettingsImpl.hostRegex(h) -> s })
+  def withHostOverrides(hostOverrides: immutable.Seq[(String, ConnectionPoolSettings)]): ConnectionPoolSettings =
+    self.copy(hostOverrides = hostOverrides.map { case (h, s) => ConnectionPoolSettingsImpl.hostRegex(h) -> s })
 
   @ApiMayChange
   def appendHostOverride(hostPattern: String, settings: ConnectionPoolSettings): ConnectionPoolSettings = self.copy(hostOverrides = self.hostOverrides :+ (ConnectionPoolSettingsImpl.hostRegex(hostPattern) -> settings))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org