Skip to content

Conversation

Avery-Dunn
Copy link
Contributor

@Avery-Dunn Avery-Dunn commented Apr 30, 2025

Removes the final usages of org.projectlombokfrom the main library, as per #909

This PR makes the following changes:

  • Remove Lombok's EqualsAndHashCode annotation
    • New equals and hashCode methods were added based on the methods generated by Lombok, though refactored for readability
    • Meaningful unit tests would require duplicate classes using the old code, so they were manually tested to confirm the new methods produce the same hashes are the same as the old generated methods
  • Remove final getter and setter annotations and add appropriately named and scoped methods
    • AuthenticationResult appears to have more extensive changes than the other classes, however this is just due to extra some refactoring that groups fields and methods together in a more readable way
  • Changes the scope of the lombok dependency to 'test', which means customers will no longer bring nimbus into their projects because of MSAL
  • A couple tests still use lombok, but this will likely be removed as well in a future PR

@Avery-Dunn Avery-Dunn requested a review from a team as a code owner April 30, 2025 18:26
@Avery-Dunn Avery-Dunn requested a review from Copilot May 7, 2025 18:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes all final usages of org.projectlombok from the MSAL Java library by replacing Lombok annotations with manually implemented methods and refactoring class structures to improve clarity.

  • Removed Lombok-generated annotations and replaced them with explicitly defined getters, equals, hashCode, and builder methods.
  • Adjusted the pom.xml to change the lombok dependency scope from provided to test.
  • Refactored several classes (HttpRequest, ClientSecret, ClientAssertion, AuthenticationResult, AccountCacheEntity, Account) with manual implementations matching the previous Lombok behavior.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/HttpRequest.java Removed Lombok annotations and added manual equals, hashCode, and getters.
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/ClientSecret.java Eliminated Lombok usage and added custom equals/hashCode and accessor.
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/ClientAssertion.java Replaced Lombok annotations with explicit equals and hashCode methods.
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResult.java Replaced Lombok annotations; added builder pattern and manually defined accessors.
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AccountCacheEntity.java Removed Lombok and added manual accessor and mutator methods with equals/hashCode.
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/Account.java Removed Lombok usage and implemented manual equals/hashCode and accessors.
msal4j-sdk/pom.xml Changed lombok dependency scope to test.
Comments suppressed due to low confidence (1)

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResult.java:217

  • [nitpick] The toString method in AuthenticationResultBuilder is concatenating the 'metadata' field without an '=' separator, which may reduce clarity when debugging. Consider updating the concatenation from ", metadata" + this.metadata to ", metadata=" + this.metadata.
public String toString() { return "AuthenticationResult.AuthenticationResultBuilder(accessToken=" + this.accessToken + ", expiresOn=" + this.expiresOn + ", extExpiresOn=" + this.extExpiresOn + ", refreshToken=" + this.refreshToken + ", refreshOn=" + this.refreshOn + ", familyId=" + this.familyId + ", idToken=" + this.idToken + ", accountCacheEntity=" + this.accountCacheEntity + ", environment=" + this.environment + ", scopes=" + this.scopes + ", metadata" + this.metadata + ", isPopAuthorization=" + this.isPopAuthorization + ")";

@Avery-Dunn Avery-Dunn merged commit 7b36cbc into avdunn/nimbus-json May 7, 2025
2 checks passed
@Avery-Dunn Avery-Dunn deleted the avdunn/lombok-final branch June 3, 2025 17:04
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