Skip to content

Commit

Permalink
Remove dependencies on compatibility libraries
Browse files Browse the repository at this point in the history
Continues the work started in #12543

These libraries were only needed to transition from Scala 2.12 to 2.13
and are no longer useful as all the necessary items are now available
in Scala 2.13.

changelog_begin
changelog_end
  • Loading branch information
stefanobaghino-da committed Jan 24, 2022
1 parent b0ff6d5 commit d95596b
Show file tree
Hide file tree
Showing 59 changed files with 172 additions and 223 deletions.
2 changes: 0 additions & 2 deletions bazel-java-deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ def install_java_deps():
"org.sangria-graphql:sangria_{}:2.0.1".format(scala_major_version),
"org.sangria-graphql:sangria-spray-json_{}:1.0.2".format(scala_major_version),
"org.scalacheck:scalacheck_{}:1.15.4".format(scala_major_version),
"org.scala-lang.modules:scala-collection-compat_{}:2.3.2".format(scala_major_version),
"org.scala-lang.modules:scala-java8-compat_{}:0.9.0".format(scala_major_version),
"org.scala-lang.modules:scala-parallel-collections_{}:1.0.0".format(scala_major_version),
"org.scalameta:munit_{}:0.7.26".format(scala_major_version),
"org.scalactic:scalactic_{}:3.2.9".format(scala_major_version),
Expand Down
2 changes: 0 additions & 2 deletions daml-lf/interpreter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ da_scala_library(
srcs = glob(["src/main/**/*.scala"]),
scala_deps = [
"@maven//:io_spray_spray_json",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_typelevel_paiges_core",
],
Expand Down Expand Up @@ -72,7 +71,6 @@ da_scala_test_suite(
],
),
scala_deps = [
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Value._
import com.daml.scalautil.Statement.discard

import scala.annotation.tailrec
import scala.collection.compat._
import scala.collection.Factory
import scala.collection.immutable

/** An in-memory representation of a ledger for scenarios */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.daml.scalautil.Statement.discard
import com.daml.nameof.NameOf

import scala.jdk.CollectionConverters._
import scala.collection.compat._
import scala.collection.Factory
import scala.collection.immutable.TreeMap
import scala.util.hashing.MurmurHash3

Expand Down
1 change: 0 additions & 1 deletion daml-lf/transaction-test-lib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ da_scala_library(
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scalaz_scalaz_scalacheck_binding",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scalacopts = lf_scalacopts_stricter,
tags = ["maven_coordinates=com.daml:daml-lf-transaction-test-lib:__VERSION__"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import iface.{
Variant,
PrimType => PT,
}
import scala.collection.compat._
import scala.collection.Factory
import scalaz.{@@, Order, Ordering, Tag}
import scalaz.syntax.bitraverse._
import scalaz.syntax.traverse._
Expand Down
1 change: 0 additions & 1 deletion daml-lf/validation/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ da_scala_library(
srcs = glob(["src/main/**/*.scala"]),
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scalacopts = lf_scalacopts_stricter,
tags = ["maven_coordinates=com.daml:daml-lf-validation:__VERSION__"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.daml.lf.data.Ref.Name
import com.daml.lf.language.Ast._
import com.daml.lf.validation.Util._
import com.daml.lf.validation.iterable.TypeIterable
import scala.collection.compat.immutable.LazyList

private[validation] object TypeSubst {

Expand Down
1 change: 0 additions & 1 deletion daml-script/runner/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ da_scala_library(
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:com_typesafe_akka_akka_parsing",
"@maven//:io_spray_spray_json",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_typelevel_paiges_core",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import scalaz.OneAnd._
import scalaz.std.set._
import scalaz.syntax.foldable._

import scala.collection.compat.immutable.LazyList
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}

Expand Down
3 changes: 0 additions & 3 deletions language-support/scala/bindings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ da_scala_library(
],
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scala_exports = [
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
tags = ["maven_coordinates=com.daml:bindings-scala:__VERSION__"],
visibility = [
Expand All @@ -51,7 +49,6 @@ da_scala_test_suite(
],
scala_deps = [
"@maven//:com_chuusai_shapeless",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import scalaz.syntax.std.boolean._
import scalaz.syntax.tag._

import scala.annotation.nowarn
import scala.collection.compat._
import scala.collection.Factory
import scala.collection.{mutable, immutable => imm}

sealed abstract class Primitive extends PrimitiveInstances {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scalaz.std.option._
import scalaz.syntax.traverse._

import scala.annotation.tailrec
import scala.collection.compat._
import scala.collection.Factory
import scala.{specialized => sp}

sealed trait DamlCodecs // always include `object DamlCodecs` in implicit search
Expand Down
1 change: 0 additions & 1 deletion language-support/scala/codegen-sample-app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ da_scala_library(
],
scala_deps = [
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scalacopts = [
"-Wconf:cat=unused-imports&site=com\\.daml\\.sample\\..*:s",
Expand Down
1 change: 0 additions & 1 deletion language-support/scala/codegen/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ da_scala_test_suite(
size = "small",
srcs = glob(["src/test/scala/**/*.scala"]),
scala_deps = [
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
Expand Down
3 changes: 0 additions & 3 deletions ledger/caching/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ load(
da_scala_library(
name = "caching",
srcs = glob(["src/main/scala/**/*.scala"]),
scala_deps = [
"@maven//:org_scala_lang_modules_scala_java8_compat",
],
tags = ["maven_coordinates=com.daml:caching:__VERSION__"],
visibility = [
"//:__subpackages__",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package com.daml.caching
import com.daml.metrics.CacheMetrics
import com.github.benmanes.caffeine.{cache => caffeine}

import scala.compat.java8.FutureConverters
import scala.compat.java8.OptionConverters._
import scala.jdk.FutureConverters.CompletionStageOps
import scala.jdk.OptionConverters.{RichOptional, RichOptionalLong}
import scala.concurrent.Future

object CaffeineCache {
Expand Down Expand Up @@ -41,7 +41,7 @@ object CaffeineCache {
) {
installMetrics(cacheMetrics, cache.synchronous())

def get(key: Key): Future[Value] = FutureConverters.toScala(cache.get(key))
def get(key: Key): Future[Value] = cache.get(key).asScala

def invalidate(key: Key): Unit = cache.synchronous().invalidate(key)
}
Expand Down Expand Up @@ -70,7 +70,7 @@ object CaffeineCache {
): Unit = {
metrics.registerSizeGauge(() => cache.estimatedSize())
metrics.registerWeightGauge(() =>
cache.policy().eviction().asScala.flatMap(_.weightedSize.asScala).getOrElse(0)
cache.policy().eviction().toScala.flatMap(_.weightedSize.toScala).getOrElse(0)
)
}

Expand Down
2 changes: 0 additions & 2 deletions ledger/ledger-api-auth/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ da_scala_library(
resources = glob(["src/main/resources/**/*"]),
scala_deps = [
"@maven//:io_spray_spray_json",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scalaz_scalaz_core",
],
tags = ["maven_coordinates=com.daml:ledger-api-auth:__VERSION__"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import com.daml.error.definitions.LedgerApiErrors
import io.grpc.StatusRuntimeException
import scalapb.lenses.Lens

import scala.collection.compat._
import scala.concurrent.Future
import scala.util.{Failure, Success, Try}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.daml.logging.{ContextualizedLogger, LoggingContext}
import com.daml.platform.server.api.validation.ErrorFactories
import io.grpc._

import scala.compat.java8.FutureConverters
import scala.jdk.FutureConverters.CompletionStageOps
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success, Try}

Expand Down Expand Up @@ -49,8 +49,9 @@ final class AuthorizationInterceptor(
new ServerCall.Listener[Nothing]() {}
}

FutureConverters
.toScala(authService.decodeMetadata(headers))
authService
.decodeMetadata(headers)
.asScala
.flatMap(resolveAuthenticatedUserRights)
.onComplete {
case Failure(error: StatusRuntimeException) =>
Expand Down
2 changes: 0 additions & 2 deletions ledger/ledger-api-domain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ da_scala_test_suite(
scala_deps = [
"@maven//:org_scalatest_scalatest",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scala_lang_modules_scala_java8_compat",
],
deps = [
":ledger-api-domain",
Expand Down
1 change: 0 additions & 1 deletion ledger/ledger-api-test-tool/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ da_scala_binary(
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scalameta_munit",
],
visibility = ["//:__subpackages__"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.daml.ledger.api.testtool.infrastructure

import com.google.protobuf

import scala.compat.java8.DurationConverters._
import scala.jdk.DurationConverters.{JavaDurationOps, ScalaDurationOps}

object ProtobufConverters {

Expand Down
2 changes: 0 additions & 2 deletions ledger/ledger-configuration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ da_scala_test_suite(
"@maven//:org_scalatest_scalatest_shouldmatchers",
"@maven//:org_scalatest_scalatest_wordspec",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scala_lang_modules_scala_java8_compat",
],
deps = [
":ledger-configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.daml.ledger.configuration.protobuf.{ledger_configuration => proto}
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import scala.compat.java8.DurationConverters._
import scala.jdk.DurationConverters.ScalaDurationOps
import scala.concurrent.duration.{DurationInt, FiniteDuration}
import org.scalatest.prop.TableDrivenPropertyChecks._

Expand Down
2 changes: 0 additions & 2 deletions ledger/ledger-grpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ da_scala_test_suite(
scala_deps = [
"@maven//:org_scalatest_scalatest",
"@maven//:org_scalaz_scalaz_core",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scala_lang_modules_scala_java8_compat",
],
deps = [
":ledger-grpc",
Expand Down
1 change: 0 additions & 1 deletion ledger/ledger-on-sql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ da_scala_test_suite(
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scalactic_scalactic",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_flatspec",
Expand Down
1 change: 0 additions & 1 deletion ledger/participant-integration-api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ scala_compile_deps = [
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_playframework_anorm_anorm",
"@maven//:org_playframework_anorm_anorm_tokenizer",
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scalaz_scalaz_core",
"@maven//:io_spray_spray_json",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.daml.logging.{ContextualizedLogger, LoggingContext}
import com.daml.platform.configuration.InitialLedgerConfiguration
import com.daml.telemetry.{DefaultTelemetry, SpanKind, SpanName}

import scala.compat.java8.FutureConverters
import scala.jdk.FutureConverters.CompletionStageOps
import scala.concurrent.ExecutionContext
import scala.concurrent.duration.{Duration => ScalaDuration}
import scala.util.{Failure, Success}
Expand Down Expand Up @@ -76,9 +76,9 @@ final class LedgerConfigurationProvisioner(
) { implicit telemetryContext =>
val maxRecordTime =
Timestamp.assertFromInstant(timeProvider.getCurrentTime.plusSeconds(60))
FutureConverters.toScala(
writeService.submitConfiguration(maxRecordTime, submissionId, initialConfiguration)
)
writeService
.submitConfiguration(maxRecordTime, submissionId, initialConfiguration)
.asScala
}
.onComplete {
case Success(state.SubmissionResult.Acknowledged) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import com.daml.timer.Delayed
import io.grpc.{Status, StatusRuntimeException}

import scala.annotation.nowarn
import scala.compat.java8.FutureConverters.CompletionStageOps
import scala.jdk.FutureConverters.CompletionStageOps
import scala.concurrent.{ExecutionContext, Future}
import scala.util.control.NonFatal
import scala.util.{Failure, Success, Try}
Expand Down Expand Up @@ -285,7 +285,7 @@ private[apiserver] final class ApiSubmissionService private[services] (
submissionId = submissionId,
)
}
}.toScala
}.asScala

private def submitTransaction(
transactionInfo: CommandExecutionResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.daml.platform.server.api.validation.{ErrorFactories, FieldValidations
import com.daml.telemetry.{DefaultTelemetry, TelemetryContext}
import io.grpc.{ServerServiceDefinition, Status, StatusRuntimeException}

import scala.compat.java8.FutureConverters._
import scala.jdk.FutureConverters.CompletionStageOps
import scala.concurrent.duration.{Duration, FiniteDuration}
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}
Expand Down Expand Up @@ -252,7 +252,7 @@ private[apiserver] object ApiConfigManagementService {
val (maximumRecordTime, newConfiguration) = input
writeConfigService
.submitConfiguration(maximumRecordTime, submissionId, newConfiguration)
.toScala
.asScala
}

override def entries(offset: Option[LedgerOffset.Absolute]): Source[ConfigurationEntry, _] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import scalaz.std.either._
import scalaz.std.list._
import scalaz.syntax.traverse._

import scala.compat.java8.FutureConverters._
import scala.jdk.FutureConverters.CompletionStageOps
import scala.concurrent.{ExecutionContext, Future}
import scala.util.Try

Expand Down Expand Up @@ -198,7 +198,7 @@ private[apiserver] object ApiPackageManagementService {
override def submit(submissionId: Ref.SubmissionId, dar: Dar[Archive])(implicit
telemetryContext: TelemetryContext
): Future[state.SubmissionResult] =
packagesWrite.uploadPackages(submissionId, dar.all, None).toScala
packagesWrite.uploadPackages(submissionId, dar.all, None).asScala

override def entries(offset: Option[LedgerOffset.Absolute]): Source[PackageEntry, _] =
packagesIndex.packageEntries(offset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.daml.platform.server.api.ValidationLogger
import com.daml.platform.server.api.validation.ErrorFactories
import io.grpc.{ServerServiceDefinition, StatusRuntimeException}

import scala.compat.java8.FutureConverters
import scala.jdk.FutureConverters.CompletionStageOps
import scala.concurrent.{ExecutionContext, Future}

final class ApiParticipantPruningService private (
Expand Down Expand Up @@ -113,8 +113,9 @@ final class ApiParticipantPruningService private (
logger.info(
s"About to prune participant ledger up to ${pruneUpTo.toApiString} inclusively starting with the write service"
)
FutureConverters
.toScala(writeBackend.prune(pruneUpTo, submissionId, pruneAllDivulgedContracts))
writeBackend
.prune(pruneUpTo, submissionId, pruneAllDivulgedContracts)
.asScala
.flatMap {
case NotPruned(status) => Future.failed(status.asRuntimeException())
case ParticipantPruned =>
Expand Down
Loading

0 comments on commit d95596b

Please sign in to comment.