Skip to content

Conversation

@Harsh-Srivastav123
Copy link
Contributor

Description

This PR refactors the LoanStatus.fromInt method to modernize the code by:

  • Adding null safety: The method now immediately returns LoanStatus.INVALID when the input is null.
  • Using the new arrow syntax (->): This simplifies the switch code and prevents fall-through.
  • Adding a default case: Ensures that any unexpected or unmapped statusValue results in LoanStatus.INVALID.
  • Java 14+ compatibility: The refactored switch expression is fully compatible with Java 14 and above.

Ignore if these details are present on the associated Apache Fineract JIRA ticket.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

…ional switch-case statement with a modern switch expression, improving code readability and efficiency.
@IOhacker
Copy link
Contributor

IOhacker commented Mar 3, 2025

LGTM

@adamsaghy
Copy link
Contributor

@Harsh-Srivastav123 FINERACT-2081 was a story to cover minor changes in 1.11. Since this version of release process started, we cannot use this story anymore. Kindly use the https://issues.apache.org/jira/browse/FINERACT-2181 from now on for minor changes which will be part of 1.12.

@Harsh-Srivastav123 Harsh-Srivastav123 changed the title FINERACT-2081: Refactored LoanStatus.fromInt using switch expression enhancements FINERACT-2181: Refactored LoanStatus.fromInt using switch expression enhancements Mar 4, 2025
@Harsh-Srivastav123
Copy link
Contributor Author

Harsh-Srivastav123 commented Mar 4, 2025

@adamsaghy I've updated the PR as per your suggestions. Could you please review the changes?
https://issues.apache.org/jira/browse/FINERACT-2181

@adamsaghy adamsaghy merged commit d826913 into apache:develop Mar 4, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants