adamsaghy commented on PR #5498: URL: https://github.com/apache/fineract/pull/5498#issuecomment-4032939789
> @adamsaghy i see your concern let me explain what happened here. > > The change was forced by a type mismatch between two different generated classes: > > * `GetLoansLoanIdDisbursementDetails.getPrincipal()` returns `BigDecimal` — declared as `public BigDecimal principal` in `LoansApiResourceSwagger.java` line 416. This is the GET response object we are reading from. > * `DisbursementDetail.principal()` accepts `Double` — declared as `public Double principal` in `LoanDisbursementDetailApiResourceSwagger.java` line 53. This is the request object we are writing into for `addAndDeleteDisbursementDetail`. > > Without `.doubleValue()` the code does not compile — `BigDecimal cannot be converted to Double`. > > The original line introduced in `fb65019ea` passed `getPrincipal()` directly with no conversion. That was a latent type mismatch that compiled under an older generated client state but is a compile error now. This PR makes the conversion explicit and correct. > > Verified locally: > > * Removing `.doubleValue()` → `BUILD FAILED: incompatible types: BigDecimal cannot be converted to Double` > * Keeping `.doubleValue()` → `BUILD SUCCESSFUL` > > If the project prefers `DisbursementDetail.principal` to be `BigDecimal` instead of `Double`, the right fix is changing `LoanDisbursementDetailApiResourceSwagger.java` line 53 from `public Double principal` to `public BigDecimal principal` — but that is a separate change outside this PR's scope. Yes, please. Use BigDecimal instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
