Skip to content

Commit 40866c0

Browse files
chore: clean up some warnings and malformed comments (#2977)
* 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 <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 56577e3 commit 40866c0

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

.kokoro/nightly/integration.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ env_vars: {
1313
# TODO: remove this after we've migrated all tests and scripts
1414
env_vars: {
1515
key: "GCLOUD_PROJECT"
16-
value: "cloud-java-ci-sample"
16+
value: "java-docs-samples-testing"
1717
}
1818

1919
env_vars: {
2020
key: "GOOGLE_CLOUD_PROJECT"
21-
value: "cloud-java-ci-sample"
21+
value: "java-docs-samples-testing"
2222
}
2323

2424
env_vars: {

google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import com.google.cloud.spanner.SpannerException;
2323
import com.google.cloud.spanner.SpannerExceptionFactory;
2424
import com.google.cloud.spanner.Statement;
25+
import com.google.cloud.spanner.connection.AbstractBaseUnitOfWork.InterceptorsUsage;
2526
import com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType;
27+
import com.google.cloud.spanner.connection.UnitOfWork.CallType;
2628
import com.google.common.annotations.VisibleForTesting;
2729
import com.google.common.base.Preconditions;
2830
import com.google.common.cache.Cache;
@@ -32,6 +34,7 @@
3234
import com.google.common.collect.ImmutableMap;
3335
import com.google.common.collect.ImmutableSet;
3436
import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions;
37+
import java.util.Collection;
3538
import java.util.Collections;
3639
import java.util.HashMap;
3740
import java.util.Map;
@@ -71,12 +74,7 @@ static void resetParsers() {
7174
}
7275
}
7376

74-
/**
75-
* Get an instance of {@link AbstractStatementParser} for the specified dialect.
76-
*
77-
* @param dialect
78-
* @return
79-
*/
77+
/** Get an instance of {@link AbstractStatementParser} for the specified dialect. */
8078
public static AbstractStatementParser getInstance(Dialect dialect) {
8179
synchronized (lock) {
8280
if (!INSTANCES.containsKey(dialect)) {
@@ -86,19 +84,19 @@ public static AbstractStatementParser getInstance(Dialect dialect) {
8684
throw SpannerExceptionFactory.newSpannerException(
8785
ErrorCode.INTERNAL, "There is no known statement parser for dialect " + dialect);
8886
}
89-
INSTANCES.put(dialect, clazz.newInstance());
90-
} catch (InstantiationException | IllegalAccessException e) {
87+
INSTANCES.put(dialect, clazz.getDeclaredConstructor().newInstance());
88+
} catch (Exception exception) {
9189
throw SpannerExceptionFactory.newSpannerException(
9290
ErrorCode.INTERNAL,
9391
"Could not instantiate statement parser for dialect " + dialect.name(),
94-
e);
92+
exception);
9593
}
9694
}
9795
return INSTANCES.get(dialect);
9896
}
9997
}
10098

101-
/**
99+
/*
102100
* The following fixed pre-parsed statements are used internally by the Connection API. These do
103101
* not need to be parsed using a specific dialect, as they are equal for all dialects, and
104102
* pre-parsing them avoids the need to repeatedly parse statements that are used internally.
@@ -108,30 +106,33 @@ public static AbstractStatementParser getInstance(Dialect dialect) {
108106
static final ParsedStatement BEGIN_STATEMENT;
109107

110108
/**
111-
* Create a COMMIT statement to use with the {@link #commit()} method to allow it to be cancelled,
112-
* time out or retried.
109+
* Create a COMMIT statement to use with the {@link Connection#commit()} method to allow it to be
110+
* cancelled, time out or retried.
113111
*
114-
* <p>{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement,
115-
* Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout
116-
* and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link
117-
* #commit()} method is called directly, we do not have a {@link ParsedStatement}, and the method
118-
* uses this statement instead in order to use the same logic as the other statements.
112+
* <p>{@link ReadWriteTransaction} uses the generic methods {@link
113+
* ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable,
114+
* InterceptorsUsage, Collection)} and {@link ReadWriteTransaction#runWithRetry(Callable)} to
115+
* allow statements to be cancelled, to timeout and to be retried. These methods require a {@link
116+
* ParsedStatement} as input. When the {@link Connection#commit()} method is called directly, we
117+
* do not have a {@link ParsedStatement}, and the method uses this statement instead in order to
118+
* use the same logic as the other statements.
119119
*/
120120
static final ParsedStatement COMMIT_STATEMENT;
121121

122122
/** The {@link Statement} and {@link Callable} for rollbacks */
123123
static final ParsedStatement ROLLBACK_STATEMENT;
124124

125125
/**
126-
* Create a RUN BATCH statement to use with the {@link #executeBatchUpdate(Iterable)} method to
127-
* allow it to be cancelled, time out or retried.
126+
* Create a RUN BATCH statement to use with the {@link Connection#executeBatchUpdate(Iterable)}
127+
* method to allow it to be cancelled, time out or retried.
128128
*
129-
* <p>{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement,
130-
* Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout
131-
* and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link
132-
* #executeBatchUpdate(Iterable)} method is called, we do not have one {@link ParsedStatement},
133-
* and the method uses this statement instead in order to use the same logic as the other
134-
* statements.
129+
* <p>{@link ReadWriteTransaction} uses the generic methods {@link
130+
* ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, Collection)}
131+
* and {@link ReadWriteTransaction#runWithRetry(Callable)} to allow statements to be cancelled, to
132+
* timeout and to be retried. These methods require a {@link ParsedStatement} as input. When the
133+
* {@link Connection#executeBatchUpdate(Iterable)} method is called, we do not have one {@link
134+
* ParsedStatement}, and the method uses this statement instead in order to use the same logic as
135+
* the other statements.
135136
*/
136137
static final ParsedStatement RUN_BATCH_STATEMENT;
137138

0 commit comments

Comments
 (0)