Skip to content

Commit 6277aa4

Browse files
authored
feat: Scala 3 support
2 parents 576ce76 + a1bdc3e commit 6277aa4

File tree

231 files changed

+4792
-3395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+4792
-3395
lines changed

.github/workflows/validate-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
SCALA_VERSION: [2.12, 2.13]
56+
SCALA_VERSION: [2.12, 2.13, 3.1]
5757
JABBA_JDK: [1.8, 1.11]
5858
steps:
5959
- name: Checkout

akka-http-bench-jmh/src/main/scala/akka/BenchRunner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object BenchRunner {
2525
val opts = new CommandLineOptions(args2: _*)
2626
val results = new Runner(opts).run()
2727

28-
val report = results.asScala.map { result: RunResult =>
28+
val report = results.asScala.map { (result: RunResult) =>
2929
val bench = result.getParams.getBenchmark
3030
val params = result.getParams.getParamsKeys.asScala.map(key => s"$key=${result.getParams.getParam(key)}").mkString("_")
3131
val score = result.getAggregatedResult.getPrimaryResult.getScore.round

akka-http-caching/src/main/scala/akka/http/caching/scaladsl/LfuCacheSettings.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ abstract class LfuCacheSettings private[http] () extends javadsl.LfuCacheSetting
2222
def timeToLive: Duration
2323
def timeToIdle: Duration
2424

25-
final def getMaxCapacity: Int = maxCapacity
26-
final def getInitialCapacity: Int = initialCapacity
27-
final def getTimeToLive: Duration = timeToLive
28-
final def getTimeToIdle: Duration = timeToIdle
25+
final def getMaxCapacity: Int = self.maxCapacity
26+
final def getInitialCapacity: Int = self.initialCapacity
27+
final def getTimeToLive: Duration = self.timeToLive
28+
final def getTimeToIdle: Duration = self.timeToIdle
2929

3030
override def withMaxCapacity(newMaxCapacity: Int): LfuCacheSettings = self.copy(maxCapacity = newMaxCapacity)
3131
override def withInitialCapacity(newInitialCapacity: Int): LfuCacheSettings = self.copy(initialCapacity = newInitialCapacity)

akka-http-caching/src/main/scala/akka/http/javadsl/server/directives/CachingDirectives.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object CachingDirectives {
1717

1818
import akka.http.scaladsl.server.directives.{ CachingDirectives => D }
1919

20-
private implicit def routeResultCacheMapping[K] =
20+
private implicit def routeResultCacheMapping[K]: JavaMapping[Cache[K, RouteResult], akka.http.caching.scaladsl.Cache[K, akka.http.scaladsl.server.RouteResult]] =
2121
CacheJavaMapping.cacheMapping[K, RouteResult, K, akka.http.scaladsl.server.RouteResult]
2222

2323
/**

akka-http-caching/src/test/scala/akka/http/caching/ExpiringLfuCacheSpec.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ class ExpiringLfuCacheSpec extends AnyWordSpec with Matchers with BeforeAndAfter
4848
"return Futures on uncached values during evaluation and replace these with the value afterwards" in {
4949
val cache = lfuCache[String]()
5050
val latch = new CountDownLatch(1)
51-
val future1 = cache(1, (promise: Promise[String]) =>
51+
val future1 = cache(1, { (promise: Promise[String]) =>
5252
Future {
5353
latch.await()
5454
promise.success("A")
5555
}
56-
)
56+
// (block autoformat)
57+
() // provide Unit result automatically to hand-hold Scala 3 overload selection
58+
})
5759
val future2 = cache.get(1, () => "")
5860

5961
latch.countDown()
@@ -150,7 +152,7 @@ class ExpiringLfuCacheSpec extends AnyWordSpec with Matchers with BeforeAndAfter
150152
}
151153
}, 10.second)
152154

153-
views.transpose.foreach { ints: Seq[Int] =>
155+
views.transpose.foreach { (ints: Seq[Int]) =>
154156
ints.filter(_ != 0).reduceLeft((a, b) => if (a == b) a else 0) should not be 0
155157
}
156158
}

akka-http-core/src/main/java/akka/http/javadsl/model/Query.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import akka.http.impl.model.JavaQuery;
88
import akka.http.impl.model.UriJavaAccessor;
99
import akka.http.scaladsl.model.*;
10+
import akka.http.javadsl.model.HttpCharset;
1011
import akka.japi.Pair;
1112
import akka.parboiled2.CharPredicate;
1213
import akka.parboiled2.ParserInput$;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Changes to internal signatures
2+
ProblemFilters.exclude[Problem]("akka.http.impl.engine.http2.*")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# MiMa doesn't get that scala.Serializable is alias for java.io.Serializable
2+
ProblemFilters.exclude[MissingTypesProblem]("akka.http.scaladsl.model.ErrorInfo")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# internal, changed earlier, not sure why not picked up from 10.1.x excludes for Scala 2.12
2+
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.impl.util.StreamUtils#ScheduleSupport.akka$http$impl$util$StreamUtils$ScheduleSupport$$super$materializer")

akka-http-core/src/main/scala/akka/http/impl/engine/client/OutgoingConnectionBlueprint.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private[http] object OutgoingConnectionBlueprint {
9797
val terminationFanout = b.add(Broadcast[HttpResponse](2))
9898

9999
val logger = b.add(Flow[ByteString].mapError { case t => log.debug(s"Outgoing request stream error {}", t); t }.named("errorLogger"))
100-
val wrapTls = b.add(Flow[ByteString].map(SendBytes))
100+
val wrapTls = b.add(Flow[ByteString].map(SendBytes(_)))
101101

102102
val collectSessionBytes = b.add(Flow[SslTlsInbound].collect { case s: SessionBytes => s })
103103

0 commit comments

Comments
 (0)