Skip to content

chore: update linter groupd ID to the latest #2052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 17
- run: java -version
- run: .kokoro/build.sh
env:
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test)
RETURN_CODE=$?
;;
lint)
mvn com.coveo:fmt-maven-plugin:check -B -ntp
mvn com.spotify.fmt:fmt-maven-plugin:check -B -ntp
RETURN_CODE=$?
;;
javadoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public void addBatch(String sql) throws SQLException {
@Override
public void setNull(int parameterIndex, int sqlType) throws SQLException {
checkClosed();
parameters.setParameter(
parameterIndex, /* value = */ null, sqlType, /* scaleOrLength = */ null);
parameters.setParameter(parameterIndex, /* value= */ null, sqlType, /* scaleOrLength= */ null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
abstract class AbstractJdbcResultSet extends AbstractJdbcWrapper implements ResultSet {
/** The underlying Cloud Spanner {@link com.google.cloud.spanner.ResultSet}. */
final com.google.cloud.spanner.ResultSet spanner;

/** Current fetch size hint for this result set. */
private int fetchSize;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ default void setTransactionTag(String tag) throws SQLException {
throw new UnsupportedOperationException();
}

/** @return The transaction tag of the current transaction. */
/**
* @return The transaction tag of the current transaction.
*/
default String getTransactionTag() throws SQLException {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -242,7 +244,9 @@ default String getStatementTag() throws SQLException {
*/
void setReturnCommitStats(boolean returnCommitStats) throws SQLException;

/** @return true if this connection requests commit statistics from Cloud Spanner. */
/**
* @return true if this connection requests commit statistics from Cloud Spanner.
*/
boolean isReturnCommitStats() throws SQLException;

/**
Expand Down Expand Up @@ -359,7 +363,9 @@ default String getStatementTag() throws SQLException {
*/
String getConnectionUrl();

/** @return The {@link Dialect} that is used by this connection. */
/**
* @return The {@link Dialect} that is used by this connection.
*/
default Dialect getDialect() {
return Dialect.GOOGLE_STANDARD_SQL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static IsolationLevel convertToSpanner(int jdbcIsolationLevel) throws SQLExcepti

static int convertToJdbc(IsolationLevel isolationLevel) {
switch (isolationLevel) {
// Translate UNSPECIFIED to SERIALIZABLE as that is the default isolation level.
// Translate UNSPECIFIED to SERIALIZABLE as that is the default isolation level.
case ISOLATION_LEVEL_UNSPECIFIED:
case SERIALIZABLE:
return Connection.TRANSACTION_SERIALIZABLE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public final class JdbcConstants {
* was executed with {@link Statement#execute(String)} returned a {@link ResultSet}.
*/
public static final int STATEMENT_RESULT_SET = -1;

/**
* Special value that is used to indicate that a statement had no result. The method {@link
* Statement#getUpdateCount()} will return this value if the previous statement that was executed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,16 @@ public boolean isClosed() {
return false;
}

/** @return the JDBC URL to use for this {@link DataSource}. */
/**
* @return the JDBC URL to use for this {@link DataSource}.
*/
public String getUrl() {
return url;
}

/** @param url The JDBC URL to use for this {@link DataSource}. */
/**
* @param url The JDBC URL to use for this {@link DataSource}.
*/
public void setUrl(String url) {
this.url = url;
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/google/cloud/spanner/jdbc/JdbcDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ static void deregister() throws SQLException {
registeredDriver = null;
}

/** @return {@code true} if the driver is registered against {@link DriverManager} */
/**
* @return {@code true} if the driver is registered against {@link DriverManager}
*/
static boolean isRegistered() {
return registeredDriver != null;
}
Expand Down Expand Up @@ -281,7 +283,7 @@ static boolean isHibernate() {
// we assume that Hibernate will (eventually) be used.
Class.forName(
"com.google.cloud.spanner.hibernate.SpannerDialect",
/*initialize=*/ false,
/* initialize= */ false,
JdbcDriver.class.getClassLoader());
return true;
} catch (Throwable ignore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@
*/
public interface JdbcSqlException {

/** @see Throwable#getMessage() */
/**
* @see Throwable#getMessage()
*/
String getMessage();

/** @see Throwable#getCause() */
/**
* @see Throwable#getCause()
*/
Throwable getCause();

/** @see SQLException#getSQLState() */
/**
* @see SQLException#getSQLState()
*/
String getSQLState();

/** Returns the gRPC error code as an int */
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/google/cloud/spanner/jdbc/JsonType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
*/
public class JsonType implements SQLType {
public static final JsonType INSTANCE = new JsonType();

/**
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
* conflicts with the type numbers in java.sql.Types.
*/
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.JSON_VALUE;

/**
* Define a short type number as well, as this is what is expected to be returned in {@link
* DatabaseMetaData#getTypeInfo()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@

public class PgJsonbType implements SQLType {
public static final PgJsonbType INSTANCE = new PgJsonbType();

/**
* Spanner/Spangres does not have any type numbers, but the code values are unique. Add 200,000 to
* avoid conflicts with the type numbers in java.sql.Types. Native Cloud Spanner types already use
* the range starting at 100,000 (see {@link JsonType}).
*/
public static final int VENDOR_TYPE_NUMBER = 200_000 + TypeCode.JSON_VALUE;

/**
* Define a short type number as well, as this is what is expected to be returned in {@link
* DatabaseMetaData#getTypeInfo()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
*/
public class ProtoEnumType implements SQLType {
public static final ProtoEnumType INSTANCE = new ProtoEnumType();

/**
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
* conflicts with the type numbers in java.sql.Types.
*/
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.ENUM_VALUE;

/**
* Define a short type number as well, as this is what is expected to be returned in {@link
* DatabaseMetaData#getTypeInfo()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
*/
public class ProtoMessageType implements SQLType {
public static final ProtoMessageType INSTANCE = new ProtoMessageType();

/**
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
* conflicts with the type numbers in java.sql.Types.
*/
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.PROTO_VALUE;

/**
* Define a short type number as well, as this is what is expected to be returned in {@link
* DatabaseMetaData#getTypeInfo()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

package com.google.cloud.spanner.jdbc;

/** @see com.google.cloud.spanner.connection.SpannerPool */
/**
* @see com.google.cloud.spanner.connection.SpannerPool
*/
@Deprecated
public class SpannerPool {
private SpannerPool() {}

/** @see com.google.cloud.spanner.connection.SpannerPool#closeSpannerPool() */
/**
* @see com.google.cloud.spanner.connection.SpannerPool#closeSpannerPool()
*/
@Deprecated
public static void closeSpannerPool() {
com.google.cloud.spanner.connection.SpannerPool.closeSpannerPool();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/google/cloud/spanner/jdbc/UuidType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
*/
public class UuidType implements SQLType {
public static final UuidType INSTANCE = new UuidType();

/**
* Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid
* conflicts with the type numbers in java.sql.Types.
*/
public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.UUID_VALUE;

/**
* Define a short type number as well, as this is what is expected to be returned in {@link
* DatabaseMetaData#getTypeInfo()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testGetDatabaseDdl() throws SQLException {
mockDatabaseAdmin.addResponse(
GetDatabaseDdlResponse.newBuilder().addAllStatements(expectedDdl).build());

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

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

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

try (Connection connection = createConnection(/* autoCommit = */ false)) {
try (Connection connection = createConnection(/* autoCommit= */ false)) {
assertFalse(connection.createStatement().execute("update foo set bar=1 where true"));
SQLException exception =
assertThrows(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ public void testRollback() throws SQLException {

@Test
public void testClosedJdbcConnection()
throws SQLException, NoSuchMethodException, SecurityException, IllegalAccessException,
throws SQLException,
NoSuchMethodException,
SecurityException,
IllegalAccessException,
IllegalArgumentException {
testClosed(Connection.class, "getCatalog");
testClosed(Connection.class, "getWarnings");
Expand Down Expand Up @@ -328,14 +331,20 @@ public void testClosedJdbcConnection()
}

private void testClosed(Class<? extends Connection> clazz, String name)
throws NoSuchMethodException, SecurityException, SQLException, IllegalAccessException,
throws NoSuchMethodException,
SecurityException,
SQLException,
IllegalAccessException,
IllegalArgumentException {
testClosed(clazz, name, null, null);
}

private void testClosed(
Class<? extends Connection> clazz, String name, Class<?>[] paramTypes, Object[] args)
throws NoSuchMethodException, SecurityException, SQLException, IllegalAccessException,
throws NoSuchMethodException,
SecurityException,
SQLException,
IllegalAccessException,
IllegalArgumentException {
Method method = clazz.getDeclaredMethod(name, paramTypes);
testInvokeMethodOnClosedConnection(method, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ protected Object getFirstValue() throws Exception {

public static class JdbcGenericConnection extends GenericConnection {
private final CloudSpannerJdbcConnection connection;

/**
* Use this to strip comments from a statement before the statement is executed. This should
* only be used when the connection is used in a unit test with a mocked underlying connection.
Expand Down
Loading