From a46526198dc4667621d0d3bc6f5b86d7a4f2d6a3 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:29:59 -0300 Subject: [PATCH] Avoid codacy issue over use of fully qualified name Had to change the getPaymentMethods() names to getPaymentMethodIds() to avoid this codacy issue: "Unnecessary use of fully qualified name 'PaymentMethod.getPaymentMethods' due to existing static import 'bisq.core.payment.payload.PaymentMethod.*'" If 'PaymentMethod.getPaymentMethods' was changed to 'getPaymentMethods', a recursive loop would result, ending in an out of stack heap crash. This renaming of the method on the server is correct, but the CLI's 'getpaymentmethods' name was not changed. --- core/src/main/java/bisq/core/api/CoreApi.java | 4 ++-- .../main/java/bisq/core/api/CorePaymentAccountsService.java | 4 ++-- .../java/bisq/daemon/grpc/GrpcPaymentAccountsService.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java index cc50da2acdd..95ceece230f 100644 --- a/core/src/main/java/bisq/core/api/CoreApi.java +++ b/core/src/main/java/bisq/core/api/CoreApi.java @@ -169,8 +169,8 @@ public Set getPaymentAccounts() { return paymentAccountsService.getPaymentAccounts(); } - public List getPaymentMethods() { - return paymentAccountsService.getPaymentMethods(); + public List getPaymentMethodIds() { + return paymentAccountsService.getPaymentMethodIds(); } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/bisq/core/api/CorePaymentAccountsService.java b/core/src/main/java/bisq/core/api/CorePaymentAccountsService.java index 8d8dc3f42ad..b27abfeaf47 100644 --- a/core/src/main/java/bisq/core/api/CorePaymentAccountsService.java +++ b/core/src/main/java/bisq/core/api/CorePaymentAccountsService.java @@ -78,8 +78,8 @@ Set getPaymentAccounts() { return user.getPaymentAccounts(); } - List getPaymentMethods() { - return PaymentMethod.getPaymentMethods().stream() + List getPaymentMethodIds() { + return getPaymentMethods().stream() .filter(paymentMethod -> !paymentMethod.isAsset()) .sorted(Comparator.comparing(PaymentMethod::getId)) .collect(Collectors.toList()); diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcPaymentAccountsService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcPaymentAccountsService.java index 64175f3d0ff..898219ac7c3 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcPaymentAccountsService.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcPaymentAccountsService.java @@ -72,7 +72,7 @@ public void getPaymentAccounts(GetPaymentAccountsRequest req, @Override public void getPaymentMethods(GetPaymentMethodsRequest req, StreamObserver responseObserver) { - var paymentMethods = coreApi.getPaymentMethods().stream() + var paymentMethods = coreApi.getPaymentMethodIds().stream() .map(PaymentMethod::toProtoMessage) .collect(Collectors.toList()); var reply = GetPaymentMethodsReply.newBuilder()