gemini-code-assist[bot] commented on PR #37761: URL: https://github.com/apache/beam/pull/37761#issuecomment-3996719714
## Summary of Changes Hello, I'm Gemini Code Assist[^1]! 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 enhances code safety by enforcing the `MutablePublicArray` Error Prone check. This prevents the exposure of mutable arrays as public constants, which could lead to unintended state changes. The changes involve updating the build configuration to enable the check and refactoring existing code to comply with this new standard, primarily by adjusting the visibility of static final arrays and modifying their usage patterns. ### Highlights * **Error Prone Check Enabled**: The `MutablePublicArray` Error Prone check has been enabled by removing it from the disabled checks list in `BeamModulePlugin.groovy`. * **Array Visibility Refactoring**: Several `public static final` array declarations in `TestUtils.java` were changed to `private static final` to prevent external modification, aligning with the `MutablePublicArray` rule. * **Updated Array Usage**: References to the previously public arrays in various test files (e.g., `TextIOReadTest`, `TextIOWriteTest`, `CreateTest`, `FlattenTest`, `ContextualTextIOTest`) were updated to use the corresponding `List.toArray()` method, ensuring immutability at the public interface. 🧠**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](https://codeassist.google/code-review/login) to enable Memory in your admin console.** <details> <summary><b>Changelog</b></summary> * **buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy** * Removed 'MutablePublicArray' from the list of disabled Error Prone checks. * **sdks/java/core/src/test/java/org/apache/beam/sdk/TestUtils.java** * Changed 'NO_LINES_ARRAY', 'LINES_ARRAY', 'LINES2_ARRAY', 'NO_INTS_ARRAY', and 'INTS_ARRAY' from public to private. * **sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOReadTest.java** * Updated static imports from 'LINES_ARRAY' and 'NO_LINES_ARRAY' to 'LINES' and 'NO_LINES' respectively. * Modified calls to 'runTestRead' to pass 'LINES.toArray(new String[0])' and 'NO_LINES.toArray(new String[0])' instead of direct array references. * **sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOWriteTest.java** * Updated static imports from 'LINES2_ARRAY', 'LINES_ARRAY', and 'NO_LINES_ARRAY' to 'LINES2', 'LINES', and 'NO_LINES' respectively. * Modified calls to 'runTestWrite' and 'Create.of' to pass 'List.toArray()' results instead of direct array references. * Updated the initialization of 'drunkElems' to use 'LINES2.toArray(new String[0]).length'. * **sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CreateTest.java** * Updated static imports for 'LINES_ARRAY' and 'NO_LINES_ARRAY' to 'LINES' and 'NO_LINES' respectively. * Modified 'PAssert.that(output).containsInAnyOrder' calls to use 'LINES.toArray(new String[0])' and 'NO_LINES.toArray(new String[0])'. * **sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java** * Updated static imports for 'LINES_ARRAY' and 'NO_LINES_ARRAY' to 'LINES' and 'NO_LINES' respectively. * Modified 'PAssert.that(output).containsInAnyOrder' calls to use 'LINES.toArray(new String[0])' and 'NO_LINES.toArray(new String[0])'. * **sdks/java/io/contextualtextio/src/test/java/org/apache/beam/sdk/io/contextualtextio/ContextualTextIOTest.java** * Updated static imports from 'LINES_ARRAY' and 'NO_LINES_ARRAY' to 'LINES' and 'NO_LINES' respectively. * Modified calls to 'runTestRead' and 'runTestReadLineNumsAndFileName' to pass 'List.toArray()' results instead of direct array references. </details> <details> <summary><b>Activity</b></summary> * The pull request was created by stankiewicz. * No human activity (comments, reviews, or progress updates) has been recorded on this pull request yet. </details> <details> <summary><b>Using Gemini Code Assist</b></summary> <br> The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips. <b>Invoking Gemini</b> You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page. Feature | Command | Description --- | --- | --- Code Review | `/gemini review` | Performs a code review for the current pull request in its current state. Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state. Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. Help | `/gemini help` | Displays a list of available commands. <b>Customization</b> 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 `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). <b>Limitations & Feedback</b> Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: 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](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG). <b>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](https://cloud.google.com/products/gemini/code-assist).</b> </details> [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487). -- 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]
