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

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-http.git


The following commit(s) were added to refs/heads/main by this push:
     new ee430564a compiler warning issues (#714)
ee430564a is described below

commit ee430564a459c3d18fd5201cbbe994a1aff76d1f
Author: PJ Fanning <[email protected]>
AuthorDate: Thu Aug 7 09:34:46 2025 +0100

    compiler warning issues (#714)
    
    * compiler warning issues
    
    * Update HttpEntity.scala
    
    * Update ConnectionContext.scala
    
    * Update Http2Multiplexer.scala
    
    Update Http2Multiplexer.scala
---
 .../apache/pekko/http/impl/engine/http2/Http2.scala   |  4 ++++
 .../pekko/http/impl/engine/http2/Http2Demux.scala     |  2 +-
 .../http/impl/engine/http2/Http2Multiplexer.scala     |  5 ++---
 .../apache/pekko/http/javadsl/ConnectionContext.scala |  4 ++++
 .../pekko/http/javadsl/settings/ParserSettings.scala  |  2 +-
 .../scala/org/apache/pekko/http/scaladsl/Http.scala   |  5 +----
 .../apache/pekko/http/scaladsl/model/HttpEntity.scala | 19 +++++++++----------
 .../http/javadsl/server/directives/RouteAdapter.scala |  1 -
 .../javadsl/server/directives/RouteDirectives.scala   |  1 -
 project/Common.scala                                  |  4 ----
 10 files changed, 22 insertions(+), 25 deletions(-)

diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala
index aceb16aad..c30618635 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala
@@ -51,6 +51,7 @@ import pekko.util.ByteString
 import pekko.Done
 
 import javax.net.ssl.SSLEngine
+import scala.annotation.nowarn
 import scala.collection.immutable
 import scala.concurrent.Future
 import scala.concurrent.duration.Duration
@@ -218,6 +219,7 @@ private[http] final class Http2Ext(implicit val system: 
ActorSystem)
     def getChosenProtocol(): String = 
chosenProtocol.getOrElse(Http2AlpnSupport.HTTP11) // default to http/1, e.g. 
when ALPN jar is missing
 
     var eng: Option[SSLEngine] = None
+    @nowarn("msg=deprecated") // TODO find an alternative way to do this
     def createEngine(): SSLEngine = {
       val engine = httpsContext.sslContextData match {
         case Left(ssl) =>
@@ -230,6 +232,7 @@ private[http] final class Http2Ext(implicit val system: 
ActorSystem)
       engine.setUseClientMode(false)
       Http2AlpnSupport.enableForServer(engine, setChosenProtocol)
     }
+    @nowarn("msg=deprecated") // TODO find an alternative way to do this
     val tls = TLS(() => createEngine(), _ => Success(()), IgnoreComplete)
 
     ProtocolSwitch(_ => getChosenProtocol(), http1, http2).join(
@@ -239,6 +242,7 @@ private[http] final class Http2Ext(implicit val system: 
ActorSystem)
   def outgoingConnection(host: String, port: Int, connectionContext: 
HttpsConnectionContext,
       clientConnectionSettings: ClientConnectionSettings, log: LoggingAdapter)
       : Flow[HttpRequest, HttpResponse, Future[OutgoingConnection]] = {
+    @nowarn("msg=deprecated") // TODO find an alternative way to do this
     def createEngine(): SSLEngine = {
       val engine = connectionContext.sslContextData match {
         // TODO FIXME configure hostname verification for this case
diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
index 1a65da915..c1a91b71a 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
@@ -314,7 +314,7 @@ private[http2] abstract class Http2Demux(http2Settings: 
Http2CommonSettings,
 
         pingState.tickInterval().foreach(interval =>
           // to limit overhead rather than constantly rescheduling a timer and 
looking at system time we use a constant timer
-          schedulePeriodically(ConfigurablePing.Tick, interval))
+          scheduleAtFixedRate(ConfigurablePing.Tick, interval, interval))
       }
 
       override def pushGOAWAY(errorCode: ErrorCode, debug: String): Unit = {
diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Multiplexer.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Multiplexer.scala
index 633d26b66..62e371d3f 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Multiplexer.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Multiplexer.scala
@@ -14,18 +14,17 @@
 package org.apache.pekko.http.impl.engine.http2
 
 import org.apache.pekko
-import pekko.http.ccompat._
-
 import pekko.annotation.InternalApi
 import pekko.event.LoggingAdapter
 import pekko.http.impl.engine.http2.FrameEvent._
+import pekko.http.ccompat._
 import pekko.http.scaladsl.settings.Http2CommonSettings
 import pekko.macros.LogHelper
 import pekko.stream.stage.GraphStageLogic
 import pekko.stream.stage.OutHandler
 import pekko.stream.stage.StageLogging
-import scala.annotation.nowarn
 
+import scala.annotation.nowarn
 import scala.collection.mutable
 
 /**
diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala
index 5124ee194..1ff5f086c 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/javadsl/ConnectionContext.scala
@@ -15,6 +15,8 @@ package org.apache.pekko.http.javadsl
 
 import java.util.{ Collection => JCollection, Optional }
 
+import scala.annotation.nowarn
+
 import org.apache.pekko
 import pekko.annotation.{ ApiMayChange, DoNotInherit }
 import pekko.http.impl.util.Util
@@ -67,6 +69,7 @@ object ConnectionContext {
     scaladsl.ConnectionContext.https(sslContext)
 
   /** Used to serve HTTPS traffic. */
+  @nowarn("msg=deprecated")
   @Deprecated @deprecated("use httpsServer, httpsClient or the method that 
takes a custom factory",
     since = "Akka HTTP 10.2.0")
   def https(
@@ -118,6 +121,7 @@ abstract class ConnectionContext {
 @DoNotInherit
 abstract class HttpConnectionContext extends 
pekko.http.javadsl.ConnectionContext {
   override final def isSecure = false
+  @nowarn("msg=deprecated")
   override def sslConfig: Option[PekkoSSLConfig] = None
 }
 
diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ParserSettings.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ParserSettings.scala
index 98c9af58c..6eaa2aded 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ParserSettings.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/javadsl/settings/ParserSettings.scala
@@ -138,7 +138,7 @@ object ParserSettings extends 
SettingsCompanion[ParserSettings] {
    */
   @Deprecated
   @deprecated("Use forServer or forClient instead", since = "Akka HTTP 10.2.0")
-  @nowarn("msg=create overrides concrete, non-deprecated symbol")
+  @nowarn("msg=deprecated")
   override def create(system: ActorSystem): ParserSettings = 
create(system.settings.config)
 
   def forServer(system: ClassicActorSystemProvider): ParserSettings =
diff --git a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/Http.scala 
b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/Http.scala
index ee8e6ab8c..753f6780a 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/Http.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/Http.scala
@@ -190,7 +190,6 @@ class HttpExt @InternalStableApi /* constructor signature 
is hardcoded in Teleme
   @deprecated(
     "Use Http().newServerAt(...)...connectionSource() to create a source that 
can be materialized to a binding.",
     since = "Akka HTTP 10.2.0")
-  @nowarn("msg=deprecated")
   def bind(interface: String, port: Int = DefaultPortForProtocol,
       connectionContext: ConnectionContext = defaultServerHttpContext,
       settings: ServerSettings = ServerSettings(system),
@@ -239,7 +238,6 @@ class HttpExt @InternalStableApi /* constructor signature 
is hardcoded in Teleme
    * use the `pekko.http.server` config section or pass in a 
[[pekko.http.scaladsl.settings.ServerSettings]] explicitly.
    */
   @deprecated("Use Http().newServerAt(...)...bindFlow() to create server 
bindings.", since = "Akka HTTP 10.2.0")
-  @nowarn("msg=deprecated")
   def bindAndHandle(
       handler: Flow[HttpRequest, HttpResponse, Any],
       interface: String, port: Int = DefaultPortForProtocol,
@@ -321,7 +319,6 @@ class HttpExt @InternalStableApi /* constructor signature 
is hardcoded in Teleme
    * use the `pekko.http.server` config section or pass in a 
[[pekko.http.scaladsl.settings.ServerSettings]] explicitly.
    */
   @deprecated("Use Http().newServerAt(...)...bindSync() to create server 
bindings.", since = "Akka HTTP 10.2.0")
-  @nowarn("msg=deprecated")
   def bindAndHandleSync(
       handler: HttpRequest => HttpResponse,
       interface: String, port: Int = DefaultPortForProtocol,
@@ -350,7 +347,6 @@ class HttpExt @InternalStableApi /* constructor signature 
is hardcoded in Teleme
    * Any other value for `parallelism` overrides the setting.
    */
   @deprecated("Use Http().newServerAt(...)...bind() to create server 
bindings.", since = "Akka HTTP 10.2.0")
-  @nowarn("msg=deprecated")
   def bindAndHandleAsync(
       handler: HttpRequest => Future[HttpResponse],
       interface: String, port: Int = DefaultPortForProtocol,
@@ -845,6 +841,7 @@ class HttpExt @InternalStableApi /* constructor signature 
is hardcoded in Teleme
   private[http] def sslTlsServerStage(connectionContext: ConnectionContext) =
     sslTlsStage(connectionContext, Server, None)
 
+  @nowarn("msg=deprecated") // TODO find an alternative way to do this
   private def sslTlsStage(connectionContext: ConnectionContext, role: TLSRole, 
hostInfo: Option[(String, Int)]) =
     connectionContext match {
       case hctx: HttpsConnectionContext =>
diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/HttpEntity.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/HttpEntity.scala
index 8d9559836..c3f65c042 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/HttpEntity.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/HttpEntity.scala
@@ -13,18 +13,22 @@
 
 package org.apache.pekko.http.scaladsl.model
 
-import java.util.OptionalLong
-
-import language.implicitConversions
 import java.io.File
 import java.nio.file.{ Files, Path }
 import java.lang.{ Iterable => JIterable }
+import java.util.OptionalLong
+import java.util.concurrent.CompletionStage
 
-import scala.util.control.NonFatal
+import scala.language.implicitConversions
+import scala.annotation.nowarn
 import scala.concurrent.Future
 import scala.concurrent.duration._
 import scala.collection.immutable
+import scala.util.control.NonFatal
+
 import org.apache.pekko
+import pekko.actor.ClassicActorSystemProvider
+import pekko.annotation.{ DoNotInherit, InternalApi }
 import pekko.util.ByteString
 import pekko.stream.scaladsl._
 import pekko.stream.stage._
@@ -37,16 +41,10 @@ import pekko.http.impl.util.JavaMapping.Implicits._
 import pekko.util.FutureConverters._
 import pekko.util.OptionConverters._
 
-import java.util.concurrent.CompletionStage
-
-import pekko.actor.ClassicActorSystemProvider
-import pekko.annotation.{ DoNotInherit, InternalApi }
-
 /**
  * Models the entity (aka "body" or "content") of an HTTP message.
  */
 sealed trait HttpEntity extends jm.HttpEntity {
-  import language.implicitConversions
   private implicit def completionStageCovariant[T, U >: T](in: 
CompletionStage[T]): CompletionStage[U] =
     in.asInstanceOf[CompletionStage[U]]
 
@@ -662,6 +660,7 @@ object HttpEntity {
         private var maxBytes = -1L
         private var bytesLeft = Long.MaxValue
 
+        @nowarn("msg=deprecated") // Attributes.getFirst is deprecated, but we 
need to use it here
         override def preStart(): Unit = {
           _attributes.getFirst[SizeLimit] match {
             case Some(limit: SizeLimit) if limit.isDisabled =>
diff --git 
a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteAdapter.scala
 
b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteAdapter.scala
index 1f103f4c4..21f05d7fd 100644
--- 
a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteAdapter.scala
+++ 
b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteAdapter.scala
@@ -39,7 +39,6 @@ final class RouteAdapter(val delegate: 
pekko.http.scaladsl.server.Route) extends
     scalaFlow(system, materializer).asJava
 
   override def handler(system: ClassicActorSystemProvider): 
Function[HttpRequest, CompletionStage[HttpResponse]] = {
-    import pekko.http.impl.util.JavaMapping._
     import pekko.util.FutureConverters._
     val scalaFunction = scaladsl.server.Route.toFunction(delegate)(system)
     request => (scalaFunction(request.asScala): Future[HttpResponse]).asJava
diff --git 
a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
 
b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
index 38c86e703..b641ac364 100644
--- 
a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
+++ 
b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
@@ -329,7 +329,6 @@ abstract class RouteDirectives extends 
RespondWithDirectives {
    * Handle the request using a function.
    */
   def handleSync(handler: pekko.japi.function.Function[HttpRequest, 
HttpResponse]): Route = {
-    import pekko.http.impl.util.JavaMapping._
     RouteAdapter { ctx => 
FastFuture.successful(RouteResult.Complete(handler(ctx.request).asScala)) }
   }
 
diff --git a/project/Common.scala b/project/Common.scala
index 1c7035913..b76ba7a8f 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -29,10 +29,6 @@ object Common extends AutoPlugin {
       // Can be removed when we drop support for Scala 2.12:
       "-Wconf:msg=object JavaConverters in package collection is deprecated:s",
       "-Wconf:msg=is deprecated \\(since 2\\.13\\.:s",
-      // tolerate deprecations from Akka 2.6.0 until Pekko 1.1.x where we 
clean up
-      "-Wconf:cat=deprecation&msg=since Akka 2\\.6\\.:s",
-      // tolerate deprecations from Akka HTTP 10.2.0 until Pekko 1.1.x where 
we clean up
-      "-Wconf:cat=deprecation&msg=since Akka HTTP 10\\.2\\.:s",
       "-Wconf:msg=reached max recursion depth:s",
       "-release:8"),
     scalacOptions ++= onlyOnScala2(Seq(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to