[ErrorProne] Fix AutoValueBoxedValues warnings across the codebase#37792
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves Error Prone's Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
kennknowles
left a comment
There was a problem hiding this comment.
As long as this doesn't change semantics in problematic ways, this is fine.
A couple cases where it could be a problem:
- There is no default and the field is required, so it must be provided or set before calling
build(). What happens? Will autovalue (incorrectly) set it to Java's default value? - Some field is actually meant to be nullable but we wrote the class wrong and suppressed warnings. Then we will end up having to change it back.
But the overall change I am fine with, basically. Just need to make sure it isn't breaking things.
|
|
||
| abstract Optional<Boolean> getCountResponses(); | ||
|
|
||
| abstract Optional<Boolean> getCountCalls(); |
There was a problem hiding this comment.
This one looks like it needs to be a @Nullable Boolean. Clearly there is an intention that it could have three states: absent, true, or false
There was a problem hiding this comment.
actually, it's required. they validate value and on built() they set it to false if there is no value so in the end it's two states.
2a95aa1 to
21089cd
Compare
21089cd to
1d28eab
Compare
1d28eab to
5a0728d
Compare
|
/gemini review |
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
There was a problem hiding this comment.
Code Review
This pull request is a large but valuable refactoring to address AutoValueBoxedValues warnings from Error Prone, replacing boxed types with their primitive equivalents across AutoValue classes. This results in cleaner and more efficient code, handling necessary follow-up changes like removing redundant null checks and updating method signatures. A comprehensive security audit found no new security vulnerabilities introduced by these changes. However, I've identified a critical issue in DatadogEventPublisher.java where a checkNotNull call on a new primitive int parameter will cause a compilation failure. Additionally, a couple of minor pre-existing typos could be addressed.
sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogEventPublisher.java
Outdated
Show resolved
Hide resolved
...sketch/src/main/java/org/apache/beam/sdk/extensions/zetasketch/ApproximateCountDistinct.java
Show resolved
Hide resolved
...sketch/src/main/java/org/apache/beam/sdk/extensions/zetasketch/ApproximateCountDistinct.java
Show resolved
Hide resolved
|
Run Portable_Python PreCommit 3.10 |
kennknowles
left a comment
There was a problem hiding this comment.
Got it - I like how you have refactored where defaults are set.
This PR resolves the AutoValueBoxedValues warnings generated by Error Prone by refactoring AutoValue instances and builders to use primitive types instead of their boxed equivalents.
Changes made:
Converted boxed properties to primitive types across AutoValue configurations in multiple SDKs and Integration Test payloads (e.g. Boolean to boolean, Integer to int, etc.).
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.