Skip to content

chore: remove lombok dependency from parametermanager and run/idp-sql - #10365

Open
XrossFox wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
XrossFox:dependency-remove-lombok
Open

XrossFox wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
XrossFox:dependency-remove-lombok

Conversation

@XrossFox

@XrossFox XrossFox commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Remove unused org.projectlombok:lombok dependency and compiler annotation processor configuration from parametermanager/pom.xml.
  • Remove org.projectlombok:lombok dependency from run/idp-sql/pom.xml.
  • Update com.google.cloud:spring-cloud-gcp-dependencies from 3.7.7 to 3.9.18 in run/idp-sql/pom.xml so the sample builds and tests pass, as 3.7.7 is not available in our repo.

Fixes b/576281614

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

Compliance & Style

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample

Post-Approval Actions

  • Please merge this PR for me once it is approved

@XrossFox
XrossFox requested review from a team and yoshi-approver as code owners October 28, 2026 23:20
@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Oct 28, 2026
@XrossFox
XrossFox requested a review from a team as a code owner October 28, 2026 23:20
@product-auto-label product-auto-label Bot added the api: run Issues related to the Cloud Run API. label Oct 28, 2026
gemini-code-assist[bot]

This comment was marked as outdated.

@XrossFox
XrossFox force-pushed the dependency-remove-lombok branch from 4575e99 to 7a772fc Compare October 29, 2026 22:26
@XrossFox XrossFox changed the title WIP dependency fixing chore: remove lombok dependency from parametermanager and run/idp-sql Oct 29, 2026
Remove unused org.projectlombok:lombok dependency and compiler annotation processor configuration from parametermanager/pom.xml.
Remove org.projectlombok:lombok dependency from run/idp-sql/pom.xml.
Update com.google.cloud:spring-cloud-gcp-dependencies from 3.7.7 to 3.9.18 in run/idp-sql/pom.xml so the sample builds and tests pass, as 3.7.7 is not available in our repo.
@XrossFox
XrossFox force-pushed the dependency-remove-lombok branch from 74b321c to 318efda Compare October 30, 2026 18:13
@XrossFox XrossFox added the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 30, 2026
@iennae iennae added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2026
@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Oct 30, 2026
@iennae

iennae commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for pulling out the Lombok dependencies!

Because Lombok's @DaTa does a lot of magic under the hood, we just need to add a couple of things back manually to ensure the behavior stays exactly the same:

  1. equals() and hashCode()
    @DaTa was automatically generating these for Vote.java. If Vote objects are ever compared or put into Collections like HashMap/HashSet, dropping them could introduce subtle bugs. Could you generate these methods using your IDE?

  2. Runtime Null-Checks
    Lombok automatically injects runtime null-checks into the constructor and setters for any field annotated with @nonnull. Our manual constructor currently drops this protection. To keep the exact same 'fail-fast' behavior, we should wrap the assignments in Objects.requireNonNull(). For example:

public Vote(String uid, String candidate, Timestamp timeCast) {
    this.uid = Objects.requireNonNull(uid, "uid cannot be null");
    this.candidate = Objects.requireNonNull(candidate, "candidate cannot be null");
    this.timeCast = Objects.requireNonNull(timeCast, "timeCast cannot be null");
}

(We should do the same for the setter methods as well). Let me know what you think!

@iennae iennae added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2026
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2026
@XrossFox

Copy link
Copy Markdown
Contributor Author

Thanks for pulling out the Lombok dependencies!

Because Lombok's @DaTa does a lot of magic under the hood, we just need to add a couple of things back manually to ensure the behavior stays exactly the same:

  1. equals() and hashCode()
    @DaTa was automatically generating these for Vote.java. If Vote objects are ever compared or put into Collections like HashMap/HashSet, dropping them could introduce subtle bugs. Could you generate these methods using your IDE?
  2. Runtime Null-Checks
    Lombok automatically injects runtime null-checks into the constructor and setters for any field annotated with @nonnull. Our manual constructor currently drops this protection. To keep the exact same 'fail-fast' behavior, we should wrap the assignments in Objects.requireNonNull(). For example:
public Vote(String uid, String candidate, Timestamp timeCast) {
    this.uid = Objects.requireNonNull(uid, "uid cannot be null");
    this.candidate = Objects.requireNonNull(candidate, "candidate cannot be null");
    this.timeCast = Objects.requireNonNull(timeCast, "timeCast cannot be null");
}

(We should do the same for the setter methods as well). Let me know what you think!

Working on it

@iennae iennae added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2026
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2026
@XrossFox

Copy link
Copy Markdown
Contributor Author

I've added the changes for null checks and implemented the overrides for hashCode and equals. Tested locally, that it's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: run Issues related to the Cloud Run API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants