Skip to content

Commit 1a95dab

Browse files
chore: update linter groupd ID to the latest (#2052)
* chore: update linter groupd ID to the latest Follows from googleapis/java-shared-config#1003 * chore: update jvm to 17 in lint job * chore: reformat files
1 parent ca803cc commit 1a95dab

20 files changed

+114
-24
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
- uses: actions/setup-java@v4
105105
with:
106106
distribution: temurin
107-
java-version: 11
107+
java-version: 17
108108
- run: java -version
109109
- run: .kokoro/build.sh
110110
env:

.kokoro/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test)
6262
RETURN_CODE=$?
6363
;;
6464
lint)
65-
mvn com.coveo:fmt-maven-plugin:check -B -ntp
65+
mvn com.spotify.fmt:fmt-maven-plugin:check -B -ntp
6666
RETURN_CODE=$?
6767
;;
6868
javadoc)

src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcPreparedStatement.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public void addBatch(String sql) throws SQLException {
8181
@Override
8282
public void setNull(int parameterIndex, int sqlType) throws SQLException {
8383
checkClosed();
84-
parameters.setParameter(
85-
parameterIndex, /* value = */ null, sqlType, /* scaleOrLength = */ null);
84+
parameters.setParameter(parameterIndex, /* value= */ null, sqlType, /* scaleOrLength= */ null);
8685
}
8786

8887
@Override

src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcResultSet.java

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
abstract class AbstractJdbcResultSet extends AbstractJdbcWrapper implements ResultSet {
4040
/** The underlying Cloud Spanner {@link com.google.cloud.spanner.ResultSet}. */
4141
final com.google.cloud.spanner.ResultSet spanner;
42+
4243
/** Current fetch size hint for this result set. */
4344
private int fetchSize;
4445

src/main/java/com/google/cloud/spanner/jdbc/CloudSpannerJdbcConnection.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ default void setTransactionTag(String tag) throws SQLException {
8888
throw new UnsupportedOperationException();
8989
}
9090

91-
/** @return The transaction tag of the current transaction. */
91+
/**
92+
* @return The transaction tag of the current transaction.
93+
*/
9294
default String getTransactionTag() throws SQLException {
9395
throw new UnsupportedOperationException();
9496
}
@@ -242,7 +244,9 @@ default String getStatementTag() throws SQLException {
242244
*/
243245
void setReturnCommitStats(boolean returnCommitStats) throws SQLException;
244246

245-
/** @return true if this connection requests commit statistics from Cloud Spanner. */
247+
/**
248+
* @return true if this connection requests commit statistics from Cloud Spanner.
249+
*/
246250
boolean isReturnCommitStats() throws SQLException;
247251

248252
/**
@@ -359,7 +363,9 @@ default String getStatementTag() throws SQLException {
359363
*/
360364
String getConnectionUrl();
361365

362-
/** @return The {@link Dialect} that is used by this connection. */
366+
/**
367+
* @return The {@link Dialect} that is used by this connection.
368+
*/
363369
default Dialect getDialect() {
364370
return Dialect.GOOGLE_STANDARD_SQL;
365371
}

src/main/java/com/google/cloud/spanner/jdbc/IsolationLevelConverter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static IsolationLevel convertToSpanner(int jdbcIsolationLevel) throws SQLExcepti
4040

4141
static int convertToJdbc(IsolationLevel isolationLevel) {
4242
switch (isolationLevel) {
43-
// Translate UNSPECIFIED to SERIALIZABLE as that is the default isolation level.
43+
// Translate UNSPECIFIED to SERIALIZABLE as that is the default isolation level.
4444
case ISOLATION_LEVEL_UNSPECIFIED:
4545
case SERIALIZABLE:
4646
return Connection.TRANSACTION_SERIALIZABLE;

src/main/java/com/google/cloud/spanner/jdbc/JdbcConstants.java

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public final class JdbcConstants {
2727
* was executed with {@link Statement#execute(String)} returned a {@link ResultSet}.
2828
*/
2929
public static final int STATEMENT_RESULT_SET = -1;
30+
3031
/**
3132
* Special value that is used to indicate that a statement had no result. The method {@link
3233
* Statement#getUpdateCount()} will return this value if the previous statement that was executed

src/main/java/com/google/cloud/spanner/jdbc/JdbcDataSource.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,16 @@ public boolean isClosed() {
114114
return false;
115115
}
116116

117-
/** @return the JDBC URL to use for this {@link DataSource}. */
117+
/**
118+
* @return the JDBC URL to use for this {@link DataSource}.
119+
*/
118120
public String getUrl() {
119121
return url;
120122
}
121123

122-
/** @param url The JDBC URL to use for this {@link DataSource}. */
124+
/**
125+
* @param url The JDBC URL to use for this {@link DataSource}.
126+
*/
123127
public void setUrl(String url) {
124128
this.url = url;
125129
}

src/main/java/com/google/cloud/spanner/jdbc/JdbcDriver.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ static void deregister() throws SQLException {
196196
registeredDriver = null;
197197
}
198198

199-
/** @return {@code true} if the driver is registered against {@link DriverManager} */
199+
/**
200+
* @return {@code true} if the driver is registered against {@link DriverManager}
201+
*/
200202
static boolean isRegistered() {
201203
return registeredDriver != null;
202204
}
@@ -281,7 +283,7 @@ static boolean isHibernate() {
281283
// we assume that Hibernate will (eventually) be used.
282284
Class.forName(
283285
"com.google.cloud.spanner.hibernate.SpannerDialect",
284-
/*initialize=*/ false,
286+
/* initialize= */ false,
285287
JdbcDriver.class.getClassLoader());
286288
return true;
287289
} catch (Throwable ignore) {

src/main/java/com/google/cloud/spanner/jdbc/JdbcSqlException.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@
2525
*/
2626
public interface JdbcSqlException {
2727

28-
/** @see Throwable#getMessage() */
28+
/**
29+
* @see Throwable#getMessage()
30+
*/
2931
String getMessage();
3032

31-
/** @see Throwable#getCause() */
33+
/**
34+
* @see Throwable#getCause()
35+
*/
3236
Throwable getCause();
3337

34-
/** @see SQLException#getSQLState() */
38+
/**
39+
* @see SQLException#getSQLState()
40+
*/
3541
String getSQLState();
3642

3743
/** Returns the gRPC error code as an int */

src/main/java/com/google/cloud/spanner/jdbc/JsonType.java

+2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
*/
2828
public class JsonType implements SQLType {
2929
public static final JsonType INSTANCE = new JsonType();
30+
3031
/**
3132
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
3233
* conflicts with the type numbers in java.sql.Types.
3334
*/
3435
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.JSON_VALUE;
36+
3537
/**
3638
* Define a short type number as well, as this is what is expected to be returned in {@link
3739
* DatabaseMetaData#getTypeInfo()}.

src/main/java/com/google/cloud/spanner/jdbc/PgJsonbType.java

+2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222

2323
public class PgJsonbType implements SQLType {
2424
public static final PgJsonbType INSTANCE = new PgJsonbType();
25+
2526
/**
2627
* Spanner/Spangres does not have any type numbers, but the code values are unique. Add 200,000 to
2728
* avoid conflicts with the type numbers in java.sql.Types. Native Cloud Spanner types already use
2829
* the range starting at 100,000 (see {@link JsonType}).
2930
*/
3031
public static final int VENDOR_TYPE_NUMBER = 200_000 + TypeCode.JSON_VALUE;
32+
3133
/**
3234
* Define a short type number as well, as this is what is expected to be returned in {@link
3335
* DatabaseMetaData#getTypeInfo()}.

src/main/java/com/google/cloud/spanner/jdbc/ProtoEnumType.java

+2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
*/
2828
public class ProtoEnumType implements SQLType {
2929
public static final ProtoEnumType INSTANCE = new ProtoEnumType();
30+
3031
/**
3132
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
3233
* conflicts with the type numbers in java.sql.Types.
3334
*/
3435
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.ENUM_VALUE;
36+
3537
/**
3638
* Define a short type number as well, as this is what is expected to be returned in {@link
3739
* DatabaseMetaData#getTypeInfo()}.

src/main/java/com/google/cloud/spanner/jdbc/ProtoMessageType.java

+2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
*/
2828
public class ProtoMessageType implements SQLType {
2929
public static final ProtoMessageType INSTANCE = new ProtoMessageType();
30+
3031
/**
3132
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
3233
* conflicts with the type numbers in java.sql.Types.
3334
*/
3435
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.PROTO_VALUE;
36+
3537
/**
3638
* Define a short type number as well, as this is what is expected to be returned in {@link
3739
* DatabaseMetaData#getTypeInfo()}.

src/main/java/com/google/cloud/spanner/jdbc/SpannerPool.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616

1717
package com.google.cloud.spanner.jdbc;
1818

19-
/** @see com.google.cloud.spanner.connection.SpannerPool */
19+
/**
20+
* @see com.google.cloud.spanner.connection.SpannerPool
21+
*/
2022
@Deprecated
2123
public class SpannerPool {
2224
private SpannerPool() {}
2325

24-
/** @see com.google.cloud.spanner.connection.SpannerPool#closeSpannerPool() */
26+
/**
27+
* @see com.google.cloud.spanner.connection.SpannerPool#closeSpannerPool()
28+
*/
2529
@Deprecated
2630
public static void closeSpannerPool() {
2731
com.google.cloud.spanner.connection.SpannerPool.closeSpannerPool();

src/main/java/com/google/cloud/spanner/jdbc/UuidType.java

+2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
*/
2828
public class UuidType implements SQLType {
2929
public static final UuidType INSTANCE = new UuidType();
30+
3031
/**
3132
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
3233
* conflicts with the type numbers in java.sql.Types.
3334
*/
3435
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.UUID_VALUE;
36+
3537
/**
3638
* Define a short type number as well, as this is what is expected to be returned in {@link
3739
* DatabaseMetaData#getTypeInfo()}.

src/test/java/com/google/cloud/spanner/jdbc/DdlMockServerTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void testGetDatabaseDdl() throws SQLException {
6262
mockDatabaseAdmin.addResponse(
6363
GetDatabaseDdlResponse.newBuilder().addAllStatements(expectedDdl).build());
6464

65-
try (Connection connection = createConnection(/* autoCommit = */ true)) {
65+
try (Connection connection = createConnection(/* autoCommit= */ true)) {
6666
CloudSpannerJdbcConnection spannerJdbcConnection =
6767
connection.unwrap(CloudSpannerJdbcConnection.class);
6868
List<String> ddl =
@@ -85,7 +85,7 @@ public void testDdlInAutoCommitIsTrue_succeeds() throws SQLException {
8585
.setMetadata(Any.pack(UpdateDatabaseDdlMetadata.getDefaultInstance()))
8686
.build());
8787

88-
try (Connection connection = createConnection(/* autoCommit = */ true)) {
88+
try (Connection connection = createConnection(/* autoCommit= */ true)) {
8989
assertFalse(
9090
connection.createStatement().execute("create table foo (id int64) primary key (id)"));
9191
}
@@ -100,7 +100,7 @@ public void testDdlInAutoCommitIsFalse_succeedsWithNoActiveTransaction() throws
100100
.setMetadata(Any.pack(UpdateDatabaseDdlMetadata.getDefaultInstance()))
101101
.build());
102102

103-
try (Connection connection = createConnection(/* autoCommit = */ false)) {
103+
try (Connection connection = createConnection(/* autoCommit= */ false)) {
104104
assertFalse(
105105
connection.createStatement().execute("create table foo (id int64) primary key (id)"));
106106
}
@@ -111,7 +111,7 @@ public void testDdlInAutoCommitIsFalse_failsWithActiveTransaction() throws SQLEx
111111
mockSpanner.putStatementResult(
112112
StatementResult.update(Statement.of("update foo set bar=1 where true"), 1L));
113113

114-
try (Connection connection = createConnection(/* autoCommit = */ false)) {
114+
try (Connection connection = createConnection(/* autoCommit= */ false)) {
115115
assertFalse(connection.createStatement().execute("update foo set bar=1 where true"));
116116
SQLException exception =
117117
assertThrows(

src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ public void testRollback() throws SQLException {
192192

193193
@Test
194194
public void testClosedJdbcConnection()
195-
throws SQLException, NoSuchMethodException, SecurityException, IllegalAccessException,
195+
throws SQLException,
196+
NoSuchMethodException,
197+
SecurityException,
198+
IllegalAccessException,
196199
IllegalArgumentException {
197200
testClosed(Connection.class, "getCatalog");
198201
testClosed(Connection.class, "getWarnings");
@@ -328,14 +331,20 @@ public void testClosedJdbcConnection()
328331
}
329332

330333
private void testClosed(Class<? extends Connection> clazz, String name)
331-
throws NoSuchMethodException, SecurityException, SQLException, IllegalAccessException,
334+
throws NoSuchMethodException,
335+
SecurityException,
336+
SQLException,
337+
IllegalAccessException,
332338
IllegalArgumentException {
333339
testClosed(clazz, name, null, null);
334340
}
335341

336342
private void testClosed(
337343
Class<? extends Connection> clazz, String name, Class<?>[] paramTypes, Object[] args)
338-
throws NoSuchMethodException, SecurityException, SQLException, IllegalAccessException,
344+
throws NoSuchMethodException,
345+
SecurityException,
346+
SQLException,
347+
IllegalAccessException,
339348
IllegalArgumentException {
340349
Method method = clazz.getDeclaredMethod(name, paramTypes);
341350
testInvokeMethodOnClosedConnection(method, args);

src/test/java/com/google/cloud/spanner/jdbc/JdbcSqlScriptVerifier.java

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ protected Object getFirstValue() throws Exception {
119119

120120
public static class JdbcGenericConnection extends GenericConnection {
121121
private final CloudSpannerJdbcConnection connection;
122+
122123
/**
123124
* Use this to strip comments from a statement before the statement is executed. This should
124125
* only be used when the connection is used in a unit test with a mocked underlying connection.

0 commit comments

Comments
 (0)