Skip to content

Commit

Permalink
Avoid codacy issue over use of fully qualified name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ghubstan committed Nov 18, 2020
1 parent ec38152 commit a465261
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/bisq/core/api/CoreApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public Set<PaymentAccount> getPaymentAccounts() {
return paymentAccountsService.getPaymentAccounts();
}

public List<PaymentMethod> getPaymentMethods() {
return paymentAccountsService.getPaymentMethods();
public List<PaymentMethod> getPaymentMethodIds() {
return paymentAccountsService.getPaymentMethodIds();
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Set<PaymentAccount> getPaymentAccounts() {
return user.getPaymentAccounts();
}

List<PaymentMethod> getPaymentMethods() {
return PaymentMethod.getPaymentMethods().stream()
List<PaymentMethod> getPaymentMethodIds() {
return getPaymentMethods().stream()
.filter(paymentMethod -> !paymentMethod.isAsset())
.sorted(Comparator.comparing(PaymentMethod::getId))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void getPaymentAccounts(GetPaymentAccountsRequest req,
@Override
public void getPaymentMethods(GetPaymentMethodsRequest req,
StreamObserver<GetPaymentMethodsReply> responseObserver) {
var paymentMethods = coreApi.getPaymentMethods().stream()
var paymentMethods = coreApi.getPaymentMethodIds().stream()
.map(PaymentMethod::toProtoMessage)
.collect(Collectors.toList());
var reply = GetPaymentMethodsReply.newBuilder()
Expand Down

0 comments on commit a465261

Please sign in to comment.