Skip to content

Commit

Permalink
chore: bump to akka 2.10.0-M1, align with changes from upstream (#4424)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-alfers authored Sep 23, 2024
1 parent 9b1221f commit 3d68f53
Show file tree
Hide file tree
Showing 62 changed files with 117 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ updates.pin = [
# Align with Scalatest dependency from Akka TestKit does
{ groupId = "org.scalatest", artifactId = "scalatest", version = "3.2." },
# align with Akka jackson version
{ groupId = "com.fasterxml.jackson.core", version = "2.15." },
{ groupId = "com.fasterxml.jackson.dataformat", version = "2.15." },
{ groupId = "com.fasterxml.jackson.core", version = "2.17." },
{ groupId = "com.fasterxml.jackson.dataformat", version = "2.17." },
# https://github.com/akka/akka-http/pull/3996#issuecomment-1009953070
{ groupId = "org.specs2", artifactId = "specs2-core", version = "4.10." },
# https://github.com/akka/akka-http/pull/4080#issuecomment-1074853622
Expand Down
2 changes: 1 addition & 1 deletion akka-http-bench-jmh/src/main/scala/akka/BenchRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.openjdk.jmh.runner.options.CommandLineOptions
object BenchRunner {

def main(args: Array[String]): Unit = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

// @formatter:off
val args2 = args.toList.flatMap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import java.util.function.BiFunction
import akka.actor.ActorSystem
import akka.annotation.{ ApiMayChange, InternalApi }

import scala.collection.JavaConverters._
import scala.concurrent.duration.Duration
import scala.concurrent.{ ExecutionContext, Future }
import scala.jdk.CollectionConverters._
import com.github.benmanes.caffeine.cache.{ AsyncCache, Caffeine }
import akka.http.caching.LfuCache.toJavaMappingFunction
import akka.http.caching.scaladsl.Cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import java.util.concurrent.{ CompletableFuture, CompletionStage }
import akka.annotation.{ ApiMayChange, DoNotInherit }
import akka.japi.{ Creator, Procedure }

import scala.collection.JavaConverters._
import scala.collection.immutable
import scala.concurrent.{ ExecutionContext, Future, Promise }
import scala.jdk.CollectionConverters._
import scala.jdk.FutureConverters._

/**
Expand Down
2 changes: 1 addition & 1 deletion akka-http-core/src/main/java/akka/http/impl/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static <T> scala.Option<T> scalaNone() {

@SuppressWarnings("unchecked")
public static <T, U extends T> Seq<U> convertIterable(Iterable<T> els) {
return scala.collection.JavaConverters.iterableAsScalaIterableConverter((Iterable<U>)els).asScala().toVector();
return scala.jdk.javaapi.CollectionConverters.asScala((Iterable<U>)els).toVector();
}
public static <T, U extends T> Seq<U> convertArray(T[] els) {
return Util.<T, U>convertIterable(Arrays.asList(els));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ private static scala.collection.immutable.Map<String, HttpEntity.Strict> toScala
}

private static scala.collection.Iterable<HttpHeader> toScalaSeq(java.util.List<HttpHeader> _headers) {
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(_headers).asScala();
return scala.jdk.javaapi.CollectionConverters.asScala(_headers);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package akka.http.ccompat

object MapHelpers {
def convertMapToScala[K, V](jmap: java.util.Map[K, V]): scala.collection.immutable.Map[K, V] = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
Map.empty.concat(jmap.asScala)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package akka.http.ccompat
*/
object MapHelpers {
def convertMapToScala[K, V](jmap: java.util.Map[K, V]): scala.collection.immutable.Map[K, V] = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
Map.empty ++ jmap.asScala
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import akka.stream.stage.{ GraphStage, GraphStageLogic, InHandler, OutHandler }
import akka.util.OptionVal

import scala.concurrent.ExecutionContext
import scala.collection.JavaConverters._
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.jdk.CollectionConverters._
import scala.util.control.{ NoStackTrace, NonFatal }
import scala.util.{ Failure, Random, Success, Try }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import akka.http.scaladsl.{ model => sm }
import akka.japi.Pair
import akka.parboiled2.CharPredicate

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import akka.http.impl.util.JavaMapping.Implicits._

/** INTERNAL API */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import akka.http.scaladsl.settings.ParserSettings.{ ConflictingContentTypeHeader
import akka.util.ConstantFun
import com.typesafe.config.Config

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import akka.http.scaladsl.model._
import akka.http.impl.util._
import akka.http.scaladsl.settings.ParserSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private[http] object JavaMapping {
}
implicit def map[K, V]: JavaMapping[ju.Map[K, V], immutable.Map[K, V]] =
new JavaMapping[ju.Map[K, V], immutable.Map[K, V]] {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
def toScala(javaObject: ju.Map[K, V]): immutable.Map[K, V] = javaObject.asScala.toMap
def toJava(scalaObject: immutable.Map[K, V]): ju.Map[K, V] = scalaObject.asJava
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import java.net.{ InetAddress, InetSocketAddress }
import com.typesafe.config.{ Config, ConfigFactory }
import com.typesafe.config.ConfigFactory._

import scala.util.control.NonFatal
import scala.collection.immutable.ListMap
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.util.control.NonFatal
import akka.actor.{ ActorRefFactory, ActorSystem }
import akka.annotation.InternalApi

Expand Down
2 changes: 1 addition & 1 deletion akka-http-core/src/main/scala/akka/http/javadsl/Http.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object Http extends ExtensionId[Http] with ExtensionIdProvider {
}

class Http(system: ExtendedActorSystem) extends akka.actor.Extension {
import akka.dispatch.ExecutionContexts.{ parasitic => ec }
import scala.concurrent.ExecutionContext.{ parasitic => ec }

import language.implicitConversions
private implicit def completionStageCovariant[T, U >: T](in: CompletionStage[T]): CompletionStage[U] = in.asInstanceOf[CompletionStage[U]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import akka.io.Inet.SocketOption
import com.typesafe.config.Config
import akka.http.impl.util.JavaMapping.Implicits._

import scala.collection.JavaConverters._
import scala.concurrent.duration.{ Duration, FiniteDuration }
import scala.jdk.CollectionConverters._
import scala.jdk.OptionConverters._

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class ConnectionPoolSettings private[akka] () { self: ConnectionPoolSet

@ApiMayChange
def withHostOverrides(hostOverrides: java.util.List[(String, ConnectionPoolSettings)]): ConnectionPoolSettings = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
self.copy(hostOverrides = hostOverrides.asScala.toList.map { case (h, s) => ConnectionPoolSettingsImpl.hostRegex(h) -> s.asScala })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import akka.annotation.DoNotInherit
import akka.http.impl.util.JavaMapping.Implicits._

import scala.annotation.varargs
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import akka.http.javadsl.model.{ HttpMethod, MediaType, StatusCode, Uri }
import scala.annotation.nowarn
import com.typesafe.config.Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import akka.io.Inet.SocketOption
import akka.http.impl.util.JavaMapping.Implicits._
import com.typesafe.config.Config

import scala.collection.JavaConverters._
import scala.concurrent.duration.{ Duration, FiniteDuration }
import scala.jdk.CollectionConverters._
import scala.jdk.OptionConverters._

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@

package akka.http.scaladsl

import java.util.{ Optional, Collection => JCollection }

import akka.annotation.{ ApiMayChange, InternalApi }
import akka.stream.TLSClientAuth
import akka.stream.TLSProtocol._
import javax.net.ssl._

import scala.collection.JavaConverters._
import scala.collection.immutable
import scala.jdk.OptionConverters._

trait ConnectionContext extends akka.http.javadsl.ConnectionContext {
/** INTERNAL API */
@InternalApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.util.concurrent.CompletionStage
import scala.concurrent.duration.FiniteDuration
import scala.concurrent.Future
import scala.collection.immutable
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.jdk.FutureConverters._
import scala.util.{ Failure, Success, Try }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ trait UpgradeToWebSocket extends jm.ws.UpgradeToWebSocket with WebSocketUpgrade
subprotocol: Option[String] = None): HttpResponse =
handleMessages(scaladsl.Flow.fromSinkAndSource(inSink, outSource), subprotocol)

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

/**
* Java API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ trait WebSocketUpgrade extends jm.ws.WebSocketUpgrade {
subprotocol: Option[String] = None): HttpResponse =
handleMessages(scaladsl.Flow.fromSinkAndSource(inSink, outSource), subprotocol)

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

/**
* Java API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ abstract class ConnectionPoolSettings extends js.ConnectionPoolSettings { self:
object ConnectionPoolSettings extends SettingsCompanion[ConnectionPoolSettings] {

override def apply(config: Config): ConnectionPoolSettingsImpl = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

val hostOverrides = config.getConfigList("akka.http.host-connection-pool.per-host-override").asScala.toList.map { cfg =>
ConnectionPoolSettingsImpl.hostRegex(cfg.getString("host-pattern")) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import akka.http.scaladsl.model._
import akka.http.scaladsl.{ settings => js }
import com.typesafe.config.Config

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.jdk.OptionConverters._

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import akka.http.scaladsl.model.headers.{ Host, Server }
import akka.io.Inet.SocketOption
import com.typesafe.config.Config

import scala.collection.JavaConverters._
import scala.collection.immutable
import scala.concurrent.duration.{ Duration, FiniteDuration }
import scala.jdk.CollectionConverters._
import scala.jdk.OptionConverters._
import scala.language.implicitConversions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import java.util.Optional

import akka.japi.Pair

import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.jdk.CollectionConverters._
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.must.Matchers

Expand Down
2 changes: 1 addition & 1 deletion akka-http-core/src/test/scala/akka/testkit/AkkaSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object AkkaSpec {
""")

def mapToConfig(map: Map[String, Any]): Config = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
ConfigFactory.parseMap(map.asJava)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import akka.http.javadsl.server.{ Rejection, RoutingJavaMapping }
import RoutingJavaMapping._
import akka.http.javadsl.model._

import scala.collection.JavaConverters._
import scala.annotation.varargs
import scala.jdk.CollectionConverters._

/**
* A wrapper for route results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import akka.stream.javadsl.Flow
import akka.http.scaladsl.{ testkit => st }

import akka.http.impl.util.JavaMapping.Implicits._
import scala.collection.JavaConverters._
import akka.stream.{ Materializer, scaladsl }

import scala.jdk.CollectionConverters._

trait WSTestRequestBuilding {

def WS[T](uri: Uri, clientSideHandler: Flow[Message, Message, T], materializer: Materializer): HttpRequest = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ object MultiNodeSpec {
""")

private def mapToConfig(map: Map[String, Any]): Config = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
ConfigFactory.parseMap(map.asJava)
}

Expand Down Expand Up @@ -430,7 +430,7 @@ abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, _roles:
base.replace(tag, replaceWith)
}
}
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
ConfigFactory.parseString(deployString).root.asScala foreach {
case (key, value: ConfigObject) => deployer.parseConfig(key, value.toConfig) foreach deployer.deploy
case (key, x) => throw new IllegalArgumentException(s"key $key must map to deployment section, not simple value $x")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package akka.http.scaladsl.server

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

class RejectionSpec extends RoutingSpec {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ import akka.http.scaladsl.settings.ServerSentEventSettings
import akka.stream.scaladsl.{ Sink, Source }

import java.util.{ List => JList }
import scala.collection.JavaConverters
import scala.collection.immutable.Seq
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AsyncWordSpec

import scala.jdk.CollectionConverters._

object EventStreamUnmarshallingSpec {

val events: Seq[ServerSentEvent] =
1.to(666).map(n => ServerSentEvent(n.toString))

// Also used by EventStreamUnmarshallingTest.java
val eventsAsJava: JList[javadsl.model.sse.ServerSentEvent] = {
import JavaConverters._
events.map(_.asInstanceOf[javadsl.model.sse.ServerSentEvent]).asJava
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import akka.http.scaladsl.server.{ PathMatcher => SPathMatcher }
import akka.http.scaladsl.server.{ PathMatchers => SPathMatchers }
import java.util.{ List => JList }
import java.util.function.{ Function => JFunction }
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

object JavaPathMatchers {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import java.security.SecureRandom
import java.time.Duration
import java.util.Optional
import javax.net.ssl.SSLEngine
import scala.jdk.DurationConverters._
import scala.jdk.CollectionConverters._
import scala.jdk.DurationConverters._
import scala.jdk.OptionConverters.RichOptional

object SSLContextFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.regex.Pattern

import akka.http.scaladsl.model.Uri.Path

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

import akka.http.scaladsl.server.{ PathMatcher => SPathMatcher }
import akka.http.scaladsl.server.{ PathMatchers => SPathMatchers }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import java.util.function

import akka.http.javadsl.model.HttpResponse

import scala.jdk.CollectionConverters._
import scala.reflect.ClassTag
import scala.collection.JavaConverters._

object RejectionHandler {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.function.{ Function => JFunction }
import java.util.{ List => JList }

import scala.collection.immutable
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.jdk.OptionConverters._

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package directives

import java.util.function.Supplier

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import akka.http.impl.util.JavaMapping.Implicits._
import akka.http.javadsl.coding.Coder
import akka.http.javadsl.model.headers.HttpEncoding
Expand Down
Loading

0 comments on commit 3d68f53

Please sign in to comment.