gemini-code-assist[bot] commented on PR #37791:
URL: https://github.com/apache/beam/pull/37791#issuecomment-4013781609

   ## 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 significantly enhances code quality and maintainability by 
activating three new ErrorProne checks: `JavaUtilDate`, 
`TimeUnitConversionChecker`, and `InvalidThrows`. The changes involve a 
widespread migration from the legacy `java.util.Date` API to the more modern 
and robust `java.time` package, improving date and time handling across the 
codebase. Additionally, unnecessary `@throws` declarations were removed, and 
specific warnings were suppressed where appropriate, ensuring a cleaner and 
more accurate codebase.
   
   ### Highlights
   
   * **ErrorProne Checks Enabled**: Enabled three new ErrorProne checks: 
"JavaUtilDate", "TimeUnitConversionChecker", and "InvalidThrows", by removing 
them from the suppressed checks list in the build configuration.
   * **Java Date/Time API Modernization**: Addressed numerous violations of the 
"JavaUtilDate" check by migrating usage of the legacy `java.util.Date` API to 
the modern `java.time` package (e.g., `LocalDateTime`, `Instant`) across 
various files.
   * **Javadoc Cleanup**: Resolved "InvalidThrows" violations by removing 
unnecessary `@throws` declarations from Javadoc comments in several methods.
   * **Warning Suppressions**: Introduced `@SuppressWarnings` annotations for 
"JavaUtilDate" and "TimeUnitConversionChecker" in specific instances where 
immediate migration was not feasible or where the usage was deemed acceptable 
for testing/logging purposes.
   
   🧠 **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 "InvalidThrows", "JavaUtilDate", and 
"TimeUnitConversionChecker" from the list of suppressed ErrorProne checks, 
effectively enabling them.
       * Corrected duplicate entries for "InvalidParam" and 
"JavaTimeDefaultTimeZone" in the suppressed checks list.
   * 
**examples/java/src/main/java/org/apache/beam/examples/complete/datatokenization/utils/SchemasUtils.java**
       * Removed an unnecessary `@throws IOException` from the 
`getGcsFileAsString` method's Javadoc.
   * 
**examples/java/src/test/java/org/apache/beam/examples/WindowedWordCountIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp generation in 
test output filenames.
   * **examples/java/src/test/java/org/apache/beam/examples/WordCountIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp generation in 
test output filenames.
   * 
**examples/java/src/test/java/org/apache/beam/examples/complete/TfIdfIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp generation in 
test output filenames.
   * 
**examples/java/src/test/java/org/apache/beam/examples/complete/TopWikipediaSessionsIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp generation in 
test output filenames.
   * 
**examples/java/src/test/java/org/apache/beam/examples/cookbook/DistinctExampleIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp generation in 
test output filenames.
   * 
**examples/java/src/test/java/org/apache/beam/examples/cookbook/JoinExamplesIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp generation in 
test output filenames.
   * 
**examples/java/twitter/src/main/java/org/apache/beam/examples/twitterstreamgenerator/ReadFromTwitterDoFn.java**
       * Updated `Instant.ofEpochMilli` to correctly convert 
`status.getCreatedAt()` from `java.util.Date` to `Instant` using 
`toInstant().toEpochMilli()`.
   * 
**examples/java/twitter/src/test/java/org/apache/beam/examples/twitterstreamgenerator/ReadFromTwitterDoFnTest.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the `setUp` method to 
suppress the ErrorProne warning.
   * 
**it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/dataflow/DirectRunnerClient.java**
       * Removed `java.util.Date` import and replaced its usage with 
`java.time.Instant.now().toEpochMilli()` for job ID generation.
   * 
**runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsLogger.java**
       * Removed `java.util.Date` import and replaced its usage with 
`java.time.Instant.ofEpochMilli()` for logging the last reported time.
   * 
**runners/flink/2.0/src/test/java/org/apache/beam/runners/flink/FlinkRequiresStableInputTest.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for output directory naming in 
tests.
   * 
**runners/flink/src/test/java/org/apache/beam/runners/flink/FlinkRequiresStableInputTest.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for output directory naming in 
tests.
   * 
**runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/logging/DataflowWorkerLoggingHandler.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the `get` method of 
`FileOutputStreamFactory`.
   * 
**runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorkerTest.java**
       * Added `@SuppressWarnings("TimeUnitConversionChecker")` to the class 
declaration to suppress the ErrorProne warning.
   * 
**runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/artifact/ArtifactStagingService.java**
       * Removed an unnecessary `@throws IOException` from the `offer` method's 
Javadoc.
   * 
**sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/TransformUpgrader.java**
       * Removed an unnecessary `@throws Exception` from the 
`upgradeTransformsViaTransformService` method's Javadoc.
   * 
**sdks/java/core/src/test/java/org/apache/beam/sdk/RequiresStableInputIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for output directory naming in 
tests.
   * 
**sdks/java/core/src/test/java/org/apache/beam/sdk/testing/TestPipelineTest.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for timestamp formatting in a 
Hamcrest matcher.
   * 
**sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtilIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for filename generation in 
tests.
   * 
**sdks/java/extensions/sql/jdbc/src/test/java/org/apache/beam/sdk/extensions/sql/jdbc/BeamSqlLineIT.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the 
`convertTimestampToMillis` method.
   * 
**sdks/java/extensions/zetasketch/src/test/java/org/apache/beam/sdk/extensions/zetasketch/BigQueryHllSketchCompatibilityIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for dataset ID generation in 
tests.
   * 
**sdks/java/io/azure/src/main/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystem.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the `generateSasToken` 
method.
   * 
**sdks/java/io/common/src/main/java/org/apache/beam/sdk/io/common/DatabaseTestHelper.java**
       * Replaced `java.util.Date` and `SimpleDateFormat` with 
`java.time.LocalDateTime`, `java.time.ZoneId`, and 
`java.time.format.DateTimeFormatter` for test table name generation.
   * 
**sdks/java/io/file-based-io-tests/src/test/java/org/apache/beam/sdk/io/common/FileBasedIOITHelper.java**
       * Removed `java.util.Date` import and replaced its usage with 
`java.time.Instant.now().toEpochMilli()` for timestamp suffix appending.
   * 
**sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HttpHealthcareApiClient.java**
       * Removed unnecessary `@throws ParseException` and `@throws IOException` 
declarations from method Javadoc.
   * 
**sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/mapper/ChangeStreamRecordMapper.java**
       * Removed an unnecessary `@throws InvalidProtocolBufferException` from 
the `toChangeStreamRecords` method's Javadoc.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableReadIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for table ID generation in 
tests.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableReadSchemaTransformProviderIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for table ID generation in 
tests.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableServiceImplTest.java**
       * Removed unnecessary `@throws InterruptedException` declarations from 
method Javadoc.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableSimpleWriteSchemaTransformProviderIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for table ID generation in 
tests.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for table ID generation in 
tests.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProviderIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for table ID generation in 
tests.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1Test.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the 
`makeLatestTimestampResponse` method.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/storage/GcsKmsKeyIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for filename generation in 
tests.
   * 
**sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/storage/GcsMatchIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for folder naming in tests.
   * 
**sdks/java/io/influxdb/src/test/java/org/apache/beam/sdk/io/influxdb/InfluxDbIOTest.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the `mockResult` method.
   * 
**sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcUtil.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the 
`getPreparedStatementSetCaller` method.
   * 
**sdks/java/io/jdbc/src/test/java/org/apache/beam/sdk/io/jdbc/JdbcIOTest.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the 
`testGetPreparedStatementSetCallerForLogicalTypes` method.
       * Updated `setTimestamp` call to use `cal.getTimeInMillis()` instead of 
`cal.getTime().getTime()`.
   * 
**sdks/java/io/mongodb/src/main/java/org/apache/beam/sdk/io/mongodb/MongoDbGridFSIO.java**
       * Updated `Instant` creation to use `toInstant().toEpochMilli()` for 
`gridFSFile.getUploadDate()`.
   * 
**sdks/java/io/mongodb/src/test/java/org/apache/beam/sdk/io/mongodb/MongoDBIOIT.java**
       * Removed `java.util.Date` import and replaced its usage with 
`java.time.Instant.now().toEpochMilli()` for collection naming in tests.
   * 
**sdks/java/io/rabbitmq/src/main/java/org/apache/beam/sdk/io/rabbitmq/RabbitMqMessage.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to three constructors 
(`RabbitMqMessage(byte[] body)`, `RabbitMqMessage(String routingKey, 
GetResponse delivery)`, `RabbitMqMessage(String routingKey, byte[] body, 
AMQP.BasicProperties props)`).
   * 
**sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeIO.java**
       * Replaced `java.util.Date` and `SimpleDateFormat` with 
`java.time.LocalDateTime`, `java.time.ZoneId`, and 
`java.time.format.DateTimeFormatter` for temporary directory naming.
   * 
**sdks/java/testing/jpms-tests/src/test/java/org/apache/beam/sdk/jpmstests/JpmsIT.java**
       * Replaced `java.util.Date` imports and usage with 
`java.time.LocalDateTime` and `java.time.ZoneId` for output directory naming in 
tests.
   * 
**sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/BeamSqlEnvRunner.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the 
`printExecutionSummary` method.
   * 
**sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/SqlTransformRunner.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the 
`printExecutionSummary` method.
   * 
**sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/TpcdsParametersReader.java**
       * Removed unnecessary `@throws Exception` declarations from method 
Javadoc.
   * 
**sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/TpcdsRunResult.java**
       * Added `@SuppressWarnings("JavaUtilDate")` to the `getStartDate` and 
`getEndDate` methods.
   </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]

Reply via email to