gemini-code-assist[bot] commented on PR #37792: URL: https://github.com/apache/beam/pull/37792#issuecomment-4013793464
## 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 resolves Error Prone's `AutoValueBoxedValues` warnings throughout the codebase by refactoring AutoValue instances and builders to utilize primitive types instead of their boxed counterparts. This change improves code efficiency, reduces the risk of null pointer exceptions, and maintains code consistency through standard formatting. ### Highlights * **AutoValue Boxed Values**: This PR addresses `AutoValueBoxedValues` warnings by converting boxed types (e.g., `Integer`, `Boolean`) to their primitive equivalents (e.g., `int`, `boolean`) in AutoValue classes and builders. * **Codebase Refactoring**: Refactored AutoValue instances and builders across multiple SDKs and integration tests to use primitive types, enhancing code efficiency and reducing potential null pointer exceptions. * **Compatibility and Formatting**: Ensured compatibility by removing unnecessary null checks and applied standard Groovy and Java code formatting using Spotless. 🧠**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 `AutoValueBoxedValues` from the disabled checks list. * Added `-Xep:AutoValueBoxedValues:WARN` to errorproneArgs to enable the warning. * **examples/java/src/main/java/org/apache/beam/examples/complete/datatokenization/utils/CsvConverters.java** * Converted `hasHeaders` property from `Boolean` to `boolean`. * Updated builder method `setHasHeaders` to accept a `boolean`. * Removed null check for `hasHeaders` in the `build` method. * **it/clickhouse/src/main/java/org/apache/beam/it/clickhouse/conditions/ClickHouseRowsCheck.java** * Changed `minRows` property from `Integer` to `int`. * Updated builder method `setMinRows` to accept an `int`. * **it/datadog/src/main/java/org/apache/beam/beam/it/datadog/conditions/DatadogLogEntriesCheck.java** * Modified `minEntries` property from `Integer` to `int`. * Updated builder method `setMinEntries` to accept an `int`. * **it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigquery/conditions/BigQueryRowsCheck.java** * Changed `minRows` property from `Integer` to `int`. * Updated builder method `setMinRows` to accept an `int`. * **it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/pubsub/conditions/PubsubMessagesCheck.java** * Modified `minMessages` property from `Integer` to `int`. * Updated builder method `setMinMessages` to accept an `int`. * **it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigquery/BigQueryStreamingLT.java** * Converted `getMinutes`, `getByteSizePerField`, `getNumFields`, and `getRowsPerSecond` properties from `Integer` to `int`. * **it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigtable/BigTableIOLT.java** * Changed `getNumRows` property from `Long` to `long`. * Modified `getPipelineTimeout` and `getValueSizeBytes` properties from `Integer` to `int`. * **it/kafka/src/test/java/org/apache/beam/it/kafka/KafkaIOLT.java** * Converted `getNumRows` property from `Long` to `long`. * Modified `getPipelineTimeout` and `getRowSize` properties from `Integer` to `int`. * **it/mongodb/src/main/java/org/apache/beam/it/mongodb/conditions/MongoDBDocumentsCheck.java** * Changed `minDocuments` property from `Integer` to `int`. * Updated builder method `setMinDocuments` to accept an `int`. * **it/splunk/src/main/java/org/apache/beam/it/splunk/conditions/SplunkEventsCheck.java** * Modified `minEvents` property from `Integer` to `int`. * Updated builder method `setMinEvents` to accept an `int`. * **runners/java-fn-execution/src/test/java/org/apache/beam/runners/fnexecution/wire/CommonCoderTest.java** * Changed `getNonDeterministic` property from `Boolean` to `boolean`. * **sdks/java/core/src/main/java/org/apache/beam/sdk/providers/GenerateSequenceSchemaTransformProvider.java** * Removed unnecessary import of `checkNotNull`. * Converted `getElements` and `getStart` properties from `Long` to `long`. * Updated builder methods `setElements` and `setStart` to accept `long`. * Removed null check for `start` in the `validate` method. * **sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java** * Changed `getNullable` property from `Boolean` to `boolean`. * Updated builder method `setNullable` to accept a `boolean`. * Updated `equals` and `typesEqual` methods to directly compare `boolean` values instead of using `Objects.equals`. * **sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/Group.java** * Changed `getFewKeys` property from `Boolean` to `boolean`. * Updated builder method `setFewKeys` to accept a `boolean`. * **sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/AutoValueSchemaTest.java** * Converted `getLng` property from `Long` to `long` in `SchemaFieldNumberSimpleClass` and `SchemaFieldDescriptionSimpleClass`. * **sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/SchemaCoderTest.java** * Modified `getInt32` and `getInt64` properties from `Integer` and `Long` to `int` and `long` in `SimpleAutoValue`. * Updated `SimpleAutoValue.of` method to accept `int` and `long`. * **sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/transforms/SelectTest.java** * Changed `getField2` and `getField3` properties from `Integer` and `Double` to `int` and `double` in `Schema1`. * Modified `getField3` property from `Double` to `double` in `Schema1Selected` and `Schema1SelectedRenamed`. * **sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/transforms/TypedSchemaTransformProviderTest.java** * Changed `getIntegerField` property from `Integer` to `int` in `Configuration`. * **sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ParDoSchemaTest.java** * Modified `getIntegerField` property from `Integer` to `int` in `Inferred`, `Inferred2`, and `ForExtraction`. * **sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/ToJsonTest.java** * Changed `getHeight` and `getKnowsJavascript` properties from `Integer` and `Boolean` to `int` and `boolean` in `Person`. * Updated `Person.of` method to accept `int` and `boolean`. * **sdks/java/expansion-service/src/test/java/org/apache/beam/sdk/expansion/service/ExpansionServiceTest.java** * Converted `getFoo` property from `Long` to `long` in `TestConfigSimpleSchema`. * **sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java** * Updated `genericFromBeamField` method to directly compare `boolean` values. * **sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPDeidentifyText.java** * Modified `getBatchSizeBytes` property from `Integer` to `int`. * Updated builder method `setBatchSizeBytes` to accept an `int`. * **sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPInspectText.java** * Modified `getBatchSizeBytes` property from `Integer` to `int`. * Updated builder method `setBatchSizeBytes` to accept an `int`. * **sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPReidentifyText.java** * Modified `getBatchSizeBytes` property from `Integer` to `int`. * Updated builder method `setBatchSizeBytes` to accept an `int`. * **sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/RecommendationAIImportCatalogItems.java** * Modified `batchSize` property from `Integer` to `int`. * Updated `withBatchSize` method and builder method `setBatchSize` to accept an `int`. * **sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/RecommendationAIImportUserEvents.java** * Modified `batchSize` property from `Integer` to `int`. * Updated `withBatchSize` method and builder method `setBatchSize` to accept an `int`. * **sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlAlterTable.java** * Updated `unparseColumn` method to directly check `boolean` value instead of using `Objects.equals`. * **sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/parser/SqlCreateExternalTable.java** * Updated `unparseColumn` method to directly check `boolean` value instead of using `Objects.equals`. * **sdks/java/extensions/timeseries/src/main/java/org/apache/beam/sdk/extensions/timeseries/FillGaps.java** * Converted `getMaxGapFillBuckets` property from `Long` to `long`. * Updated builder method `setMaxGapFillBuckets` and `withMaxGapFillBuckets` method to accept a `long`. * **sdks/java/extensions/zetasketch/src/main/java/org/apache/beam/sdk/extensions/zetasketch/ApproximateCountDistinct.java** * Modified `getPrecision` property from `Integer` to `int`. * Updated `withPercision` methods and builder method `setPrecision` to accept an `int`. * **sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/dynamodb/testing/DynamoDBIOIT.java** * Updated `buildWriteRequest` method to convert `row.id()` to a string using `String.valueOf()`. * **sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/kinesis/KinesisIOWriteTest.java** * Updated `withPartitioner` method to convert `row.id()` to a string using `String.valueOf()`. * **sdks/java/io/cdap/src/test/java/org/apache/beam/sdk/io/cdap/TestRowDBWritable.java** * Modified `id` property from `Integer` to `int`. * **sdks/java/io/common/src/main/java/org/apache/beam/sdk/io/common/SchemaAwareJavaBeans.java** * Modified `allPrimitiveDataTypes` method to accept primitive types. * Modified `byteType` method to accept primitive type. * Modified `AllPrimitiveDataTypes` class to use primitive types. * Modified `ByteType` class to use primitive type. * **sdks/java/io/common/src/main/java/org/apache/beam/sdk/io/common/TestRow.java** * Modified `id` property from `Integer` to `int`. * Updated `create` and `fromSeed` methods to accept `int`. * Updated `compareTo` method to use `Integer.compare`. * **sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogEventPublisher.java** * Modified `maxElapsedMillis` property from `Integer` to `int`. * Updated builder method `setMaxElapsedMillis` to accept an `int`. * **sdks/java/io/debezium/src/main/java/org/apache/beam/sdk/io/debezium/DebeziumReadSchemaTransformProvider.java** * Modified `getPort` property from `Integer` to `int`. * Updated builder method `setPort` to accept an `int`. * **sdks/java/io/elasticsearch/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIO.java** * Changed `getHasError` from `Boolean` to `boolean`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java** * Changed `getWithTemplateCompatibility` and `getUseAvroLogicalTypes` properties from `Boolean` to `boolean`. * Updated builder methods `setWithTemplateCompatibility` and `setUseAvroLogicalTypes` to accept a `boolean`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTranslation.java** * Removed null checks for boolean properties. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/WritePartition.java** * Changed `isFirstPane` from `Boolean` to `boolean`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/WriteTables.java** * Changed `isFirstPane` from `Boolean` to `boolean`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java** * Changed `getBatching` from `Boolean` to `boolean`. * Updated builder method `setBatching` to accept a `boolean`. * **sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/BigqueryMatcher.java** * Changed `getUsingStandardSql` from `Boolean` to `boolean`. * Updated `createQuery` method to accept a `boolean`. * **sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIOTest.java** * Changed `Boolean` properties to `boolean` in `FailureOptions`. * **sdks/java/io/hadoop-format/src/test/java/org/apache/beam/sdk/io/hadoop/format/TestRowDBWritable.java** * Modified `id` from `Integer` to `int`. * **sdks/java/io/hbase/src/test/java/org/apache/beam/sdk/io/hbase/HBaseIOIT.java** * Updated `ConstructMutations` DoFn to convert `row.id()` to a string. * **sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java** * Changed `getReturnResults` from `Boolean` to `boolean`. * **sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaSourceDescriptor.java** * Modified `getPartition` from `Integer` to `int`. * Updated `create` method to accept an `int`. * **sdks/java/io/rrio/src/main/java/org/apache/beam/sdk/io/requestresponse/Call.java** * Changed `getShouldRepeat` from `Boolean` to `boolean`. * **sdks/java/io/rrio/src/main/java/org/apache/beam/sdk/io/requestresponse/Monitoring.java** * Changed all `getCount...` properties from `Boolean` to `boolean`. * **sdks/java/io/rrio/src/test/java/org/apache/beam/sdk/io/requestresponse/RequestResponseIOTest.java** * Modified `getALong` from `Long` to `long` in `Request` and `Response`. * **sdks/java/io/singlestore/src/test/java/org/apache/beam/sdk/io/singlestore/TestHelper.java** * Updated `TestUserDataMapper` to convert `element.id()` to a string. * **sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/data/Solace.java** * Changed `getPublished` from `Boolean` to `boolean`. * **sdks/java/io/splunk/src/main/java/org/apache/beam/sdk/io/splunk/HttpEventPublisher.java** * Changed `disableCertificateValidation` and `enableGzipHttpCompression` to be nullable. * **sdks/java/managed/src/main/java/org/apache/beam/sdk/managed/testing/TestSchemaTransformProvider.java** * Modified `getExtraInteger` property from `Integer` to `int`. </details> <details> <summary><b>Activity</b></summary> * The PR author, stankiewicz, has refactored AutoValue instances and builders to use primitive types instead of their boxed equivalents. * Compatibility concerns were addressed by dropping superfluous null checks on now-primitive values. * Standard Groovy and standard Java code formatting was applied via Spotless. </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]
