From 9542e357024335563f268b9600770bb8a3ffb331 Mon Sep 17 00:00:00 2001 From: percyashu Date: Mon, 22 Jun 2020 17:10:25 +0100 Subject: [PATCH] FINERACT-822 Enforce ModifiedButNotUsed check --- fineract-provider/build.gradle | 2 +- .../common/ProvisioningIntegrationTest.java | 2 -- .../common/shares/DividendsIntegrationTests.java | 4 ---- .../LoanScheduleCalculationPlatformServiceImpl.java | 11 ----------- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 98aad47dc..04510a5f0 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -384,7 +384,6 @@ tasks.withType(JavaCompile) { disable( "UnusedVariable", "SameNameButDifferent", - "ModifiedButNotUsed", "TypeParameterUnusedInFormals", "UndefinedEquals", "JdkObsolete", @@ -461,6 +460,7 @@ tasks.withType(JavaCompile) { "UnnecessaryDefaultInEnumSwitch", "UnusedNestedClass", "UnusedMethod", + "ModifiedButNotUsed", "InconsistentCapitalization", "MissingOverride", // "InvalidBlockTag", diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java index 8e568db0f..db2610823 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ProvisioningIntegrationTest.java @@ -74,7 +74,6 @@ public class ProvisioningIntegrationTest { public void testCreateProvisioningCriteria() { ProvisioningTransactionHelper transactionHelper = new ProvisioningTransactionHelper(requestSpec, responseSpec); ArrayList loanProducts = new ArrayList<>(LOANPRODUCTS_SIZE); - List loans = new ArrayList<>(); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); for (int i = 0; i < LOANPRODUCTS_SIZE; i++) { @@ -90,7 +89,6 @@ public class ProvisioningIntegrationTest { LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------"); loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID); LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); - loans.add(loanID); Assertions.assertNotNull(loanID); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java index 95b21a1b8..a4ecbc517 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/shares/DividendsIntegrationTests.java @@ -60,15 +60,11 @@ public class DividendsIntegrationTests { public void testCreateDividends() { DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); final Integer productId = createShareProduct(); - ArrayList clients = new ArrayList<>(); - ArrayList savingAccounts = new ArrayList<>(); ArrayList shareAccounts = new ArrayList<>(); for (int i = 0; i < 5; i++) { final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); - clients.add(clientId); Assertions.assertNotNull(clientId); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); - savingAccounts.add(savingsAccountId); Assertions.assertNotNull(savingsAccountId); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, dates[i], shares[i]); shareAccounts.add(shareAccountId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java index 003b8c72a..ffdc200d6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java @@ -40,7 +40,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.Loan; import org.apache.fineract.portfolio.loanaccount.domain.LoanDisbursementDetails; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleTransactionProcessorFactory; -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.LoanRepaymentScheduleTransactionProcessor; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleData; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData; @@ -183,16 +182,6 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC totalAmount = totalAmount.plus(interestDue); } boolean isNewPaymentRequired = loanRepaymentScheduleInstallment.isInterestDue(currency) || totalPrincipal.isGreaterThanZero(); - final List modifiedTransactions = new ArrayList<>(); - List transactions = loan.retreiveListOfTransactionsPostDisbursementExcludeAccruals(); - for (LoanTransaction loanTransaction : transactions) { - modifiedTransactions.add(LoanTransaction.copyTransactionProperties(loanTransaction)); - } - if (isNewPaymentRequired) { - LoanTransaction ondayPaymentTransaction = LoanTransaction.repayment(null, totalAmount, null, today, null, - DateUtils.getLocalDateTimeOfTenant(), null); - modifiedTransactions.add(ondayPaymentTransaction); - } LoanScheduleModel model = this.loanScheduleAssembler.assembleForInterestRecalculation(loanApplicationTerms, loan.getOfficeId(), loan, loanRepaymentScheduleTransactionProcessor, loan.fetchInterestRecalculateFromDate());