From e74319c105508ab91a5d13152362d39b315c8dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Mon, 1 Apr 2024 12:04:12 +0200 Subject: [PATCH] chore: clean up some warnings and malformed comments (#2977) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: clean up some warnings and malformed comments * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .kokoro/nightly/integration.cfg | 4 +- .../connection/AbstractStatementParser.java | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg index 9640e74d453..5a95c68284c 100644 --- a/.kokoro/nightly/integration.cfg +++ b/.kokoro/nightly/integration.cfg @@ -13,12 +13,12 @@ env_vars: { # TODO: remove this after we've migrated all tests and scripts env_vars: { key: "GCLOUD_PROJECT" - value: "cloud-java-ci-sample" + value: "java-docs-samples-testing" } env_vars: { key: "GOOGLE_CLOUD_PROJECT" - value: "cloud-java-ci-sample" + value: "java-docs-samples-testing" } env_vars: { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java index 9793a50c636..d0c06fa1d9d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java @@ -22,7 +22,9 @@ import com.google.cloud.spanner.SpannerException; import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.Statement; +import com.google.cloud.spanner.connection.AbstractBaseUnitOfWork.InterceptorsUsage; import com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType; +import com.google.cloud.spanner.connection.UnitOfWork.CallType; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.cache.Cache; @@ -32,6 +34,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -71,12 +74,7 @@ static void resetParsers() { } } - /** - * Get an instance of {@link AbstractStatementParser} for the specified dialect. - * - * @param dialect - * @return - */ + /** Get an instance of {@link AbstractStatementParser} for the specified dialect. */ public static AbstractStatementParser getInstance(Dialect dialect) { synchronized (lock) { if (!INSTANCES.containsKey(dialect)) { @@ -86,19 +84,19 @@ public static AbstractStatementParser getInstance(Dialect dialect) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INTERNAL, "There is no known statement parser for dialect " + dialect); } - INSTANCES.put(dialect, clazz.newInstance()); - } catch (InstantiationException | IllegalAccessException e) { + INSTANCES.put(dialect, clazz.getDeclaredConstructor().newInstance()); + } catch (Exception exception) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INTERNAL, "Could not instantiate statement parser for dialect " + dialect.name(), - e); + exception); } } return INSTANCES.get(dialect); } } - /** + /* * The following fixed pre-parsed statements are used internally by the Connection API. These do * not need to be parsed using a specific dialect, as they are equal for all dialects, and * pre-parsing them avoids the need to repeatedly parse statements that are used internally. @@ -108,14 +106,16 @@ public static AbstractStatementParser getInstance(Dialect dialect) { static final ParsedStatement BEGIN_STATEMENT; /** - * Create a COMMIT statement to use with the {@link #commit()} method to allow it to be cancelled, - * time out or retried. + * Create a COMMIT statement to use with the {@link Connection#commit()} method to allow it to be + * cancelled, time out or retried. * - *

{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement, - * Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout - * and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link - * #commit()} method is called directly, we do not have a {@link ParsedStatement}, and the method - * uses this statement instead in order to use the same logic as the other statements. + *

{@link ReadWriteTransaction} uses the generic methods {@link + * ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, + * InterceptorsUsage, Collection)} and {@link ReadWriteTransaction#runWithRetry(Callable)} to + * allow statements to be cancelled, to timeout and to be retried. These methods require a {@link + * ParsedStatement} as input. When the {@link Connection#commit()} method is called directly, we + * do not have a {@link ParsedStatement}, and the method uses this statement instead in order to + * use the same logic as the other statements. */ static final ParsedStatement COMMIT_STATEMENT; @@ -123,15 +123,16 @@ public static AbstractStatementParser getInstance(Dialect dialect) { static final ParsedStatement ROLLBACK_STATEMENT; /** - * Create a RUN BATCH statement to use with the {@link #executeBatchUpdate(Iterable)} method to - * allow it to be cancelled, time out or retried. + * Create a RUN BATCH statement to use with the {@link Connection#executeBatchUpdate(Iterable)} + * method to allow it to be cancelled, time out or retried. * - *

{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement, - * Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout - * and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link - * #executeBatchUpdate(Iterable)} method is called, we do not have one {@link ParsedStatement}, - * and the method uses this statement instead in order to use the same logic as the other - * statements. + *

{@link ReadWriteTransaction} uses the generic methods {@link + * ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, Collection)} + * and {@link ReadWriteTransaction#runWithRetry(Callable)} to allow statements to be cancelled, to + * timeout and to be retried. These methods require a {@link ParsedStatement} as input. When the + * {@link Connection#executeBatchUpdate(Iterable)} method is called, we do not have one {@link + * ParsedStatement}, and the method uses this statement instead in order to use the same logic as + * the other statements. */ static final ParsedStatement RUN_BATCH_STATEMENT;