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 e460e84b6 initial changes to drop Scala 2.12 support (#770)
e460e84b6 is described below

commit e460e84b64de75a3a8352ae2527e61d873ee99a9
Author: PJ Fanning <[email protected]>
AuthorDate: Sat Sep 13 23:32:45 2025 +0100

    initial changes to drop Scala 2.12 support (#770)
    
    * initial changes to drop Scala 2.12 support
    
    * remove imm code
    
    * Create remove-scala2.12-compat.excludes
---
 .github/workflows/nightly.yml                      |   2 +-
 .github/workflows/validate-and-test.yml            |   2 +-
 LICENSE                                            |   9 --
 NOTICE                                             |  19 ---
 build.sbt                                          |  40 +-----
 .../remove-scala2.12-compat.excludes               |  20 +++
 .../apache/pekko/http/ccompat/imm/package.scala    |  21 ----
 .../org/apache/pekko/http/ccompat/CompatImpl.scala |  43 -------
 .../org/apache/pekko/http/ccompat/MapHelpers.scala |  24 ----
 .../apache/pekko/http/ccompat/imm/package.scala    |  30 -----
 .../org/apache/pekko/http/ccompat/package.scala    |  74 -----------
 .../pekko/http/scaladsl/util/FastFuture.scala      | 139 ---------------------
 .../org/apache/pekko/http/ccompat/MapHelpers.scala |   0
 .../org/apache/pekko/http/ccompat/package.scala    |   0
 .../http/impl/engine/http2/PriorityTree.scala      |   1 -
 .../pekko/http/scaladsl/util/FastFuture.scala      |   0
 .../http/HttpModelIntegrationSpec.scala            |   1 -
 http-scalafix/README.md                            |   3 -
 .../pekko/http/scaladsl/server/util/package.scala  |  18 ---
 .../apache/pekko/http/ccompat/ImplicitUtils.scala  |  16 ---
 .../DiscardEntityDefaultExceptionHandlerSpec.scala |   1 -
 .../scaladsl/server/util/VarArgsFunction1.scala    |   0
 project/Common.scala                               |   3 -
 project/Dependencies.scala                         |   3 +-
 24 files changed, 25 insertions(+), 444 deletions(-)

diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 55c94aa06..6d67bf18e 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -21,7 +21,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        SCALA_VERSION: [2.12, 2.13, 3]
+        SCALA_VERSION: [2.13, 3]
         JDK: [17, 21]
         PEKKO_VERSION: ['default']
     steps:
diff --git a/.github/workflows/validate-and-test.yml 
b/.github/workflows/validate-and-test.yml
index 05b1fe2bf..9ffb326f0 100644
--- a/.github/workflows/validate-and-test.yml
+++ b/.github/workflows/validate-and-test.yml
@@ -70,7 +70,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        SCALA_VERSION: [2.12, 2.13, 3.3]
+        SCALA_VERSION: [2.13, 3.3]
         JDK: [17]
     steps:
       - name: Checkout
diff --git a/LICENSE b/LICENSE
index 5782dafd8..fa656a754 100644
--- a/LICENSE
+++ b/LICENSE
@@ -210,15 +210,6 @@ Copyright 2014 Twitter, Inc.
 
 ---------------
 
-pekko-http-core contains code from scala-collection-compat in the 
`org.apache.pekko.http.ccompat` package
-distributed under the Apache 2.0 license.
-- http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/package.scala
-- http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/CompatImpl.scala
-
-Copyright EPFL and Lightbend, Inc.
-
----------------
-
 pekko-http-core contains code from 
https://bjoern.hoehrmann.de/utf-8/decoder/dfa/
 in `org.apache.pekko.http.impl.engine.ws.Utf8Decoder.scala` that was 
distributed under a MIT license.
 
diff --git a/NOTICE b/NOTICE
index f76872945..577d4c03a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -12,25 +12,6 @@ Apache License, Version 2.0 License.
 
 ---------------
 
-pekko-http-core contains code from scala-collection-compat distributed under 
the Apache 2.0 license.
-
-scala-collection-compat
-Copyright (c) 2002-2023 EPFL
-Copyright (c) 2011-2023 Lightbend, Inc.
-
-Scala includes software developed at
-LAMP/EPFL (https://lamp.epfl.ch/) and
-Lightbend, Inc. (https://www.lightbend.com/).
-
-Licensed under the Apache License, Version 2.0 (the "License").
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
----------------
-
 pekko-http-core and pekko-http-tests contain code based on akka-sse 
<https://github.com/hseeberger/akka-sse>
 distributed under the Apache 2.0 license.
 
diff --git a/build.sbt b/build.sbt
index 55e8e4c16..33f3e739a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -88,40 +88,17 @@ lazy val root = Project(
     Compile / headerCreate / unmanagedSources := (baseDirectory.value / 
"project").**("*.scala").get)
   .aggregate(aggregatedProjects: _*)
 
-/**
- * Adds a `src/.../scala-2.13+` source directory for Scala 2.13 and newer
- * and a `src/.../scala-2.13-` source directory for Scala version older than 
2.13
- */
-def add213CrossDirs(config: Configuration): Seq[Setting[_]] = Seq(
-  config / unmanagedSourceDirectories += {
-    val sourceDir = (config / sourceDirectory).value
-    CrossVersion.partialVersion(scalaVersion.value) match {
-      case Some((e, n)) if e > 2 || (e == 2 && n >= 13) => sourceDir / 
"scala-2.13+"
-      case _                                            => sourceDir / 
"scala-2.13-"
-    }
-  })
-
-val commonSettings =
-  add213CrossDirs(Compile) ++
-  add213CrossDirs(Test)
-
 val scalaMacroSupport = Seq(
   scalacOptions ++= {
     CrossVersion.partialVersion(scalaVersion.value) match {
-      case Some((2, n)) if n >= 13 =>
+      case Some((2, n)) =>
         Seq("-Ymacro-annotations")
       case _ =>
         Seq.empty
     }
-  },
-  libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) 
match {
-    case Some((2, n)) if n < 13 =>
-      Seq(compilerPlugin(("org.scalamacros" % "paradise" % 
"2.1.1").cross(CrossVersion.full)))
-    case _ => Seq.empty
-  }))
+  })
 
 lazy val parsing = project("parsing")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.parsing"))
   .addPekkoModuleDependency("pekko-actor", "provided", 
PekkoCoreDependency.default)
   .settings(Dependencies.parsing)
@@ -132,7 +109,6 @@ lazy val parsing = project("parsing")
   .disablePlugins(MimaPlugin)
 
 lazy val httpCore = project("http-core")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.core"))
   .settings(AddMetaInfLicenseFiles.httpCoreSettings)
   .dependsOn(parsing /*, httpScalafixRules % ScalafixConfig*/ )
@@ -152,7 +128,6 @@ lazy val httpCore = project("http-core")
   .disablePlugins(ScalafixPlugin)
 
 lazy val http = project("http")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http"))
   .dependsOn(httpCore)
   .addPekkoModuleDependency("pekko-stream", "provided", 
PekkoCoreDependency.default)
@@ -167,7 +142,6 @@ lazy val http = project("http")
   .enablePlugins(ReproducibleBuildsPlugin)
 
 lazy val http2Tests = project("http2-tests")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.http2"))
   .dependsOn(httpCore, httpTestkit % "test", httpCore % "test->test")
   .addPekkoModuleDependency("pekko-stream", "provided", 
PekkoCoreDependency.default)
@@ -209,7 +183,6 @@ lazy val http2Tests = project("http2-tests")
   .disablePlugins(MimaPlugin) // experimental module still
 
 lazy val httpTestkit = project("http-testkit")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.testkit"))
   .dependsOn(http)
   .addPekkoModuleDependency("pekko-stream-testkit", "provided", 
PekkoCoreDependency.default)
@@ -225,7 +198,6 @@ lazy val httpTestkit = project("http-testkit")
   .disablePlugins(MimaPlugin) // testkit, no bin compat guaranteed
 
 lazy val httpTestkitMunit = project("http-testkit-munit")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.testkit.munit"))
   .dependsOn(http, httpTestkit)
   .addPekkoModuleDependency("pekko-stream-testkit", "provided", 
PekkoCoreDependency.default)
@@ -234,7 +206,6 @@ lazy val httpTestkitMunit = project("http-testkit-munit")
   .disablePlugins(MimaPlugin) // testkit, no bin compat guaranteed
 
 lazy val httpTests = project("http-tests")
-  .settings(commonSettings)
   .settings(Dependencies.httpTests)
   .dependsOn(httpSprayJson, httpXml, httpJackson,
     httpTestkit % "test", httpCore % "test->test",
@@ -261,7 +232,6 @@ lazy val httpTests = project("http-tests")
     })
 
 lazy val httpJmhBench = project("http-bench-jmh")
-  .settings(commonSettings)
   .dependsOn(http, httpCors, http2Tests % "compile->compile,test")
   .addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
   .enablePlugins(JmhPlugin)
@@ -269,7 +239,6 @@ lazy val httpJmhBench = project("http-bench-jmh")
   .disablePlugins(MimaPlugin)
 
 lazy val httpMarshallersScala = project("http-marshallers-scala")
-  .settings(commonSettings)
   .enablePlugins(NoPublish /*, AggregatePRValidation*/ )
   .disablePlugins(MimaPlugin)
   .aggregate(httpSprayJson, httpXml)
@@ -287,7 +256,6 @@ lazy val httpSprayJson =
     .settings(Dependencies.httpSprayJson)
 
 lazy val httpMarshallersJava = project("http-marshallers-java")
-  .settings(commonSettings)
   .enablePlugins(NoPublish /*, AggregatePRValidation*/ )
   .disablePlugins(MimaPlugin)
   .aggregate(httpJackson)
@@ -304,7 +272,6 @@ lazy val httpJackson =
 lazy val httpCaching = project("http-caching")
   .settings(
     name := "pekko-http-caching")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.caching"))
   .addPekkoModuleDependency("pekko-stream", "provided", 
PekkoCoreDependency.default)
   .addPekkoModuleDependency("pekko-stream-testkit", "provided", 
PekkoCoreDependency.default)
@@ -315,7 +282,6 @@ lazy val httpCaching = project("http-caching")
 lazy val httpCors = project("http-cors")
   .settings(
     name := "pekko-http-cors")
-  .settings(commonSettings)
   .settings(AutomaticModuleName.settings("pekko.http.cors"))
   .settings(AddMetaInfLicenseFiles.httpCorsSettings)
   .addPekkoModuleDependency("pekko-stream", "provided", 
PekkoCoreDependency.default)
@@ -335,7 +301,6 @@ def httpMarshallersScalaSubproject(moduleName: String) =
     .dependsOn(http)
     .settings(
       name := s"pekko-http-$moduleName")
-    .settings(commonSettings)
     .enablePlugins(BootstrapGenjavadoc)
     .enablePlugins(ReproducibleBuildsPlugin)
 
@@ -346,7 +311,6 @@ def httpMarshallersJavaSubproject(moduleName: String) =
     .settings(
       name := s"pekko-http-$moduleName")
     .dependsOn(http)
-    .settings(commonSettings)
     .enablePlugins(BootstrapGenjavadoc)
     .enablePlugins(ReproducibleBuildsPlugin)
 
diff --git 
a/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala2.12-compat.excludes
 
b/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala2.12-compat.excludes
new file mode 100644
index 000000000..176d5df34
--- /dev/null
+++ 
b/http-core/src/main/mima-filters/2.0.x.backwards.excludes/remove-scala2.12-compat.excludes
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Remove Scala 2.12 compatibility support
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.ccompat.imm.package")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.ccompat.imm.package$")
diff --git 
a/http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/imm/package.scala
 
b/http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/imm/package.scala
deleted file mode 100644
index 8bc5f7818..000000000
--- 
a/http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/imm/package.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.http.ccompat
-
-/**
- * INTERNAL API
- */
-package object imm {
-  // Nothing yet, but present to be source-compatible with 2.13-
-}
diff --git 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/CompatImpl.scala 
b/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/CompatImpl.scala
deleted file mode 100644
index 0e27de2c9..000000000
--- 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/CompatImpl.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2019-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-/*
- * Scala (https://www.scala-lang.org)
- *
- * Copyright EPFL and Lightbend, Inc.
- *
- * Licensed under Apache License 2.0
- * (http://www.apache.org/licenses/LICENSE-2.0).
- *
- * See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- */
-
-package org.apache.pekko.http.ccompat
-
-import scala.collection.generic.CanBuildFrom
-import scala.collection.mutable
-
-/**
- * INTERNAL API
- *
- * Based on 
https://github.com/scala/scala-collection-compat/blob/main/compat/src/main/scala-2.11_2.12/scala/collection/compat/CompatImpl.scala
- * but reproduced here so we don't need to add a dependency on this library. 
It contains much more than we need right now, and is
- * not promising binary compatibility yet at the time of writing.
- */
-private[ccompat] object CompatImpl {
-  def simpleCBF[A, C](f: => mutable.Builder[A, C]): CanBuildFrom[Any, A, C] = 
new CanBuildFrom[Any, A, C] {
-    def apply(from: Any): mutable.Builder[A, C] = apply()
-    def apply(): mutable.Builder[A, C] = f
-  }
-}
diff --git 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/MapHelpers.scala 
b/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/MapHelpers.scala
deleted file mode 100644
index b69a0fbfa..000000000
--- 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/MapHelpers.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.http.ccompat
-
-/**
- * INTERNAL API
- */
-object MapHelpers {
-  def convertMapToScala[K, V](jmap: java.util.Map[K, V]): 
scala.collection.immutable.Map[K, V] = {
-    import scala.collection.JavaConverters._
-    Map.empty ++ jmap.asScala
-  }
-}
diff --git 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/imm/package.scala
 
b/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/imm/package.scala
deleted file mode 100644
index 3775d09df..000000000
--- 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/imm/package.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.http.ccompat
-
-import scala.collection.immutable
-
-/**
- * INTERNAL API
- */
-package object imm {
-  implicit class SortedSetOps[A](val real: immutable.SortedSet[A]) extends 
AnyVal {
-    def unsorted: immutable.Set[A] = real
-  }
-
-  implicit class StreamOps[A](val underlying: immutable.Stream[A]) extends 
AnyVal {
-    // renamed in 2.13
-    def lazyAppendedAll[B >: A](rest: => TraversableOnce[B]): Stream[B] = 
underlying.append(rest)
-  }
-}
diff --git 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/package.scala 
b/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/package.scala
deleted file mode 100644
index 478ca1f19..000000000
--- a/http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/package.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-/*
- * Scala (https://www.scala-lang.org)
- *
- * Copyright EPFL and Lightbend, Inc.
- *
- * Licensed under Apache License 2.0
- * (http://www.apache.org/licenses/LICENSE-2.0).
- *
- * See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- */
-
-package org.apache.pekko.http
-
-import org.apache.pekko
-import scala.collection.generic.{ CanBuildFrom, GenericCompanion }
-import scala.collection.{ mutable, GenTraversable }
-import scala.{ collection => c }
-
-/**
- * INTERNAL API
- *
- * Partly based on 
https://github.com/scala/scala-collection-compat/blob/main/compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala
- * but reproduced here so we don't need to add a dependency on this library. 
It contains much more than we need right now, and is
- * not promising binary compatibility yet at the time of writing.
- */
-package object ccompat {
-  import CompatImpl._
-
-  implicit def genericCompanionToCBF[A, CC[X] <: GenTraversable[X]](
-      fact: GenericCompanion[CC]): CanBuildFrom[Any, A, CC[A]] =
-    simpleCBF(fact.newBuilder[A])
-
-  // This really belongs into scala.collection but there's already a package 
object
-  // in scala-library so we can't add to it
-  type IterableOnce[+X] = c.TraversableOnce[X]
-  val IterableOnce = c.TraversableOnce
-
-  implicit class RichQueue[T](val queue: mutable.Queue[T]) extends AnyVal {
-    // missing in 2.12
-    def -=(element: T): Unit = queue.dequeueAll(_ == element)
-  }
-}
-
-/**
- * INTERNAL API
- */
-package ccompat {
-  trait Builder[-Elem, +To] extends mutable.Builder[Elem, To] { self =>
-    // This became final in 2.13 so cannot be overridden there anymore
-    final override def +=(elem: Elem): this.type = addOne(elem)
-    def addOne(elem: Elem): this.type = self.+=(elem)
-  }
-
-  trait QuerySeqOptimized extends 
scala.collection.immutable.LinearSeq[(String, String)]
-      with scala.collection.LinearSeqOptimized[(String, String), 
pekko.http.scaladsl.model.Uri.Query] {
-    self: pekko.http.scaladsl.model.Uri.Query =>
-    override def newBuilder: mutable.Builder[(String, String), 
pekko.http.scaladsl.model.Uri.Query] =
-      pekko.http.scaladsl.model.Uri.Query.newBuilder
-  }
-}
diff --git 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/scaladsl/util/FastFuture.scala
 
b/http-core/src/main/scala-2.13-/org/apache/pekko/http/scaladsl/util/FastFuture.scala
deleted file mode 100644
index e773fb683..000000000
--- 
a/http-core/src/main/scala-2.13-/org/apache/pekko/http/scaladsl/util/FastFuture.scala
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2009-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.http.scaladsl.util
-
-import scala.language.higherKinds
-import scala.util.control.NonFatal
-import scala.util.{ Failure, Success, Try }
-import scala.collection.generic.CanBuildFrom
-import scala.concurrent.duration.Duration
-import scala.concurrent._
-
-/**
- * Provides alternative implementations of the basic transformation operations 
defined on [[scala.concurrent.Future]],
- * which try to avoid scheduling to an [[scala.concurrent.ExecutionContext]] 
if possible, i.e. if the given future
- * value is already present.
- */
-class FastFuture[A](val future: Future[A]) extends AnyVal {
-  import FastFuture._
-
-  def map[B](f: A => B)(implicit ec: ExecutionContext): Future[B] =
-    transformWith(a => FastFuture.successful(f(a)), FastFuture.failed)
-
-  def flatMap[B](f: A => Future[B])(implicit ec: ExecutionContext): Future[B] =
-    transformWith(f, FastFuture.failed)
-
-  def filter(pred: A => Boolean)(implicit executor: ExecutionContext): 
Future[A] =
-    flatMap { r =>
-      if (pred(r)) future
-      else throw new NoSuchElementException("Future.filter predicate is not 
satisfied")
-    }
-
-  def foreach(f: A => Unit)(implicit ec: ExecutionContext): Unit = map(f)
-
-  def transformWith[B](f: Try[A] => Future[B])(implicit executor: 
ExecutionContext): Future[B] =
-    transformWith(a => f(Success(a)), e => f(Failure(e)))
-
-  def transformWith[B](s: A => Future[B], f: Throwable => Future[B])(implicit 
executor: ExecutionContext): Future[B] = {
-    def strictTransform[T](x: T, f: T => Future[B]) =
-      try f(x)
-      catch { case NonFatal(e) => ErrorFuture(e) }
-
-    future match {
-      case FulfilledFuture(a) => strictTransform(a, s)
-      case ErrorFuture(e)     => strictTransform(e, f)
-      case _ => future.value match {
-          case None =>
-            val p = Promise[B]()
-            future.onComplete {
-              case Success(a) => p.completeWith(strictTransform(a, s))
-              case Failure(e) => p.completeWith(strictTransform(e, f))
-            }
-            p.future
-          case Some(Success(a)) => strictTransform(a, s)
-          case Some(Failure(e)) => strictTransform(e, f)
-        }
-    }
-  }
-
-  def recover[B >: A](pf: PartialFunction[Throwable, B])(implicit ec: 
ExecutionContext): Future[B] =
-    transformWith(FastFuture.successful, t => if (pf.isDefinedAt(t)) 
FastFuture.successful(pf(t)) else future)
-
-  def recoverWith[B >: A](pf: PartialFunction[Throwable, Future[B]])(implicit 
ec: ExecutionContext): Future[B] =
-    transformWith(FastFuture.successful, t => pf.applyOrElse(t, (_: Throwable) 
=> future))
-}
-
-object FastFuture {
-  def apply[T](value: Try[T]): Future[T] = value match {
-    case Success(t) => FulfilledFuture(t)
-    case Failure(e) => ErrorFuture(e)
-  }
-  private[this] val _successful: Any => Future[Any] = FulfilledFuture.apply
-  def successful[T]: T => Future[T] = _successful.asInstanceOf[T => Future[T]]
-  val failed: Throwable => Future[Nothing] = ErrorFuture.apply
-
-  private case class FulfilledFuture[+A](a: A) extends Future[A] {
-    def value = Some(Success(a))
-    def onComplete[U](f: Try[A] => U)(implicit executor: ExecutionContext) = 
Future.successful(a).onComplete(f)
-    def isCompleted = true
-    def result(atMost: Duration)(implicit permit: CanAwait) = a
-    def ready(atMost: Duration)(implicit permit: CanAwait) = this
-    def transform[S](f: scala.util.Try[A] => scala.util.Try[S])(
-        implicit executor: scala.concurrent.ExecutionContext): 
scala.concurrent.Future[S] =
-      FastFuture(f(Success(a)))
-    def transformWith[S](f: scala.util.Try[A] => scala.concurrent.Future[S])(
-        implicit executor: scala.concurrent.ExecutionContext): 
scala.concurrent.Future[S] =
-      new FastFuture(this).transformWith(f)
-  }
-  private case class ErrorFuture(error: Throwable) extends Future[Nothing] {
-    def value = Some(Failure(error))
-    def onComplete[U](f: Try[Nothing] => U)(implicit executor: 
ExecutionContext) = Future.failed(error).onComplete(f)
-    def isCompleted = true
-    def result(atMost: Duration)(implicit permit: CanAwait) = throw error
-    def ready(atMost: Duration)(implicit permit: CanAwait) = this
-    def transform[S](f: scala.util.Try[Nothing] => scala.util.Try[S])(
-        implicit executor: scala.concurrent.ExecutionContext): 
scala.concurrent.Future[S] =
-      FastFuture(f(Failure(error)))
-    def transformWith[S](f: scala.util.Try[Nothing] => 
scala.concurrent.Future[S])(
-        implicit executor: scala.concurrent.ExecutionContext): 
scala.concurrent.Future[S] =
-      new FastFuture(this).transformWith(f)
-  }
-
-  implicit class EnhancedFuture[T](val future: Future[T]) extends AnyVal {
-    def fast: FastFuture[T] = new FastFuture[T](future)
-  }
-
-  def sequence[T, M[_] <: TraversableOnce[_]](in: M[Future[T]])(implicit cbf: 
CanBuildFrom[M[Future[T]], T, M[T]],
-      executor: ExecutionContext): Future[M[T]] =
-    in.foldLeft(successful(cbf(in))) {
-      (fr, fa) => for (r <- fr.fast; a <- fa.asInstanceOf[Future[T]].fast) 
yield r += a
-    }.fast.map(_.result())
-
-  def fold[T, R](futures: TraversableOnce[Future[T]])(zero: R)(f: (R, T) => R)(
-      implicit executor: ExecutionContext): Future[R] =
-    if (futures.isEmpty) successful(zero)
-    else sequence(futures).fast.map(_.foldLeft(zero)(f))
-
-  def reduce[T, R >: T](futures: TraversableOnce[Future[T]])(op: (R, T) => R)(
-      implicit executor: ExecutionContext): Future[R] =
-    if (futures.isEmpty) failed(new NoSuchElementException("reduce attempted 
on empty collection"))
-    else sequence(futures).fast.map(_.reduceLeft(op))
-
-  def traverse[A, B, M[_] <: TraversableOnce[_]](in: M[A])(fn: A => Future[B])(
-      implicit cbf: CanBuildFrom[M[A], B, M[B]], executor: ExecutionContext): 
Future[M[B]] =
-    in.foldLeft(successful(cbf(in))) { (fr, a) =>
-      val fb = fn(a.asInstanceOf[A])
-      for (r <- fr.fast; b <- fb.fast) yield r += b
-    }.fast.map(_.result())
-}
diff --git 
a/http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/MapHelpers.scala 
b/http-core/src/main/scala/org/apache/pekko/http/ccompat/MapHelpers.scala
similarity index 100%
rename from 
http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/MapHelpers.scala
rename to 
http-core/src/main/scala/org/apache/pekko/http/ccompat/MapHelpers.scala
diff --git 
a/http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/package.scala 
b/http-core/src/main/scala/org/apache/pekko/http/ccompat/package.scala
similarity index 100%
rename from 
http-core/src/main/scala-2.13+/org/apache/pekko/http/ccompat/package.scala
rename to http-core/src/main/scala/org/apache/pekko/http/ccompat/package.scala
diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/PriorityTree.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/PriorityTree.scala
index 5824fdaed..0f6999b62 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/PriorityTree.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/PriorityTree.scala
@@ -16,7 +16,6 @@ package org.apache.pekko.http.impl.engine.http2
 import org.apache.pekko
 import pekko.annotation.InternalApi
 import pekko.http.impl.engine.http2.util.AsciiTreeLayout
-import pekko.http.ccompat.imm._
 
 import scala.collection.immutable
 import scala.collection.immutable.{ TreeMap, TreeSet }
diff --git 
a/http-core/src/main/scala-2.13+/org/apache/pekko/http/scaladsl/util/FastFuture.scala
 b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/util/FastFuture.scala
similarity index 100%
rename from 
http-core/src/main/scala-2.13+/org/apache/pekko/http/scaladsl/util/FastFuture.scala
rename to 
http-core/src/main/scala/org/apache/pekko/http/scaladsl/util/FastFuture.scala
diff --git 
a/http-core/src/test/scala/io/pekko/integrationtest/http/HttpModelIntegrationSpec.scala
 
b/http-core/src/test/scala/io/pekko/integrationtest/http/HttpModelIntegrationSpec.scala
index 9cf55f763..56fb64529 100644
--- 
a/http-core/src/test/scala/io/pekko/integrationtest/http/HttpModelIntegrationSpec.scala
+++ 
b/http-core/src/test/scala/io/pekko/integrationtest/http/HttpModelIntegrationSpec.scala
@@ -21,7 +21,6 @@ import org.scalatest.BeforeAndAfterAll
 import org.apache.pekko
 import pekko.util.ByteString
 import pekko.actor.ActorSystem
-import pekko.http.ccompat._ // required for Scala 2.12 compilation
 import pekko.http.scaladsl.model._
 import pekko.stream.scaladsl._
 import pekko.testkit._
diff --git a/http-scalafix/README.md b/http-scalafix/README.md
index 3bc3bc429..035254586 100644
--- a/http-scalafix/README.md
+++ b/http-scalafix/README.md
@@ -11,6 +11,3 @@ The setup of the scalafix module roughly follows the example 
in https://github.c
  * run `scalafixEnable` on the sbt shell (this will unfortunately require a 
complete rebuild afterwards)
  * run `set scalacOptions in ThisBuild += "-P:semanticdb:synthetics:on"` to 
allow access to synthetics
  * e.g. run `docs/scalafixAll MigrateToServerBuilder`
-
-*Note:* There's some weird stuff going on regarding cross-publishing. If 
running the rule fails with a weird error, try switching to Scala 2.12 first 
with `++2.12.11` (or
-whatever is now the current version).
diff --git 
a/http-tests/src/test/scala-2.13-/main/org/apache/pekko/http/scaladsl/server/util/package.scala
 
b/http-tests/src/test/scala-2.13-/main/org/apache/pekko/http/scaladsl/server/util/package.scala
deleted file mode 100644
index a19bed487..000000000
--- 
a/http-tests/src/test/scala-2.13-/main/org/apache/pekko/http/scaladsl/server/util/package.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2009-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.http.scaladsl.server
-
-package object util {
-  type VarArgsFunction1[-T, +U] = (T*) => U
-}
diff --git 
a/http-tests/src/test/scala-2.13-/src/main/org/apache/pekko/http/ccompat/ImplicitUtils.scala
 
b/http-tests/src/test/scala-2.13-/src/main/org/apache/pekko/http/ccompat/ImplicitUtils.scala
deleted file mode 100644
index 2ceafb7f8..000000000
--- 
a/http-tests/src/test/scala-2.13-/src/main/org/apache/pekko/http/ccompat/ImplicitUtils.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2009-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.http.ccompat
-
-object ImplicitUtils
diff --git 
a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/DiscardEntityDefaultExceptionHandlerSpec.scala
 
b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/DiscardEntityDefaultExceptionHandlerSpec.scala
index bcbf3ad47..f085e8bf2 100644
--- 
a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/DiscardEntityDefaultExceptionHandlerSpec.scala
+++ 
b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/DiscardEntityDefaultExceptionHandlerSpec.scala
@@ -22,7 +22,6 @@ import pekko.stream.scaladsl.Source
 import pekko.util.ByteString
 import org.scalatest.concurrent.Eventually._
 import org.scalatest.concurrent.ScalaFutures
-import pekko.http.ccompat.imm._
 
 import scala.concurrent.Future
 
diff --git 
a/http-tests/src/test/scala-2.13+/org/apache/pekko/http/scaladsl/server/util/VarArgsFunction1.scala
 
b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/util/VarArgsFunction1.scala
similarity index 100%
rename from 
http-tests/src/test/scala-2.13+/org/apache/pekko/http/scaladsl/server/util/VarArgsFunction1.scala
rename to 
http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/util/VarArgsFunction1.scala
diff --git a/project/Common.scala b/project/Common.scala
index da0762a30..0b76bf1e0 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -48,9 +48,6 @@ object Common extends AutoPlugin {
     Global / parallelExecution := 
sys.props.getOrElse("pekko.http.parallelExecution", "true") != "false")
 
   val javacTarget: String = "17"
-  def onlyAfterScala212[T](values: Seq[T]): Def.Initialize[Seq[T]] = 
Def.setting {
-    if (scalaMinorVersion.value >= 12) values else Seq.empty[T]
-  }
   def onlyOnScala2[T](values: Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
     if (scalaVersion.value.startsWith("3")) Seq.empty[T] else values
   }
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 0d627d346..d3d64a3c2 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -33,10 +33,9 @@ object Dependencies {
 
   val scalafixVersion = _root_.scalafix.sbt.BuildInfo.scalafixVersion // grab 
from plugin
 
-  val scala212Version = "2.12.20"
   val scala213Version = "2.13.16"
   val scala3Version = "3.3.6"
-  val allScalaVersions = Seq(scala213Version, scala212Version, scala3Version)
+  val allScalaVersions = Seq(scala213Version, scala3Version)
 
   val Versions = Seq(
     crossScalaVersions := allScalaVersions,


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

Reply via email to