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 fc6e8a2da..ca235a60c 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 @@ -646,7 +646,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 + @nowarn("msg=getFirst in class Attributes is deprecated") // there's no valid alternative right now override def preStart(): Unit = { _attributes.getFirst[SizeLimit] match { case Some(limit: SizeLimit) if limit.isDisabled => diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WSClientAutobahnTest.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WSClientAutobahnTest.scala index 24dc9f08e..f69f7d202 100644 --- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WSClientAutobahnTest.scala +++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WSClientAutobahnTest.scala @@ -48,7 +48,7 @@ object WSClientAutobahnTest extends App { s"ws://localhost:9001/updateReports?agent=$agent" def runCase(caseIndex: Int, agent: String = Agent): Future[CaseStatus] = - runWs(runCaseUri(caseIndex, agent), echo).recover { case _ => () }.flatMap { _ => + runWs(runCaseUri(caseIndex, agent), echo).recover { case _ => (): Any }.flatMap { _ => getCaseStatus(caseIndex, agent) } diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/model/parser/HttpHeaderSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/model/parser/HttpHeaderSpec.scala index 644d0f075..40bcb301a 100644 --- a/http-core/src/test/scala/org/apache/pekko/http/impl/model/parser/HttpHeaderSpec.scala +++ b/http-core/src/test/scala/org/apache/pekko/http/impl/model/parser/HttpHeaderSpec.scala @@ -20,7 +20,6 @@ import scala.collection.immutable.Seq import org.apache.pekko import pekko.http.scaladsl.settings.ParserSettings.CookieParsingMode import pekko.http.impl.model.parser.HeaderParser.Settings -import org.scalatest.matchers.{ MatchResult, Matcher } import pekko.http.impl.util._ import pekko.http.scaladsl.model.{ HttpHeader, _ } import pekko.http.scaladsl.model.MediaRanges._ @@ -59,7 +58,8 @@ class HttpHeaderSpec extends AnyFreeSpec with Matchers { MediaRange.custom("text", Map("foo" -> "bar")), MediaType.customBinary("custom", "custom", MediaType.Compressible, params = Map("bar" -> "b>az"))) "Accept: application/*+xml; version=2" =!= - Accept(MediaType.customBinary("application", "*+xml", MediaType.Compressible, params = Map("version" -> "2"))) + Accept(MediaType.customBinary("application", "*+xml", MediaType.Compressible, + params = Map("version" -> "2")): MediaRange) } "Accept-Charset" in { diff --git a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/settings/ConnectionPoolSettingsSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/settings/ConnectionPoolSettingsSpec.scala index 5ae2fa707..f82a0cb75 100644 --- a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/settings/ConnectionPoolSettingsSpec.scala +++ b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/settings/ConnectionPoolSettingsSpec.scala @@ -13,9 +13,6 @@ package org.apache.pekko.http.scaladsl.settings -import scala.util.Failure -import scala.util.Success -import scala.util.Try import org.apache.pekko import pekko.testkit.PekkoSpec import pekko.http.scaladsl.model.headers.`User-Agent` @@ -161,11 +158,6 @@ class ConnectionPoolSettingsSpec extends PekkoSpec { settings.forHost("akka.com").minConnections shouldEqual 2 settings.minConnections shouldEqual 2 } - - def expectError(configString: String): String = Try(config(configString)) match { - case Failure(cause) => cause.getMessage - case Success(_) => fail("Expected a failure when max-open-requests is not a power of 2") - } } def config(configString: String): ConnectionPoolSettings = diff --git a/project/Common.scala b/project/Common.scala index ce7270438..5981c43c4 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -35,6 +35,9 @@ object Common extends AutoPlugin { // verbosely. So, opt out of those in general. "-Wconf:cat=other-match-analysis&msg=match may not be exhaustive:s")).value, scalacOptions ++= onlyOnScala3(Seq("-Wconf:cat=deprecation:s")).value, + Test / scalacOptions ++= Seq( + // we sometimes use pattern definitions in tests just for the side-effects and don't care about the extra member + "-Wconf:msg=Pattern definition introduces Unit-valued member:s"), javacOptions ++= Seq("-encoding", "UTF-8", "--release", javacTarget), mimaReportSignatureProblems := true,