Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit f7894c0

Browse files
chore: clean up warnings pass 2 (#2846)
Change-Id: Iaff267ffb3ed336aa089d6033e3bb36442feefb8
1 parent a15ba8d commit f7894c0

98 files changed

Lines changed: 532 additions & 452 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google-cloud-bigtable/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
<compilerArgs>
428428
<arg>-XDcompilePolicy=simple</arg>
429429
<arg>--should-stop=ifError=FLOW</arg>
430-
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:MissingSummary:OFF -Xep:InlineMeSuggester:OFF -Xep:AutoValueImmutableFields:OFF -Xep:ObjectEqualsForPrimitives:OFF</arg>
430+
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:MissingSummary:OFF -Xep:InlineMeSuggester:OFF -Xep:AutoValueImmutableFields:OFF -Xep:ObjectEqualsForPrimitives:OFF -Xep:JavaDurationGetSecondsToToSeconds:OFF</arg>
431431

432432
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
433433
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ public ApiFuture<Void> dropAllRowsAsync(String tableId) {
10421042
* @throws com.google.api.gax.retrying.PollException when polling exceeds the total timeout
10431043
*/
10441044
@ObsoleteApi("Use getBaseClient() to access the auto-generated proto-based methods instead.")
1045+
@Deprecated
10451046
public void awaitReplication(String tableId) {
10461047
// TODO(igorbernstein2): remove usage of typesafe names
10471048
com.google.bigtable.admin.v2.TableName tableName =
@@ -1667,6 +1668,7 @@ public Backup apply(com.google.bigtable.admin.v2.Backup backupProto) {
16671668
*/
16681669
@SuppressWarnings("WeakerAccess")
16691670
@ObsoleteApi("Use getBaseClient() to access the auto-generated proto-based methods instead.")
1671+
@Deprecated
16701672
public ApiFuture<Void> awaitReplicationAsync(final String tableId) {
16711673
// TODO(igorbernstein2): remove usage of typesafe names
16721674
com.google.bigtable.admin.v2.TableName tableName =

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/SubsetView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public com.google.bigtable.admin.v2.AuthorizedView.SubsetView toProto() {
105105
}
106106

107107
@Override
108+
@SuppressWarnings("EqualsGetClass")
108109
public boolean equals(Object o) {
109110
if (this == o) {
110111
return true;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Type.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ static Type fromProto(com.google.bigtable.admin.v2.Type source) {
5252
return Aggregate.fromProto(source.getAggregateType());
5353
case KIND_NOT_SET:
5454
return Raw.create();
55+
default:
56+
throw new UnsupportedOperationException();
5557
}
56-
throw new UnsupportedOperationException();
5758
}
5859

5960
/** The raw type denotes the absence of a type. */
@@ -204,8 +205,9 @@ static Encoding fromProto(com.google.bigtable.admin.v2.Type.Int64.Encoding sourc
204205
return BigEndianBytes.create();
205206
case ENCODING_NOT_SET:
206207
return BigEndianBytes.create();
208+
default:
209+
throw new UnsupportedOperationException();
207210
}
208-
throw new UnsupportedOperationException();
209211
}
210212

211213
@AutoValue

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallable.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import com.google.api.core.ApiFutures;
2222
import com.google.api.gax.retrying.ExponentialPollAlgorithm;
2323
import com.google.api.gax.retrying.NonCancellableFuture;
24-
import com.google.api.gax.retrying.ResultRetryAlgorithm;
24+
import com.google.api.gax.retrying.ResultRetryAlgorithmWithContext;
2525
import com.google.api.gax.retrying.RetryAlgorithm;
2626
import com.google.api.gax.retrying.RetrySettings;
27+
import com.google.api.gax.retrying.RetryingContext;
2728
import com.google.api.gax.retrying.RetryingExecutor;
2829
import com.google.api.gax.retrying.RetryingFuture;
2930
import com.google.api.gax.retrying.ScheduledRetryingExecutor;
@@ -149,7 +150,7 @@ private static class AttemptCallable<RequestT, ResponseT> implements Callable<Re
149150
private final RequestT request;
150151

151152
private volatile RetryingFuture<ResponseT> externalFuture;
152-
private volatile ApiCallContext callContext;
153+
private final ApiCallContext callContext;
153154

154155
AttemptCallable(
155156
UnaryCallable<RequestT, ResponseT> callable, RequestT request, ApiCallContext callContext) {
@@ -186,7 +187,8 @@ public ResponseT call() {
186187
* handle this.
187188
*/
188189
private static class PollResultAlgorithm
189-
implements ResultRetryAlgorithm<CheckConsistencyResponse> {
190+
implements ResultRetryAlgorithmWithContext<CheckConsistencyResponse> {
191+
190192
@Override
191193
public TimedAttemptSettings createNextAttempt(
192194
Throwable prevThrowable,
@@ -195,6 +197,22 @@ public TimedAttemptSettings createNextAttempt(
195197
return null;
196198
}
197199

200+
@Override
201+
public TimedAttemptSettings createNextAttempt(
202+
RetryingContext context,
203+
Throwable previousThrowable,
204+
CheckConsistencyResponse previousResponse,
205+
TimedAttemptSettings previousSettings) {
206+
return null;
207+
}
208+
209+
@Override
210+
public boolean shouldRetry(
211+
RetryingContext context, Throwable previousThrowable, CheckConsistencyResponse prevResponse)
212+
throws CancellationException {
213+
return prevResponse != null && !prevResponse.getConsistent();
214+
}
215+
198216
@Override
199217
public boolean shouldRetry(Throwable prevThrowable, CheckConsistencyResponse prevResponse)
200218
throws CancellationException {

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitReplicationCallable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
* <p>This callable wraps GenerateConsistencyToken and CheckConsistency RPCs. It will generate a
2929
* token then poll until isConsistent is true.
3030
*/
31-
/** @deprecated Please use {@link AwaitConsistencyCallable instead. */
31+
/**
32+
* @deprecated Please use {@link AwaitConsistencyCallable} instead.
33+
*/
3234
@Deprecated
3335
class AwaitReplicationCallable extends UnaryCallable<TableName, Void> {
3436
private final AwaitConsistencyCallable awaitConsistencyCallable;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/EnhancedBigtableTableAdminStub.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class EnhancedBigtableTableAdminStub extends GrpcBigtableTableAdminStub {
5656

5757
private final TableAdminRequestContext requestContext;
5858

59-
private final AwaitReplicationCallable awaitReplicationCallable;
59+
@Deprecated private final AwaitReplicationCallable awaitReplicationCallable;
6060

6161
private final AwaitConsistencyCallable awaitConsistencyCallable;
6262
private final OperationCallable<Void, Empty, OptimizeRestoredTableMetadata>
@@ -85,6 +85,7 @@ private EnhancedBigtableTableAdminStub(
8585
createOptimizeRestoredTableOperationBaseCallable();
8686
}
8787

88+
@Deprecated
8889
private AwaitReplicationCallable createAwaitReplicationCallable() {
8990
return AwaitReplicationCallable.create(awaitConsistencyCallable);
9091
}
@@ -207,6 +208,7 @@ public Empty apply(OperationSnapshot input) {
207208
unusedInitialCallSettings, operationCallSettings, clientContext, getOperationsStub());
208209
}
209210

211+
@Deprecated
210212
public UnaryCallable<TableName, Void> awaitReplicationCallable() {
211213
return awaitReplicationCallable;
212214
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ public SqlType<?> getType(java.lang.String fieldName) {
306306
}
307307

308308
@Override
309+
@SuppressWarnings("EqualsGetClass")
309310
public boolean equals(Object obj) {
310311
if (this == obj) {
311312
return true;
@@ -457,12 +458,12 @@ public Code getCode() {
457458
}
458459

459460
@Override
460-
public java.lang.String toString() {
461+
public final java.lang.String toString() {
461462
return getCode().name() + "{enum=" + getEnumName() + "}";
462463
}
463464

464465
@Override
465-
public boolean equals(Object o) {
466+
public final boolean equals(Object o) {
466467
if (this == o) {
467468
return true;
468469
}
@@ -486,7 +487,7 @@ public boolean equals(Object o) {
486487
}
487488

488489
@Override
489-
public int hashCode() {
490+
public final int hashCode() {
490491
T thisEnum = getForNumber().apply(0);
491492
if (thisEnum == null) {
492493
return getForNumber().hashCode();
@@ -561,6 +562,7 @@ public static SchemalessEnum create(
561562
return new AutoValue_Type_SchemalessEnum(enumName, schemaBundleId);
562563
}
563564

565+
@Override
564566
public abstract java.lang.String getEnumName();
565567

566568
public abstract java.lang.String schemaBundleId();

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,8 +2697,8 @@ public void readChangeStreamAsync(
26972697
* Executes a SQL Query and returns a ResultSet to iterate over the results. The returned
26982698
* ResultSet instance is not threadsafe, it can only be used from single thread.
26992699
*
2700-
* <p> The {@link BoundStatement} must be built from a {@link PreparedStatement} created using
2701-
* the same instance and app profile.
2700+
* <p>The {@link BoundStatement} must be built from a {@link PreparedStatement} created using the
2701+
* same instance and app profile.
27022702
*
27032703
* <p>Sample code:
27042704
*
@@ -2719,9 +2719,11 @@ public void readChangeStreamAsync(
27192719
* } catch (RuntimeException e) {
27202720
* e.printStackTrace();
27212721
* }
2722+
* }
27222723
* }</pre>
27232724
*
2724-
* @see {@link PreparedStatement} & {@link BoundStatement} for query options.
2725+
* @see PreparedStatement for query options.
2726+
* @see BoundStatement for query options.
27252727
*/
27262728
public ResultSet executeQuery(BoundStatement boundStatement) {
27272729
boundStatement.assertUsingSameStub(stub);

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -146,38 +146,34 @@ public static Builder newBuilderForEmulator(String hostname, int port) {
146146
}
147147

148148
/**
149-
* @deprecated OpenCensus support is deprecated and will be removed in a future version
150-
* Enables OpenCensus metric aggregations.
151-
*
152-
* <p>This will register Bigtable client relevant {@link io.opencensus.stats.View}s. When coupled
153-
* with an exporter, it allows users to monitor client behavior.
154-
*
155-
* <p>Please note that in addition to calling this method, the application must:
156-
* <ul>
157-
* <li>Include openensus-impl dependency on the classpath
158-
* <li>Configure an exporter like opencensus-exporter-stats-stackdriver
159-
* </ul>
160-
*
161-
* <p>Example usage for maven:
162-
* <pre>{@code
163-
* <dependency>
164-
* <groupId>io.opencensus</groupId>
165-
* <artifactId>opencensus-impl</artifactId>
166-
* <version>${opencensus.version}</version>
167-
* <scope>runtime</scope>
168-
* </dependency>
169-
*
170-
* <dependency>
171-
* <groupId>io.opencensus</groupId>
172-
* <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
173-
* <version>${opencensus.version}</version>
174-
* </dependency>
175-
* </pre>
149+
* @deprecated OpenCensus support is deprecated and will be removed in a future version Enables
150+
* OpenCensus metric aggregations.
151+
* <p>This will register Bigtable client relevant {@link io.opencensus.stats.View}s. When
152+
* coupled with an exporter, it allows users to monitor client behavior.
153+
* <p>Please note that in addition to calling this method, the application must:
154+
* <ul>
155+
* <li>Include openensus-impl dependency on the classpath
156+
* <li>Configure an exporter like opencensus-exporter-stats-stackdriver
157+
* </ul>
158+
* <p>Example usage for maven:
159+
* <pre>{@code
160+
* <dependency>
161+
* <groupId>io.opencensus</groupId>
162+
* <artifactId>opencensus-impl</artifactId>
163+
* <version>${opencensus.version}</version>
164+
* <scope>runtime</scope>
165+
* </dependency>
176166
*
177-
* Java:
178-
* <pre>{@code
179-
* StackdriverStatsExporter.createAndRegister();
180-
* BigtableDataSettings.enableOpenCensusStats();
167+
* <dependency>
168+
* <groupId>io.opencensus</groupId>
169+
* <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
170+
* <version>${opencensus.version}</version>
171+
* </dependency>
172+
* }</pre>
173+
* Java:
174+
* <pre>{@code
175+
* StackdriverStatsExporter.createAndRegister();
176+
* BigtableDataSettings.enableOpenCensusStats();
181177
* }</pre>
182178
*/
183179
@Deprecated

0 commit comments

Comments
 (0)