Repository: GoogleCloudPlatform/pgadapter
Pull request #2778 (2025-01-17 16:34:10)

chore: rename helper classes to prevent clashes
Rename the helper classes that are added to the .connection package to prevent potential name clashes in other tools that use the same trick.


Patch:
diff --git a/benchmarks/latency-comparison/golang/go.mod b/benchmarks/latency-comparison/golang/go.mod
index 20f207db..384d8e11 100644
--- a/benchmarks/latency-comparison/golang/go.mod
+++ b/benchmarks/latency-comparison/golang/go.mod
@@ -2,7 +2,7 @@ module cloud.google.com/pgadapter-latency-benchmark
 
 go 1.22
 
-toolchain go1.23.4
+toolchain go1.23.5
 
 require (
 	cloud.google.com/go/spanner v1.73.0
diff --git a/benchmarks/latency-comparison/java/pom.xml b/benchmarks/latency-comparison/java/pom.xml
index 2b999d0f..3e6638d3 100644
--- a/benchmarks/latency-comparison/java/pom.xml
+++ b/benchmarks/latency-comparison/java/pom.xml
@@ -87,7 +87,7 @@
     <dependency>
       <groupId>org.postgresql</groupId>
       <artifactId>postgresql</artifactId>
-      <version>42.7.4</version>
+      <version>42.7.5</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
diff --git a/pom.xml b/pom.xml
index 1507736e..5f51204b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,7 @@
       <dependency>
         <groupId>com.google.cloud</groupId>
         <artifactId>libraries-bom</artifactId>
-        <version>26.52.0</version>
+        <version>26.53.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
@@ -194,10 +194,15 @@
       <artifactId>commons-cli</artifactId>
       <version>1.9.0</version>
     </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.17.2</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-csv</artifactId>
-      <version>1.12.0</version>
+      <version>1.13.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
diff --git a/samples/golang/gorm/go.mod b/samples/golang/gorm/go.mod
index 8339f177..69d1dd87 100644
--- a/samples/golang/gorm/go.mod
+++ b/samples/golang/gorm/go.mod
@@ -2,7 +2,7 @@ module gorm
 
 go 1.22
 
-toolchain go1.23.4
+toolchain go1.23.5
 
 require (
 	github.com/GoogleCloudPlatform/pgadapter/wrappers/golang v0.0.0-20250101102758-b554b94f49f2
diff --git a/samples/golang/pgx/go.mod b/samples/golang/pgx/go.mod
index d17ab8f4..54e6ae88 100644
--- a/samples/golang/pgx/go.mod
+++ b/samples/golang/pgx/go.mod
@@ -2,7 +2,7 @@ module pgadapter-pgx-sample
 
 go 1.22
 
-toolchain go1.23.4
+toolchain go1.23.5
 
 require (
 	github.com/GoogleCloudPlatform/pgadapter/wrappers/golang v0.0.0-20250101102758-b554b94f49f2
diff --git a/samples/java/cloud-run/pom.xml b/samples/java/cloud-run/pom.xml
index ff1e8c26..4b297ea5 100644
--- a/samples/java/cloud-run/pom.xml
+++ b/samples/java/cloud-run/pom.xml
@@ -47,7 +47,7 @@
     <dependency>
       <groupId>org.postgresql</groupId>
       <artifactId>postgresql</artifactId>
-      <version>42.7.4</version>
+      <version>42.7.5</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
diff --git a/samples/java/hibernate/pom.xml b/samples/java/hibernate/pom.xml
index 5c5b4723..78396d95 100644
--- a/samples/java/hibernate/pom.xml
+++ b/samples/java/hibernate/pom.xml
@@ -45,7 +45,7 @@
     <dependency>
       <groupId>org.postgresql</groupId>
       <artifactId>postgresql</artifactId>
-      <version>42.7.4</version>
+      <version>42.7.5</version>
     </dependency>
     <!-- Add Spanner Hibernate tools for access to the batch compatible bit-reversed sequence generator. -->
     <dependency>
diff --git a/samples/java/jdbc/pom.xml b/samples/java/jdbc/pom.xml
index 038c6ea9..96e0bc97 100644
--- a/samples/java/jdbc/pom.xml
+++ b/samples/java/jdbc/pom.xml
@@ -51,7 +51,7 @@
     <dependency>
       <groupId>org.postgresql</groupId>
       <artifactId>postgresql</artifactId>
-      <version>42.7.4</version>
+      <version>42.7.5</version>
     </dependency>
     <dependency>
       <groupId>com.google.cloud</groupId>
diff --git a/samples/sidecar-proxy/Dockerfile b/samples/sidecar-proxy/Dockerfile
index 7f51bd34..a5765505 100644
--- a/samples/sidecar-proxy/Dockerfile
+++ b/samples/sidecar-proxy/Dockerfile
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM golang:1.23.4 as builder
+FROM golang:1.23.5 as builder
 WORKDIR /app
 RUN go mod init example-app
 RUN go get github.com/jackc/pgx/v4
diff --git a/samples/snippets/golang-snippets/go.mod b/samples/snippets/golang-snippets/go.mod
index 881a441a..5737bc8e 100644
--- a/samples/snippets/golang-snippets/go.mod
+++ b/samples/snippets/golang-snippets/go.mod
@@ -2,7 +2,7 @@ module golang-snippets
 
 go 1.22
 
-toolchain go1.23.4
+toolchain go1.23.5
 
 require (
 	github.com/docker/docker v27.5.0+incompatible
diff --git a/src/main/java/com/google/cloud/spanner/connection/ConnectionOptionsHelper.java b/src/main/java/com/google/cloud/spanner/connection/PGAdapterConnectionOptionsHelper.java
similarity index 96%
rename from src/main/java/com/google/cloud/spanner/connection/ConnectionOptionsHelper.java
rename to src/main/java/com/google/cloud/spanner/connection/PGAdapterConnectionOptionsHelper.java
index d11e53d2..fdd78f96 100644
--- a/src/main/java/com/google/cloud/spanner/connection/ConnectionOptionsHelper.java
+++ b/src/main/java/com/google/cloud/spanner/connection/PGAdapterConnectionOptionsHelper.java
@@ -24,9 +24,9 @@ import java.util.logging.Level;
 
 /** Simple helper class to get access to a package-private method in the ConnectionOptions. */
 @InternalApi
-public class ConnectionOptionsHelper {
+public class PGAdapterConnectionOptionsHelper {
   /** Private constructor to prevent instantiation. */
-  private ConnectionOptionsHelper() {}
+  private PGAdapterConnectionOptionsHelper() {}
 
   // TODO: Remove when Builder.setCredentials(..) has been made public.
   public static Builder setCredentials(Builder connectionOptionsBuilder, Credentials credentials) {
diff --git a/src/main/java/com/google/cloud/spanner/connection/ResultSetHelper.java b/src/main/java/com/google/cloud/spanner/connection/PGAdapterResultSetHelper.java
similarity index 93%
rename from src/main/java/com/google/cloud/spanner/connection/ResultSetHelper.java
rename to src/main/java/com/google/cloud/spanner/connection/PGAdapterResultSetHelper.java
index ef56904d..69a7b533 100644
--- a/src/main/java/com/google/cloud/spanner/connection/ResultSetHelper.java
+++ b/src/main/java/com/google/cloud/spanner/connection/PGAdapterResultSetHelper.java
@@ -18,10 +18,10 @@ import com.google.api.core.InternalApi;
 import com.google.cloud.spanner.ResultSet;
 
 @InternalApi
-public class ResultSetHelper {
+public class PGAdapterResultSetHelper {
 
   /** Private constructor to prevent instantiation. */
-  private ResultSetHelper() {}
+  private PGAdapterResultSetHelper() {}
 
   /**
    * Converts the given {@link ResultSet} to a {@link DirectExecuteResultSet}. A {@link
diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/ConnectionHandler.java b/src/main/java/com/google/cloud/spanner/pgadapter/ConnectionHandler.java
index fa6d940b..b14aeadb 100644
--- a/src/main/java/com/google/cloud/spanner/pgadapter/ConnectionHandler.java
+++ b/src/main/java/com/google/cloud/spanner/pgadapter/ConnectionHandler.java
@@ -38,7 +38,7 @@ import com.google.cloud.spanner.connection.AbstractStatementParser.ParsedStateme
 import com.google.cloud.spanner.connection.AbstractStatementParser.StatementType;
 import com.google.cloud.spanner.connection.Connection;
 import com.google.cloud.spanner.connection.ConnectionOptions;
-import com.google.cloud.spanner.connection.ConnectionOptionsHelper;
+import com.google.cloud.spanner.connection.PGAdapterConnectionOptionsHelper;
 import com.google.cloud.spanner.connection.SavepointSupport;
 import com.google.cloud.spanner.pgadapter.error.PGException;
 import com.google.cloud.spanner.pgadapter.error.PGExceptionFactory;
@@ -203,15 +203,16 @@ public class ConnectionHandler implements Runnable {
     String uri = buildConnectionURL(database, options, getServer().getProperties());
     ConnectionOptions.Builder connectionOptionsBuilder = ConnectionOptions.newBuilder().setUri(uri);
     connectionOptionsBuilder =
-        ConnectionOptionsHelper.maybeAddGrpcLogInterceptor(
+        PGAdapterConnectionOptionsHelper.maybeAddGrpcLogInterceptor(
             connectionOptionsBuilder, options.isLogGrpcMessages());
-    connectionOptionsBuilder = ConnectionOptionsHelper.useDirectExecutor(connectionOptionsBuilder);
+    connectionOptionsBuilder =
+        PGAdapterConnectionOptionsHelper.useDirectExecutor(connectionOptionsBuilder);
     if (credentials != null) {
       connectionOptionsBuilder =
-          ConnectionOptionsHelper.setCredentials(connectionOptionsBuilder, credentials);
+          PGAdapterConnectionOptionsHelper.setCredentials(connectionOptionsBuilder, credentials);
     } else if (options.getCredentials() != null) {
       connectionOptionsBuilder =
-          ConnectionOptionsHelper.setCredentials(
+          PGAdapterConnectionOptionsHelper.setCredentials(
               connectionOptionsBuilder, options.getCredentials());
     }
     SessionPoolOptions sessionPoolOptions =
diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java b/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java
index 4611bdbb..9f2d72fa 100644
--- a/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java
+++ b/src/main/java/com/google/cloud/spanner/pgadapter/statements/BackendConnection.java
@@ -48,7 +48,7 @@ import com.google.cloud.spanner.connection.AbstractStatementParser.ParsedStateme
 import com.google.cloud.spanner.connection.AbstractStatementParser.StatementType;
 import com.google.cloud.spanner.connection.AutocommitDmlMode;
 import com.google.cloud.spanner.connection.Connection;
-import com.google.cloud.spanner.connection.ResultSetHelper;
+import com.google.cloud.spanner.connection.PGAdapterResultSetHelper;
 import com.google.cloud.spanner.connection.StatementResult;
 import com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType;
 import com.google.cloud.spanner.connection.TransactionRetryListener;
@@ -374,7 +374,7 @@ public class BackendConnection {
           try {
             result.set(
                 new QueryResult(
-                    ResultSetHelper.toDirectExecuteResultSet(
+                    PGAdapterResultSetHelper.toDirectExecuteResultSet(
                         spannerConnection
                             .getDatabaseClient()
                             .singleUse()
diff --git a/wrappers/golang/go.mod b/wrappers/golang/go.mod
index 8a29bd3a..5a870d75 100644
--- a/wrappers/golang/go.mod
+++ b/wrappers/golang/go.mod
@@ -2,7 +2,7 @@ module github.com/GoogleCloudPlatform/pgadapter/wrappers/golang
 
 go 1.22
 
-toolchain go1.23.4
+toolchain go1.23.5
 
 require (
 	github.com/docker/docker v27.5.0+incompatible


Test patch:
diff --git a/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsHelperTest.java b/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsHelperTest.java
index 7ce9d201..496cff79 100644
--- a/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsHelperTest.java
+++ b/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsHelperTest.java
@@ -39,7 +39,7 @@ public class ConnectionOptionsHelperTest {
     ConnectionOptions.Builder builder = mock(ConnectionOptions.Builder.class);
     GoogleCredentials credentials = mock(GoogleCredentials.class);
 
-    ConnectionOptionsHelper.setCredentials(builder, credentials);
+    PGAdapterConnectionOptionsHelper.setCredentials(builder, credentials);
 
     verify(builder).setCredentials(credentials);
   }
diff --git a/src/test/java/com/google/cloud/spanner/connection/ResultSetHelperTest.java b/src/test/java/com/google/cloud/spanner/connection/ResultSetHelperTest.java
index 2bb3b85e..23a7240b 100644
--- a/src/test/java/com/google/cloud/spanner/connection/ResultSetHelperTest.java
+++ b/src/test/java/com/google/cloud/spanner/connection/ResultSetHelperTest.java
@@ -14,7 +14,7 @@
 
 package com.google.cloud.spanner.connection;
 
-import static com.google.cloud.spanner.connection.ResultSetHelper.toDirectExecuteResultSet;
+import static com.google.cloud.spanner.connection.PGAdapterResultSetHelper.toDirectExecuteResultSet;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;