From c5311086a01c53ee91ca90ce3470fa941a9844fe Mon Sep 17 00:00:00 2001 From: Raphael Speyer Date: Fri, 29 Nov 2024 20:40:39 +0100 Subject: [PATCH 1/3] make InclusiveFilter.ofTemplateIds use the legacy templateId field so that it is compatible with a 2.7 ledger --- .../com/daml/ledger/javaapi/data/InclusiveFilter.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sdk/language-support/java/bindings/src/main/java/com/daml/ledger/javaapi/data/InclusiveFilter.java b/sdk/language-support/java/bindings/src/main/java/com/daml/ledger/javaapi/data/InclusiveFilter.java index feffcee898ae..b2bc37bf3d66 100644 --- a/sdk/language-support/java/bindings/src/main/java/com/daml/ledger/javaapi/data/InclusiveFilter.java +++ b/sdk/language-support/java/bindings/src/main/java/com/daml/ledger/javaapi/data/InclusiveFilter.java @@ -11,7 +11,6 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.function.Function; import java.util.stream.Collectors; import org.checkerframework.checker.nullness.qual.NonNull; @@ -56,12 +55,7 @@ public InclusiveFilter( } public static InclusiveFilter ofTemplateIds(@NonNull Set<@NonNull Identifier> templateIds) { - return new InclusiveFilter( - Collections.emptyMap(), - templateIds.stream() - .collect( - Collectors.toUnmodifiableMap( - Function.identity(), tId -> Template.HIDE_CREATED_EVENT_BLOB))); + return new InclusiveFilter(templateIds, Collections.emptyMap()); } @NonNull From fc9d2a4330df5f9f50e0a090c0d93a2846f4de66 Mon Sep 17 00:00:00 2001 From: Raphael Speyer Date: Mon, 2 Dec 2024 09:06:38 +0100 Subject: [PATCH 2/3] fix unit test --- .../grpc/TransactionsClientImplTest.scala | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/sdk/language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/TransactionsClientImplTest.scala b/sdk/language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/TransactionsClientImplTest.scala index c4cd6297dcd9..7c3afa7d593f 100644 --- a/sdk/language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/TransactionsClientImplTest.scala +++ b/sdk/language-support/java/bindings-rxjava/src/test/scala/com/daml/ledger/rxjava/grpc/TransactionsClientImplTest.scala @@ -10,7 +10,6 @@ import com.daml.ledger.rxjava.grpc.helpers.TransactionGenerator._ import com.daml.ledger.rxjava.grpc.helpers.{DataLayerHelpers, LedgerServices, TestConfiguration} import com.daml.ledger.api.v1.ledger_offset.LedgerOffset import com.daml.ledger.api.v1.ledger_offset.LedgerOffset.Value.Absolute -import com.daml.ledger.api.v1.transaction_filter.TemplateFilter import com.daml.ledger.api.v1.value.Identifier import io.reactivex.Observable import org.scalacheck.Shrink @@ -18,6 +17,7 @@ import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks import org.scalatest.matchers.should.Matchers import org.scalatest.flatspec.AnyFlatSpec +import scala.annotation.nowarn import scala.jdk.CollectionConverters._ final class TransactionsClientImplTest @@ -79,15 +79,9 @@ final class TransactionsClientImplTest request.end shouldBe Some(LedgerOffset(Absolute("2"))) val filter = request.filter.get.filtersByParty filter.keySet shouldBe Set("Alice") - filter("Alice").inclusive.get.templateFilters.toSet shouldBe Set( - TemplateFilter( - Some(Identifier("p1", moduleName = "m1", entityName = "e1")), - includeCreatedEventBlob = false, - ), - TemplateFilter( - Some(Identifier("p2", moduleName = "m2", entityName = "e2")), - includeCreatedEventBlob = false, - ), + (filter("Alice").inclusive.get.templateIds: @nowarn("cat=deprecation")).toSet shouldBe Set( + Identifier("p1", moduleName = "m1", entityName = "e1"), + Identifier("p2", moduleName = "m2", entityName = "e2"), ) request.verbose shouldBe true } @@ -150,15 +144,9 @@ final class TransactionsClientImplTest request.end shouldBe Some(LedgerOffset(Absolute("2"))) val filter = request.filter.get.filtersByParty filter.keySet shouldBe Set("Alice") - filter("Alice").inclusive.get.templateFilters.toSet shouldBe Set( - TemplateFilter( - Some(Identifier("p1", moduleName = "m1", entityName = "e1")), - includeCreatedEventBlob = false, - ), - TemplateFilter( - Some(Identifier("p2", moduleName = "m2", entityName = "e2")), - includeCreatedEventBlob = false, - ), + (filter("Alice").inclusive.get.templateIds: @nowarn("cat=deprecation")).toSet shouldBe Set( + Identifier("p1", moduleName = "m1", entityName = "e1"), + Identifier("p2", moduleName = "m2", entityName = "e2"), ) request.verbose shouldBe true } From 9ea3bf936c541fd6b563856a8959f1ed82601b9a Mon Sep 17 00:00:00 2001 From: Raphael Speyer Date: Mon, 2 Dec 2024 09:35:47 +0100 Subject: [PATCH 3/3] fix precommit config for scalafmt --- sdk/.pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/.pre-commit-config.yaml b/sdk/.pre-commit-config.yaml index cd75bb9201dd..16079af42043 100644 --- a/sdk/.pre-commit-config.yaml +++ b/sdk/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: name: scalafmt language: system require_serial: true - entry: "scalafmt --respect-project-filters" + entry: "scalafmt -c sdk/.scalafmt.conf --respect-project-filters" types: [scala] - id: javafmt name: javafmt