gemini-code-assist[bot] commented on PR #37760: URL: https://github.com/apache/beam/pull/37760#issuecomment-3996595275
## 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 aims to improve code readability and maintainability by enforcing a stricter import style. It activates the `BadImport` ErrorProne check, which prevents direct imports of commonly named nested classes or static methods, thereby encouraging developers to use fully qualified names. This change was systematically applied across various modules to resolve the newly enforced rule violations. ### Highlights * **ErrorProne Check Enabled**: The `BadImport` ErrorProne check has been enabled across the codebase to enforce clearer import practices. * **Import Violations Fixed**: Violations of the `BadImport` rule were fixed by replacing unqualified imports of nested classes or static methods with their fully qualified parent prefixes. * **Affected Modules**: Changes were applied to `sdks/java/core`, `sdks/java/extensions` (Avro, Euphoria), `sdks/java/io` (GCP/BigQuery/Bigtable, Snowflake), and `runners` (Dataflow, Spark, JobService, fn-execution). 🧠**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 "BadImport" from the list of disabled ErrorProne checks. * **runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorkerTest.java** * Removed an unqualified import for `Windmill.Timer.Type`. * Qualified the usage of `Type.WATERMARK` to `Windmill.Timer.Type.WATERMARK`. * **runners/java-fn-execution/src/test/java/org/apache/beam/runners/fnexecution/control/DefaultJobBundleFactoryTest.java** * Removed an unqualified import for `EnvironmentFactory.Provider`. * Qualified the type declaration for `Map<String, Provider>` to `Map<String, EnvironmentFactory.Provider>`. * **runners/java-job-service/src/main/java/org/apache/beam/runners/jobsubmission/JobInvocation.java** * Removed an unqualified import for `JobApi.JobState.Enum`. * Qualified references to `Enum.DONE`, `Enum.RUNNING`, `Enum.CANCELLED`, `Enum.FAILED` with `JobState.Enum`. * **runners/spark/3/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java** * Removed a static import for `EncoderFactory.newInstance`. * Qualified the `newInstance` method call with `EncoderFactory`. * **runners/spark/src/main/java/org/apache/beam/runners/spark/util/CachedSideInputReader.java** * Removed unqualified imports for `SideInputStorage.Key` and `SideInputStorage.Value`. * Qualified the usage of `Key` and `Value` with `SideInputStorage`. * **sdks/java/core/src/main/java/org/apache/beam/sdk/fn/channel/AddHarnessIdInterceptor.java** * Removed an unqualified import for `Metadata.Key`. * Qualified the declaration of `ID_KEY` with `Metadata.Key`. * **sdks/java/core/src/main/java/org/apache/beam/sdk/fn/server/GrpcContextHeaderAccessorProvider.java** * Removed an unqualified import for `Metadata.Key`. * Qualified the declaration of `WORKER_ID_KEY` with `Metadata.Key`. * **sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java** * Removed an unqualified import for `Schema.Type`. * Qualified all references to `Type` with `org.apache.avro.Schema.Type`. * **sdks/java/extensions/avro/src/test/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtilsTest.java** * Removed an unqualified import for `Schema.Type`. * Qualified all references to `Type` with `org.apache.avro.Schema.Type` in test cases. * **sdks/java/extensions/euphoria/src/main/java/org/apache/beam/sdk/extensions/euphoria/core/client/operator/FullJoin.java** * Removed an unqualified import for `Join.Type`. * Qualified the usage of `Type.FULL` with `Join.Type.FULL`. * **sdks/java/extensions/euphoria/src/main/java/org/apache/beam/sdk/extensions/euphoria/core/client/operator/RightJoin.java** * Removed an unqualified import for `Join.Type`. * Qualified the usage of `Type.RIGHT` with `Join.Type.RIGHT`. * **sdks/java/extensions/euphoria/src/test/java/org/apache/beam/sdk/extensions/euphoria/core/translate/SingleJvmAccumulatorProviderTest.java** * Removed an unqualified import for `SingleJvmAccumulatorProvider.Factory`. * Qualified the declaration of `accFactory` with `SingleJvmAccumulatorProvider.Factory`. * **sdks/java/extensions/euphoria/src/test/java/org/apache/beam/sdk/extensions/euphoria/core/translate/collector/SingleValueCollectorTest.java** * Removed an unqualified import for `SingleJvmAccumulatorProvider.Factory`. * Qualified the declaration of `accumulatorFactory` with `SingleJvmAccumulatorProvider.Factory`. * **sdks/java/io/gcp/bigtable/BigtableSharedClientTest.java** * Removed an unqualified import for `BigtableDataSettings.Builder`. * Qualified the generic type and method signature with `BigtableDataSettings.Builder`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryAvroUtils.java** * Removed an unqualified import for `Schema.Type`. * Qualified references to `Type` with `Schema.Type`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWriteUnshardedRecords.java** * Removed an unqualified import for `WriteStream.Type`. * Qualified the usage of `Type.PENDING` with `WriteStream.Type.PENDING`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWritesShardedRecords.java** * Removed an unqualified import for `WriteStream.Type`. * Qualified the usage of `Type.BUFFERED` with `WriteStream.Type.BUFFERED`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java** * Removed an unqualified import for `FieldDescriptorProto.Type`. * Qualified references to `Type` with `FieldDescriptorProto.Type` in type maps and field descriptors. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/FakeDatasetService.java** * Removed an unqualified import for `WriteStream.Type`. * Qualified references to `Type` with `WriteStream.Type` in class fields and method calls. * **sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/AvroGenericRecordToStorageApiProtoTest.java** * Removed an unqualified import for `FieldDescriptorProto.Type`. * Qualified references to `Type` with `FieldDescriptorProto.Type` in field descriptors and type maps. * **sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BeamRowToStorageApiProtoTest.java** * Removed an unqualified import for `FieldDescriptorProto.Type`. * Qualified references to `Type` with `FieldDescriptorProto.Type` in field descriptors and type maps. * **sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOWriteTest.java** * Removed a static import for `WriteTables.ResultCoder.INSTANCE`. * Instantiated `WriteTables.ResultCoder` directly in `setCoder`. * Qualified `WriteTables.ResultCoder.INSTANCE` in `IterableCoder.of`. * **sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProtoTest.java** * Removed an unqualified import for `FieldDescriptorProto.Type`. * Qualified references to `Type` with `FieldDescriptorProto.Type` in field descriptors and type maps. * **sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/SnowflakeDataType.java** * Removed an unqualified import for `JsonSubTypes.Type`. * Qualified the usage of `Type` within `@JsonSubTypes` annotation with `JsonSubTypes.Type`. </details> <details> <summary><b>Activity</b></summary> * The pull request was initiated to enable the `BadImport` ErrorProne check. * The author then proceeded to fix all identified violations of this check across various Java modules. </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]
