This is an automated email from the ASF dual-hosted git repository.
pjfanning 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 cf0233879 Fail Scala 3.8+ builds on warnings again (#1333)
cf0233879 is described below
commit cf0233879578d5a471f6d74aec088ec2f9863dfd
Author: PJ Fanning <[email protected]>
AuthorDate: Wed Oct 7 13:55:19 2026 +0100
Fail Scala 3.8+ builds on warnings again (#1333)
Motivation:
The Scala 3.8+ lane added `-Wconf:any:s`, which silenced every warning and
made `-Werror` a no-op there. As a result `private[this]` (deprecated in
Scala 3) crept back into ByteStringOutputStream unnoticed.
Modification:
- Replace `-Wconf:any:s` with filters for the four migration warnings that
have no replacement also compiling on Scala 2.13 (`using` clauses, `xs*`
vararg splices, trailing `_` eta-expansion, `with` as a type operator).
- Replace `private[this]` with `private` in ByteStringOutputStream.
- Convert alphanumeric infix calls not declared `infix` to dot calls.
Result:
Other Scala 3.8+ warnings, such as `private[this]`, fail the build again.
Tests:
- sbt "++3.9.0!" Test/compile http-tests/MultiJvm/compile: success
- sbt "++2.13.18!" Test/compile http-tests/MultiJvm/compile: success
- Reintroducing `private[this]` fails `sbt "++3.9.0!" http-core/compile`
under -Werror
References:
None - follow-up to #1129
---
.../pekko/http/impl/engine/http2/Http2Blueprint.scala | 10 +++++-----
.../pekko/http/impl/util/ByteStringOutputStream.scala | 6 +++---
.../apache/pekko/http/impl/util/SocketOptionSettings.scala | 14 +++++++-------
.../http/impl/engine/client/NewConnectionPoolSpec.scala | 2 +-
.../pekko/http/PekkoHttpServerLatencyMultiNodeSpec.scala | 12 ++++++------
.../org/apache/pekko/remote/testkit/MultiNodeConfig.scala | 4 ++--
.../http/scaladsl/server/ModeledCustomHeaderSpec.scala | 2 +-
.../http/scaladsl/server/directives/RangeDirectives.scala | 2 +-
.../pekko/http/impl/engine/http2/WindowTracking.scala | 4 ++--
project/Common.scala | 8 +++++++-
10 files changed, 35 insertions(+), 29 deletions(-)
diff --git
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
index 676a131cf..fe4ac2ef3 100644
---
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
+++
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
@@ -135,17 +135,17 @@ private[http] object Http2Blueprint {
dateHeaderRendering: DateHeaderRendering): BidiFlow[HttpResponse,
ByteString, ByteString, HttpRequest, ServerTerminator] = {
val masterHttpHeaderParser = HttpHeaderParser(settings.parserSettings,
log) // FIXME: reuse for framing
- val initialFlow = telemetry.serverConnection atop
- httpLayer(settings, log, dateHeaderRendering) atopKeepRight
- serverDemux(settings.http2Settings, initialDemuxerSettings, upgraded)
atop
+ val initialFlow = (telemetry.serverConnection atop
+ httpLayer(settings, log, dateHeaderRendering))
+ .atopKeepRight(serverDemux(settings.http2Settings,
initialDemuxerSettings, upgraded)) atop
FrameLogger.logFramesIfEnabled(settings.http2Settings.logFrames) atop //
enable for debugging
hpackCoding(masterHttpHeaderParser, settings.parserSettings,
settings.http2Settings.maxHeaderListSize)
val frameTypesForThrottle =
getFrameTypesForThrottle(settings.http2Settings)
val flowWithPossibleThrottle = if (frameTypesForThrottle.nonEmpty) {
- initialFlow atop rapidResetMitigation(settings.http2Settings,
frameTypesForThrottle) atopKeepLeft framing(log,
- settings.http2Settings.maxFrameSize)
+ (initialFlow atop rapidResetMitigation(settings.http2Settings,
frameTypesForThrottle))
+ .atopKeepLeft(framing(log, settings.http2Settings.maxFrameSize))
} else initialFlow atop framing(log, settings.http2Settings.maxFrameSize)
flowWithPossibleThrottle atop
diff --git
a/http-core/src/main/scala/org/apache/pekko/http/impl/util/ByteStringOutputStream.scala
b/http-core/src/main/scala/org/apache/pekko/http/impl/util/ByteStringOutputStream.scala
index 5d2e77a6a..53bfd3e6c 100644
---
a/http-core/src/main/scala/org/apache/pekko/http/impl/util/ByteStringOutputStream.scala
+++
b/http-core/src/main/scala/org/apache/pekko/http/impl/util/ByteStringOutputStream.scala
@@ -44,10 +44,10 @@ import pekko.util.ByteString
private[http] final class ByteStringOutputStream(initialCapacity: Int) extends
OutputStream {
if (initialCapacity < 0) throw new IllegalArgumentException(s"Illegal
initial capacity: $initialCapacity")
- private[this] var buf: Array[Byte] = Array.emptyByteArray
- private[this] var count: Int = 0
+ private var buf: Array[Byte] = Array.emptyByteArray
+ private var count: Int = 0
// the size of the last block handed over; the array for the next block is
allocated to hold it
- private[this] var lastCount: Int = 0
+ private var lastCount: Int = 0
/** The number of bytes written since the last hand-over. */
def size: Int = count
diff --git
a/http-core/src/main/scala/org/apache/pekko/http/impl/util/SocketOptionSettings.scala
b/http-core/src/main/scala/org/apache/pekko/http/impl/util/SocketOptionSettings.scala
index b5a22b6a8..983477829 100644
---
a/http-core/src/main/scala/org/apache/pekko/http/impl/util/SocketOptionSettings.scala
+++
b/http-core/src/main/scala/org/apache/pekko/http/impl/util/SocketOptionSettings.scala
@@ -27,12 +27,12 @@ private[http] object SocketOptionSettings {
case x => cons(f(c, setting)) :: Nil
}
- so("so-receive-buffer-size")(_ getIntBytes
_)(Inet.SO.ReceiveBufferSize.apply) :::
- so("so-send-buffer-size")(_ getIntBytes _)(Inet.SO.SendBufferSize.apply)
:::
- so("so-reuse-address")(_ getBoolean _)(Inet.SO.ReuseAddress.apply) :::
- so("so-traffic-class")(_ getInt _)(Inet.SO.TrafficClass.apply) :::
- so("tcp-keep-alive")(_ getBoolean _)(Tcp.SO.KeepAlive.apply) :::
- so("tcp-oob-inline")(_ getBoolean _)(Tcp.SO.OOBInline.apply) :::
- so("tcp-no-delay")(_ getBoolean _)(Tcp.SO.TcpNoDelay.apply)
+
so("so-receive-buffer-size")(_.getIntBytes(_))(Inet.SO.ReceiveBufferSize.apply)
:::
+ so("so-send-buffer-size")(_.getIntBytes(_))(Inet.SO.SendBufferSize.apply)
:::
+ so("so-reuse-address")(_.getBoolean(_))(Inet.SO.ReuseAddress.apply) :::
+ so("so-traffic-class")(_.getInt(_))(Inet.SO.TrafficClass.apply) :::
+ so("tcp-keep-alive")(_.getBoolean(_))(Tcp.SO.KeepAlive.apply) :::
+ so("tcp-oob-inline")(_.getBoolean(_))(Tcp.SO.OOBInline.apply) :::
+ so("tcp-no-delay")(_.getBoolean(_))(Tcp.SO.TcpNoDelay.apply)
}
}
diff --git
a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
index 4945b9b67..bc23fc350 100644
---
a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
+++
b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
@@ -254,7 +254,7 @@ class NewConnectionPoolSpec extends
PekkoSpecWithMaterializer("""
override def asyncTestServerHandler(connNr: Int): HttpRequest =>
Future[HttpResponse] = { req =>
req.discardEntityBytes()
- if (req.uri.path.toString contains "a")
+ if (req.uri.path.toString.contains("a"))
Future.successful(HttpResponse(200,
entity =
HttpEntity.CloseDelimited(ContentTypes.`application/octet-stream`,
crashingEntity)))
else {
diff --git
a/http-tests/src/multi-jvm/scala/org/apache/pekko/http/PekkoHttpServerLatencyMultiNodeSpec.scala
b/http-tests/src/multi-jvm/scala/org/apache/pekko/http/PekkoHttpServerLatencyMultiNodeSpec.scala
index 552713ef8..3b212da82 100644
---
a/http-tests/src/multi-jvm/scala/org/apache/pekko/http/PekkoHttpServerLatencyMultiNodeSpec.scala
+++
b/http-tests/src/multi-jvm/scala/org/apache/pekko/http/PekkoHttpServerLatencyMultiNodeSpec.scala
@@ -261,7 +261,7 @@ class PekkoHttpServerLatencyMultiNodeSpec extends
MultiNodeSpec(PekkoHttpServerL
val res = (loadGeneratorActor ?
LoadGenCommand(cmd)).mapTo[LoadGenResults]
val results = Await.result(res, timeout.duration)
- if (id contains "warmup") ()
+ if (id.contains("warmup")) ()
else if (cmd.startsWith("wrk")) printWrkPercentiles(id, results.lines)
else if (cmd.startsWith("ab")) printAbPercentiles(id, results.lines)
else throw new NotImplementedError(s"Unable to handle [$cmd] results!")
@@ -301,7 +301,7 @@ class PekkoHttpServerLatencyMultiNodeSpec extends
MultiNodeSpec(PekkoHttpServerL
var i = 0
val linesWithIndex = lines.zipWithIndex
- val correctedDistributionStartsHere = linesWithIndex.find(p => p._1
contains "Latency Distribution").map(_._2).get
+ val correctedDistributionStartsHere = linesWithIndex.find(p =>
p._1.contains("Latency Distribution")).map(_._2).get
var titles = List.empty[String]
var metrics = List.empty[String]
@@ -321,7 +321,7 @@ class PekkoHttpServerLatencyMultiNodeSpec extends
MultiNodeSpec(PekkoHttpServerL
}
renderResults(prefix + "_corrected", titles, metrics)
- val uncorrectedDistributionStartsHere = linesWithIndex.find(p => p._1
contains "Uncorrected Latency").map(_._2).get
+ val uncorrectedDistributionStartsHere = linesWithIndex.find(p =>
p._1.contains("Uncorrected Latency")).map(_._2).get
titles = List.empty
metrics = List.empty
@@ -343,7 +343,7 @@ class PekkoHttpServerLatencyMultiNodeSpec extends
MultiNodeSpec(PekkoHttpServerL
titles = List.empty
metrics = List.empty
- val rpsLineNumber = linesWithIndex.find(p => p._1 contains
"Requests/sec:").map(_._2).get
+ val rpsLineNumber = linesWithIndex.find(p =>
p._1.contains("Requests/sec:")).map(_._2).get
i = rpsLineNumber
val rps = lines(i).replace("Requests/sec:", "").trim
@@ -359,7 +359,7 @@ class PekkoHttpServerLatencyMultiNodeSpec extends
MultiNodeSpec(PekkoHttpServerL
titles = List.empty
metrics = List.empty
- val transferLineNumber = linesWithIndex.find(p => p._1 contains
"Transfer/sec:").map(_._2).get
+ val transferLineNumber = linesWithIndex.find(p =>
p._1.contains("Transfer/sec:")).map(_._2).get
i = transferLineNumber
val tps = lines(i).replace("Transfer/sec:", "").trim
@@ -376,7 +376,7 @@ class PekkoHttpServerLatencyMultiNodeSpec extends
MultiNodeSpec(PekkoHttpServerL
var i = 0
val correctedDistributionStartsHere =
- lines.zipWithIndex.find(p => p._1 contains "Percentage of the
requests").map(_._2).get
+ lines.zipWithIndex.find(p => p._1.contains("Percentage of the
requests")).map(_._2).get
var titles = List.empty[String]
var metrics = List.empty[String]
diff --git
a/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
b/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
index 1a024db9a..350403e2a 100644
---
a/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
+++
b/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
@@ -50,7 +50,7 @@ abstract class MultiNodeConfig {
* Register a config override for a specific participant.
*/
def nodeConfig(roles: RoleName*)(configs: Config*): Unit = {
- val c = configs.reduceLeft(_ withFallback _)
+ val c = configs.reduceLeft(_.withFallback(_))
_nodeConf ++= roles.map { _ -> c }
}
@@ -120,7 +120,7 @@ abstract class MultiNodeConfig {
val configs = _nodeConf.get(
myself).toList ::: _commonConf.toList ::: transportConfig ::
MultiNodeSpec.nodeConfig ::
MultiNodeSpec.baseConfig :: Nil
- configs.reduceLeft(_ withFallback _)
+ configs.reduceLeft(_.withFallback(_))
}
private[testkit] def deployments(node: RoleName): Seq[String] =
diff --git
a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/ModeledCustomHeaderSpec.scala
b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/ModeledCustomHeaderSpec.scala
index 7a9f1eda1..a067daca9 100644
---
a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/ModeledCustomHeaderSpec.scala
+++
b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/ModeledCustomHeaderSpec.scala
@@ -43,7 +43,7 @@ object ModeledCustomHeaderSpec {
object DifferentHeader extends ModeledCustomHeaderCompanion[DifferentHeader]
{
override val name = "different"
override def parse(value: String) =
- if (value contains " ") Failure(new Exception("Contains illegal
whitespace!"))
+ if (value.contains(" ")) Failure(new Exception("Contains illegal
whitespace!"))
else Success(new DifferentHeader(value))
}
diff --git
a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/RangeDirectives.scala
b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/RangeDirectives.scala
index b6dd534c7..addf9b7b9 100644
---
a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/RangeDirectives.scala
+++
b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/RangeDirectives.scala
@@ -77,7 +77,7 @@ trait RangeDirectives {
def coalesceRanges(iRanges: Seq[IndexRange]): Seq[IndexRange] =
iRanges.foldLeft(Seq.empty[IndexRange]) { (acc, iRange) =>
val (mergeCandidates, otherCandidates) =
acc.partition(_.distance(iRange) <= rangeCoalescingThreshold)
- val merged = mergeCandidates.foldLeft(iRange)(_ mergeWith _)
+ val merged = mergeCandidates.foldLeft(iRange)(_.mergeWith(_))
otherCandidates :+ merged
}
diff --git
a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/WindowTracking.scala
b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/WindowTracking.scala
index de65ca233..1242437d4 100644
---
a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/WindowTracking.scala
+++
b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/WindowTracking.scala
@@ -54,9 +54,9 @@ trait WindowTracking extends Http2FrameProbeDelegator with
Http2FrameSending {
pollForWindowUpdates(duration)
} catch {
- case e: AssertionError if e.getMessage contains "but only got [0] bytes"
=>
+ case e: AssertionError if e.getMessage.contains("but only got [0]
bytes") =>
// timeout, that's expected
- case e: AssertionError if (e.getMessage contains "block took") &&
(e.getMessage contains "exceeding") =>
+ case e: AssertionError if (e.getMessage.contains("block took")) &&
(e.getMessage.contains("exceeding")) =>
// pause like GC, poll again just to be sure
pollForWindowUpdates(duration)
}
diff --git a/project/Common.scala b/project/Common.scala
index 9f851d729..abb0a4be9 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -63,7 +63,13 @@ object Common extends AutoPlugin {
"-Wconf:msg=pattern binding uses refutable extractor:s",
"-Wconf:msg=is more specialized than the right hand side:s",
"-Wconf:cat=deprecation:s")).value,
- scalacOptions ++= onlyOnScala38OrLater(Seq("-Wconf:any:s")).value,
+ // Scala 3.8+ migration warnings for syntax that has no replacement which
also compiles on Scala 2.13.
+ // Silence only these, so that other warnings (e.g. `private[this]`) still
fail the build.
+ scalacOptions ++= onlyOnScala38OrLater(Seq(
+ "-Wconf:msg=Implicit parameters should be provided with a `using`
clause:s",
+ "-Wconf:msg=is no longer supported for vararg splices:s",
+ "-Wconf:msg=for eta-expansion is unnecessary:s",
+ "-Wconf:msg=with as a type operator has been deprecated:s")).value,
scalacOptions ++= onlyOnScala33(Seq("-Yfuture-lazy-vals")).value,
javacOptions ++=
Seq("-encoding", "UTF-8", "--release", javacTarget),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]