This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch branch-1.1
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-1.1 by this push:
     new e536d513c7 [#10373] fix(all): backport JDK8 compatibility fixes to 
branch-1.1 (#10441)
e536d513c7 is described below

commit e536d513c7a4e8c6ba14759e51ed311b3709866b
Author: Qi Yu <[email protected]>
AuthorDate: Mon Mar 16 17:19:01 2026 +0800

    [#10373] fix(all): backport JDK8 compatibility fixes to branch-1.1 (#10441)
    
    ### What changes were made?
    
    Backport commit `63d176b` to `branch-1.1` with branch-compatible
    conflict resolution.
    
    Effective changes on `branch-1.1`:
    - Add Java 8 release setting for JavaCompile tasks in
    `build.gradle.kts`.
    - Replace Java 9+ `@Deprecated(since = ...)` with Java 8-compatible
    `@Deprecated` in `DeleteResponse`.
    - Replace Java 9+ `Map.of(...)` usage with Java 8-compatible
    alternatives in `TestJdbcUrlUtils`.
    
    ### Why are these changes needed?
    
    To ensure branch-1.1 remains compatible with JDK8 for client-related
    build/test paths.
    
    ### How was this patch tested?
    
    - `./gradlew :common:compileJava :common:test --tests
    org.apache.gravitino.utils.TestJdbcUrlUtils
    :flink-connector:flink:compileJava --no-daemon`
    - Build result: `BUILD SUCCESSFUL`
    
    ---------
    
    Co-authored-by: Copilot <[email protected]>
---
 build.gradle.kts                                   |  6 ++++
 .../gravitino/dto/responses/DeleteResponse.java    |  2 +-
 .../apache/gravitino/utils/TestJdbcUrlUtils.java   | 36 ++++++++++++++--------
 3 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index e2b75f13f2..96089d9b8e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -372,6 +372,12 @@ subprojects {
     }
   }
 
+  tasks.withType<JavaCompile>().configureEach {
+    if (compatibleWithJDK8(project)) {
+      options.release.set(8)
+    }
+  }
+
   java {
     toolchain {
       // Some JDK vendors like Homebrew installed OpenJDK 17 have problems in 
building trino-connector:
diff --git 
a/common/src/main/java/org/apache/gravitino/dto/responses/DeleteResponse.java 
b/common/src/main/java/org/apache/gravitino/dto/responses/DeleteResponse.java
index 77f312cc76..4aa59048d1 100644
--- 
a/common/src/main/java/org/apache/gravitino/dto/responses/DeleteResponse.java
+++ 
b/common/src/main/java/org/apache/gravitino/dto/responses/DeleteResponse.java
@@ -26,7 +26,7 @@ import lombok.ToString;
  * Represents a response for a delete operation. This class is deprecated and 
will be removed in
  * future versions, please use {@link DropResponse} instead.
  */
-@Deprecated(since = "1.0.0")
+@Deprecated
 @ToString
 @EqualsAndHashCode(callSuper = true)
 public class DeleteResponse extends BaseResponse {
diff --git 
a/common/src/test/java/org/apache/gravitino/utils/TestJdbcUrlUtils.java 
b/common/src/test/java/org/apache/gravitino/utils/TestJdbcUrlUtils.java
index 24acf4314c..f13f1f6316 100644
--- a/common/src/test/java/org/apache/gravitino/utils/TestJdbcUrlUtils.java
+++ b/common/src/test/java/org/apache/gravitino/utils/TestJdbcUrlUtils.java
@@ -19,7 +19,7 @@
 
 package org.apache.gravitino.utils;
 
-import java.util.Map;
+import java.util.Collections;
 import org.apache.gravitino.exceptions.GravitinoRuntimeException;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
@@ -33,7 +33,7 @@ public class TestJdbcUrlUtils {
             GravitinoRuntimeException.class,
             () ->
                 JdbcUrlUtils.validateJdbcConfig(
-                    "testDriver", "malformed%ZZurl", Map.of("test", "test")));
+                    "testDriver", "malformed%ZZurl", 
Collections.singletonMap("test", "test")));
     Assertions.assertEquals("Unable to decode JDBC URL", gre.getMessage());
   }
 
@@ -43,7 +43,9 @@ public class TestJdbcUrlUtils {
         IllegalArgumentException.class,
         () ->
             JdbcUrlUtils.validateJdbcConfig(
-                null, "jdbc:mysql://localhost:0000/test", Map.of("test", 
"test")));
+                null,
+                "jdbc:mysql://localhost:0000/test",
+                Collections.singletonMap("test", "test")));
   }
 
   @Test
@@ -51,7 +53,9 @@ public class TestJdbcUrlUtils {
     Assertions.assertDoesNotThrow(
         () ->
             JdbcUrlUtils.validateJdbcConfig(
-                "testDriver", "jdbc:mysql://localhost:0000/test", 
Map.of("test", "test")));
+                "testDriver",
+                "jdbc:mysql://localhost:0000/test",
+                Collections.singletonMap("test", "test")));
   }
 
   @Test
@@ -64,7 +68,7 @@ public class TestJdbcUrlUtils {
                 JdbcUrlUtils.validateJdbcConfig(
                     "testDriver",
                     
"jdbc:mysql://localhost:0000/test?allowloadlocalinfile=test",
-                    Map.of("test", "test")));
+                    Collections.singletonMap("test", "test")));
     Assertions.assertEquals(
         "Unsafe MySQL parameter 'allowloadlocalinfile' detected in JDBC URL", 
gre.getMessage());
   }
@@ -78,7 +82,7 @@ public class TestJdbcUrlUtils {
                 JdbcUrlUtils.validateJdbcConfig(
                     "testDriver",
                     "jdbc:mysql://localhost:0000/test",
-                    Map.of("maxAllowedPacket", "maxAllowedPacket")));
+                    Collections.singletonMap("maxAllowedPacket", 
"maxAllowedPacket")));
     Assertions.assertEquals(
         "Unsafe MySQL parameter 'maxAllowedPacket' detected in JDBC URL", 
gre.getMessage());
   }
@@ -88,7 +92,9 @@ public class TestJdbcUrlUtils {
     Assertions.assertDoesNotThrow(
         () ->
             JdbcUrlUtils.validateJdbcConfig(
-                "testDriver", "jdbc:mariadb://localhost:0000/test", 
Map.of("test", "test")));
+                "testDriver",
+                "jdbc:mariadb://localhost:0000/test",
+                Collections.singletonMap("test", "test")));
   }
 
   @Test
@@ -100,7 +106,7 @@ public class TestJdbcUrlUtils {
                 JdbcUrlUtils.validateJdbcConfig(
                     "testDriver",
                     
"jdbc:mariaDB://localhost:0000/test?allowloadlocalinfile=test",
-                    Map.of("test", "test")));
+                    Collections.singletonMap("test", "test")));
     Assertions.assertEquals(
         "Unsafe MariaDB parameter 'allowloadlocalinfile' detected in JDBC 
URL", gre.getMessage());
   }
@@ -110,7 +116,9 @@ public class TestJdbcUrlUtils {
     Assertions.assertDoesNotThrow(
         () ->
             JdbcUrlUtils.validateJdbcConfig(
-                "testDriver", "jdbc:postgresql://localhost:0000/test", 
Map.of("test", "test")));
+                "testDriver",
+                "jdbc:postgresql://localhost:0000/test",
+                Collections.singletonMap("test", "test")));
   }
 
   @Test
@@ -122,7 +130,7 @@ public class TestJdbcUrlUtils {
                 JdbcUrlUtils.validateJdbcConfig(
                     "testDriver",
                     "jdbc:postgresql://localhost:0000/test?socketFactory=test",
-                    Map.of("test", "test")));
+                    Collections.singletonMap("test", "test")));
     Assertions.assertEquals(
         "Unsafe PostgreSQL parameter 'socketFactory' detected in JDBC URL", 
gre.getMessage());
   }
@@ -133,11 +141,15 @@ public class TestJdbcUrlUtils {
         IllegalArgumentException.class,
         () ->
             JdbcUrlUtils.validateJdbcConfig(
-                null, "jdbc:postgresql://localhost:0000/test", Map.of("test", 
"test")));
+                null,
+                "jdbc:postgresql://localhost:0000/test",
+                Collections.singletonMap("test", "test")));
 
     Assertions.assertThrowsExactly(
         IllegalArgumentException.class,
-        () -> JdbcUrlUtils.validateJdbcConfig("testDriver", null, 
Map.of("test", "test")));
+        () ->
+            JdbcUrlUtils.validateJdbcConfig(
+                "testDriver", null, Collections.singletonMap("test", "test")));
 
     Assertions.assertThrowsExactly(
         IllegalArgumentException.class, () -> 
JdbcUrlUtils.validateJdbcConfig(null, null, null));

Reply via email to