You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/08/31 10:47:25 UTC

(shardingsphere) branch master updated: Enhance Spotless rules for source consistency (#39667)

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

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new a3c355d43a1 Enhance Spotless rules for source consistency (#39667)
a3c355d43a1 is described below

commit a3c355d43a18c580ff5f13542898c90d205f400f
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Aug 31 18:47:18 2026 +0800

    Enhance Spotless rules for source consistency (#39667)
---
 .github/workflows/e2e-agent.yml                    |  4 +--
 .github/workflows/nightly-build.yml                | 10 +++----
 .github/workflows/nightly-check.yml                |  4 +--
 .github/workflows/nightly-ci.yml                   |  2 +-
 .github/workflows/nightly-e2e-agent.yml            |  4 +--
 .github/workflows/nightly-e2e-sql.yml              |  2 +-
 .../core/builder/AgentBuilderFactoryTest.java      |  3 +-
 .../util/ShardingValueTypeConvertUtils.java        | 34 ++++++++++++----------
 .../select/pagination/PaginationContext.java       |  5 ++--
 .../pool/creator/DataSourcePoolCreatorTest.java    |  3 +-
 .../infra/executor/sql/log/SQLLoggerTest.java      |  3 +-
 .../data/pipeline/cdc/CDCJobTest.java              |  3 +-
 .../impl/LiteralExpressionConverterTest.java       |  3 +-
 .../metadata/refresher/util/TableRefreshUtils.java |  3 +-
 .../AlterIndexPushDownMetaDataRefresherTest.java   |  3 +-
 .../cluster/zookeeper/ZookeeperRepositoryTest.java |  3 +-
 .../sql/parser/engine/core/ParseASTNodeTest.java   |  2 +-
 .../statement/type/HiveDDLStatementVisitor.java    |  9 +++---
 pom.xml                                            | 13 +++++++++
 .../simple/OpenGaussComQueryExecutorTest.java      |  3 +-
 .../e2e/sql/env/DataSetEnvironmentManager.java     |  2 +-
 21 files changed, 72 insertions(+), 46 deletions(-)

diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml
index 7ea83ae38c5..3645c60af08 100644
--- a/.github/workflows/e2e-agent.yml
+++ b/.github/workflows/e2e-agent.yml
@@ -50,7 +50,7 @@ jobs:
   global-environment:
     name: Import Global Environment
     uses: ./.github/workflows/required-reusable.yml
-  
+
   build-e2e-image:
     if: github.repository == 'apache/shardingsphere'
     name: Build E2E Image
@@ -90,7 +90,7 @@ jobs:
           name: jdbc-e2e-image
           path: /tmp/apache-shardingsphere-jdbc-agent-test.tar
           retention-days: 10
-          
+
   agent-mysql:
     name: E2E - Agent with MySQL
     if: github.repository == 'apache/shardingsphere'
diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml
index 2522dafb34c..5c589fb163a 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -45,7 +45,7 @@ jobs:
   global-environment:
     name: Import Global Environment
     uses: ./.github/workflows/required-reusable.yml
-  
+
   upload-to-nightlies:
     if: github.repository == 'apache/shardingsphere'
     name: Upload to Nightly Builds
@@ -67,7 +67,7 @@ jobs:
           path: distribution/proxy/target/apache-shardingsphere-*.tar.gz
           if-no-files-found: error
           retention-days: 7
-  
+
   build-proxy-image:
     if: github.repository == 'apache/shardingsphere'
     name: Build Proxy Image
@@ -94,7 +94,7 @@ jobs:
       - uses: docker/setup-buildx-action@v3
       - name: Push Docker Image
         run: ./mvnw -am -pl distribution/proxy -B -Prelease,default-dep,docker.buildx.push -DskipTests -Dproxy.image.repository=${{ env.PROXY }} -Dproxy.image.tag=${{ github.run_id }} clean install
-  
+
   build-proxy-native-image:
     if: github.repository == 'apache/shardingsphere'
     name: Build Proxy Native Image
@@ -155,7 +155,7 @@ jobs:
       - name: Push Docker Image
         run: |
           ./mvnw -am -pl distribution/agent -Prelease,default-dep,docker.buildx.push -B -T1C -DskipTests -Dagent.image.repository=${{ env.AGENT }} -Dagent.image.tag=${{ github.run_id }} clean package
-  
+
   build-cache:
     if: github.repository == 'apache/shardingsphere'
     name: Build Project Cache
@@ -169,7 +169,7 @@ jobs:
           cache-prefix: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Build with Maven
         run: ./mvnw clean install -B -ntp -T1C -DskipTests
-  
+
   generate-and-test-examples:
     name: Example-${{ matrix.feature }}-${{ matrix.framework }}-${{ matrix.mode }}-${{ matrix.transaction }}
     if: github.repository == 'apache/shardingsphere'
diff --git a/.github/workflows/nightly-check.yml b/.github/workflows/nightly-check.yml
index 3f39c306ef2..85eaffe4d5c 100644
--- a/.github/workflows/nightly-check.yml
+++ b/.github/workflows/nightly-check.yml
@@ -50,7 +50,7 @@ jobs:
           cache-prefix: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}
       - name: Run SpotBugs
         run: ./mvnw clean install spotbugs:check -Pcheck -T1C
-  
+
   check-dead-links:
     if: github.repository == 'apache/shardingsphere'
     name: Check - Dead Links
@@ -63,7 +63,7 @@ jobs:
         run: |
           IGNORED_PATH_LIST=("./docs/document/themes" "./docs/community/content/powered-by" "./docs/blog/content/material" "./docs/blog/themes" "./docs/community/themes")
           ignore_current_file=false
-          
+
           for file in $(find . -name "*.md"); do
             for ignored_path in ${IGNORED_PATH_LIST[@]}
               do
diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml
index 09f92c46933..971b8bc101b 100644
--- a/.github/workflows/nightly-ci.yml
+++ b/.github/workflows/nightly-ci.yml
@@ -36,7 +36,7 @@ jobs:
   global-environment:
     name: Import Global Environment
     uses: ./.github/workflows/required-reusable.yml
-  
+
   ci:
     if: ${{ needs.global-environment.outputs.GLOBAL_JOB_ENABLED == 'true' }}
     name: CI - JDK ${{ matrix.java-version }} on ${{ matrix.os }}
diff --git a/.github/workflows/nightly-e2e-agent.yml b/.github/workflows/nightly-e2e-agent.yml
index b0e50939d13..3ee15d6861d 100644
--- a/.github/workflows/nightly-e2e-agent.yml
+++ b/.github/workflows/nightly-e2e-agent.yml
@@ -36,7 +36,7 @@ jobs:
   global-environment:
     name: Import Global Environment
     uses: ./.github/workflows/required-reusable.yml
-  
+
   build-e2e-image:
     if: github.repository == 'apache/shardingsphere'
     name: Build E2E Image
@@ -76,7 +76,7 @@ jobs:
           name: jdbc-e2e-image
           path: /tmp/apache-shardingsphere-jdbc-agent-test.tar
           retention-days: 10
-          
+
   agent-mysql:
     name: E2E - Agent with MySQL
     if: github.repository == 'apache/shardingsphere'
diff --git a/.github/workflows/nightly-e2e-sql.yml b/.github/workflows/nightly-e2e-sql.yml
index 0685e02a8ac..19c1b33a250 100644
--- a/.github/workflows/nightly-e2e-sql.yml
+++ b/.github/workflows/nightly-e2e-sql.yml
@@ -60,7 +60,7 @@ jobs:
           cache-primary-key: ${{ steps.setup-build-environment.outputs.cache-primary-key }}
       - uses: ./.github/workflows/resources/actions/upload-source-snapshot
       - uses: ./.github/workflows/resources/actions/upload-e2e-artifacts
-  
+
   e2e-sql:
     name: E2E - SQL
     needs: [ prepare-e2e-artifacts, global-environment ]
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java
index 0b15af44f33..45ccdac30b7 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.agent.core.builder;
 
+import net.bytebuddy.ByteBuddy;
 import net.bytebuddy.agent.ByteBuddyAgent;
 import net.bytebuddy.agent.builder.AgentBuilder;
 import net.bytebuddy.agent.builder.ResettableClassFileTransformer;
@@ -55,7 +56,7 @@ class AgentBuilderFactoryTest {
         Map<String, AdvisorConfiguration> advisorConfigs = Collections.singletonMap(advisorConfig.getTargetClassName(), advisorConfig);
         AgentBuilder agentBuilder = AgentBuilderFactory.create(Collections.emptyMap(), Collections.emptyList(), advisorConfigs, true);
         agent = agentBuilder.installOnByteBuddyAgent();
-        targetClass = new net.bytebuddy.ByteBuddy().redefine(TargetObjectFixture.class)
+        targetClass = new ByteBuddy().redefine(TargetObjectFixture.class)
                 .name(TARGET_CLASS_NAME)
                 .make()
                 .load(AgentBuilderFactoryTest.class.getClassLoader(), ClassLoadingStrategy.Default.INJECTION)
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/util/ShardingValueTypeConvertUtils.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/util/ShardingValueTypeConvertUtils.java
index f4df58f7a2c..cff95a8f34f 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/util/ShardingValueTypeConvertUtils.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/util/ShardingValueTypeConvertUtils.java
@@ -22,6 +22,8 @@ import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.LocalDate;
@@ -99,9 +101,9 @@ public final class ShardingValueTypeConvertUtils {
             return (T) convertToDate(value);
         } else if (java.sql.Date.class == targetType) {
             return (T) convertToSqlDate(value);
-        } else if (java.sql.Time.class == targetType) {
+        } else if (Time.class == targetType) {
             return (T) convertToSqlTime(value);
-        } else if (java.sql.Timestamp.class == targetType) {
+        } else if (Timestamp.class == targetType) {
             return (T) convertToTimestamp(value);
         } else if (LocalDate.class == targetType) {
             return (T) convertToLocalDate(value);
@@ -257,12 +259,12 @@ public final class ShardingValueTypeConvertUtils {
         return new java.sql.Date(parseInstant(value.toString()).toEpochMilli());
     }
     
-    private static java.sql.Time convertToSqlTime(final Comparable<?> value) {
-        if (value instanceof java.sql.Time) {
-            return (java.sql.Time) value;
+    private static Time convertToSqlTime(final Comparable<?> value) {
+        if (value instanceof Time) {
+            return (Time) value;
         }
         if (value instanceof Date) {
-            return new java.sql.Time(((Date) value).getTime());
+            return new Time(((Date) value).getTime());
         }
         if (value instanceof LocalTime) {
             return java.sql.Time.valueOf((LocalTime) value);
@@ -271,17 +273,17 @@ public final class ShardingValueTypeConvertUtils {
             return java.sql.Time.valueOf(((LocalDateTime) value).toLocalTime());
         }
         if (value instanceof Number) {
-            return new java.sql.Time(((Number) value).longValue());
+            return new Time(((Number) value).longValue());
         }
         return java.sql.Time.valueOf(parseLocalTime(value.toString()));
     }
     
-    private static java.sql.Timestamp convertToTimestamp(final Comparable<?> value) {
-        if (value instanceof java.sql.Timestamp) {
-            return (java.sql.Timestamp) value;
+    private static Timestamp convertToTimestamp(final Comparable<?> value) {
+        if (value instanceof Timestamp) {
+            return (Timestamp) value;
         }
         if (value instanceof Date) {
-            return new java.sql.Timestamp(((Date) value).getTime());
+            return new Timestamp(((Date) value).getTime());
         }
         if (value instanceof LocalDateTime) {
             return java.sql.Timestamp.valueOf((LocalDateTime) value);
@@ -290,7 +292,7 @@ public final class ShardingValueTypeConvertUtils {
             return java.sql.Timestamp.from((Instant) value);
         }
         if (value instanceof Number) {
-            return new java.sql.Timestamp(((Number) value).longValue());
+            return new Timestamp(((Number) value).longValue());
         }
         return java.sql.Timestamp.from(parseInstant(value.toString()));
     }
@@ -324,8 +326,8 @@ public final class ShardingValueTypeConvertUtils {
         if (value instanceof LocalDateTime) {
             return ((LocalDateTime) value).toLocalTime();
         }
-        if (value instanceof java.sql.Time) {
-            return ((java.sql.Time) value).toLocalTime();
+        if (value instanceof Time) {
+            return ((Time) value).toLocalTime();
         }
         if (value instanceof Date) {
             return ((Date) value).toInstant().atZone(ZoneId.systemDefault()).toLocalTime();
@@ -346,8 +348,8 @@ public final class ShardingValueTypeConvertUtils {
         if (value instanceof Date) {
             return ((Date) value).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
         }
-        if (value instanceof java.sql.Timestamp) {
-            return ((java.sql.Timestamp) value).toLocalDateTime();
+        if (value instanceof Timestamp) {
+            return ((Timestamp) value).toLocalDateTime();
         }
         if (value instanceof Instant) {
             return LocalDateTime.ofInstant((Instant) value, ZoneId.systemDefault());
diff --git a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java
index 7d304870cc3..01345a96d7e 100644
--- a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java
+++ b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java
@@ -32,6 +32,7 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.paginatio
 import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.rownum.ExpressionRowNumberValueSegment;
 
 import java.nio.charset.StandardCharsets;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Optional;
 
@@ -121,8 +122,8 @@ public final class PaginationContext {
         if (null != caseWhenExpression.getCaseExpr()) {
             return null;
         }
-        java.util.Iterator<ExpressionSegment> whenIterator = caseWhenExpression.getWhenExprs().iterator();
-        java.util.Iterator<ExpressionSegment> thenIterator = caseWhenExpression.getThenExprs().iterator();
+        Iterator<ExpressionSegment> whenIterator = caseWhenExpression.getWhenExprs().iterator();
+        Iterator<ExpressionSegment> thenIterator = caseWhenExpression.getThenExprs().iterator();
         while (whenIterator.hasNext() && thenIterator.hasNext()) {
             Boolean whenValue = getBooleanValueFromExpression(whenIterator.next(), params);
             if (Boolean.TRUE.equals(whenValue)) {
diff --git a/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java b/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java
index f7e8e22a6e3..af01eac250f 100644
--- a/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java
+++ b/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java
@@ -38,6 +38,7 @@ import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.MockedStatic;
+import org.mockito.exceptions.verification.WantedButNotInvoked;
 
 import javax.sql.DataSource;
 import java.sql.SQLException;
@@ -175,7 +176,7 @@ class DataSourcePoolCreatorTest {
         MockedDataSource actual = (MockedDataSource) DataSourcePoolCreator.create(
                 "foo_ds", new DataSourcePoolProperties(MockedDataSource.class.getName(), createMockedDataSourceProperties()), false, Collections.singleton(storageNode));
         assertMockedDataSource(actual);
-        assertThrows(org.mockito.exceptions.verification.WantedButNotInvoked.class, () -> org.mockito.Mockito.verify(storageNode).close());
+        assertThrows(WantedButNotInvoked.class, () -> org.mockito.Mockito.verify(storageNode).close());
     }
     
     @Test
diff --git a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
index 5dd65e77ea3..65ce544959b 100644
--- a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
+++ b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.infra.executor.sql.log;
 
 import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.read.ListAppender;
 import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
@@ -63,7 +64,7 @@ class SQLLoggerTest {
     @SuppressWarnings({"unchecked", "rawtypes"})
     @BeforeAll
     static void setupLogger() {
-        ch.qos.logback.classic.Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger("org.apache.shardingsphere.sql");
+        Logger log = (Logger) LoggerFactory.getLogger("org.apache.shardingsphere.sql");
         ListAppender<LoggingEvent> appender = (ListAppender) log.getAppender("SQLLoggerTestAppender");
         appenderList = appender.list;
     }
diff --git a/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/CDCJobTest.java b/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/CDCJobTest.java
index 6453434abc4..eac44d4a422 100644
--- a/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/CDCJobTest.java
+++ b/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/CDCJobTest.java
@@ -28,6 +28,7 @@ import org.apache.shardingsphere.data.pipeline.cdc.core.prepare.CDCJobPreparer;
 import org.apache.shardingsphere.data.pipeline.cdc.generator.CDCResponseUtils;
 import org.apache.shardingsphere.data.pipeline.cdc.protocol.response.CDCResponse;
 import org.apache.shardingsphere.data.pipeline.core.context.PipelineContextKey;
+import org.apache.shardingsphere.data.pipeline.core.context.PipelineJobItemContext;
 import org.apache.shardingsphere.data.pipeline.core.datanode.JobDataNodeEntry;
 import org.apache.shardingsphere.data.pipeline.core.datanode.JobDataNodeLine;
 import org.apache.shardingsphere.data.pipeline.core.datasource.config.PipelineDataSourceConfigurationFactory;
@@ -146,7 +147,7 @@ class CDCJobTest {
             when(PipelineDataSourceConfigurationFactory.newInstance(anyString(), anyString())).thenReturn(mock(PipelineDataSourceConfiguration.class));
             CDCJob job = new CDCJob(mock(PipelineSink.class));
             PipelineTasksRunner tasksRunner = mock(PipelineTasksRunner.class);
-            when(tasksRunner.getJobItemContext()).thenReturn(mock(org.apache.shardingsphere.data.pipeline.core.context.PipelineJobItemContext.class));
+            when(tasksRunner.getJobItemContext()).thenReturn(mock(PipelineJobItemContext.class));
             job.getJobRunnerManager().addTasksRunner(0, tasksRunner);
             try (MockedStatic<PipelineExecuteEngine> triggerMocked = mockStatic(PipelineExecuteEngine.class)) {
                 job.execute(shardingContext);
diff --git a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
index 07739dc1db0..23ceeb9ca4f 100644
--- a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
+++ b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/sql/ast/converter/segment/expression/impl/LiteralExpressionConverterTest.java
@@ -25,6 +25,7 @@ import org.apache.calcite.util.TimeString;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
 import org.junit.jupiter.api.Test;
 
+import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.time.LocalDate;
@@ -141,7 +142,7 @@ class LiteralExpressionConverterTest {
     
     @Test
     void assertConvertUtilDate() {
-        java.sql.Date date = java.sql.Date.valueOf("2020-01-01");
+        Date date = java.sql.Date.valueOf("2020-01-01");
         SqlLiteral actual = (SqlLiteral) LiteralExpressionConverter.convert(new LiteralExpressionSegment(0, 0, date), null).orElse(null);
         assertNotNull(actual);
         assertThat(actual.getTypeName(), is(SqlTypeName.DATE));
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/util/TableRefreshUtils.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/util/TableRefreshUtils.java
index c7e00f94aaa..2c1099b3fa4 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/util/TableRefreshUtils.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/util/TableRefreshUtils.java
@@ -42,6 +42,7 @@ import java.util.Collection;
 import java.util.LinkedList;
 import java.util.Optional;
 import java.util.function.Function;
+import java.util.stream.Stream;
 
 /**
  * Table refresh utility class.
@@ -266,7 +267,7 @@ public final class TableRefreshUtils {
     
     private static String getActualObjectName(final ShardingSphereDatabase database, final String schemaName,
                                               final IdentifierValue objectIdentifierValue,
-                                              final IdentifierScope scope, final Function<ShardingSphereSchema, java.util.stream.Stream<String>> actualNameStream) {
+                                              final IdentifierScope scope, final Function<ShardingSphereSchema, Stream<String>> actualNameStream) {
         String actualSchemaName = SchemaRefreshUtils.getActualSchemaName(database, new IdentifierValue(schemaName));
         ShardingSphereSchema schema = database.getSchema(actualSchemaName);
         if (null != schema) {
diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/refresher/pushdown/type/index/AlterIndexPushDownMetaDataRefresherTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/refresher/pushdown/type/index/AlterIndexPushDownMetaDataRefresherTest.java
index e3d65d6f948..da4e30044b3 100644
--- a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/refresher/pushdown/type/index/AlterIndexPushDownMetaDataRefresherTest.java
+++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/refresher/pushdown/type/index/AlterIndexPushDownMetaDataRefresherTest.java
@@ -35,6 +35,7 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.in
 import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
 import org.junit.jupiter.api.Test;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Properties;
 
@@ -86,7 +87,7 @@ class AlterIndexPushDownMetaDataRefresherTest {
         return new AlterIndexStatement(databaseType, index, new IndexSegment(0, 0, new IndexNameSegment(0, 0, new IdentifierValue("idx_new"))), null);
     }
     
-    private ShardingSphereDatabase createDatabase(final java.util.Collection<ShardingSphereSchema> schemas) {
+    private ShardingSphereDatabase createDatabase(final Collection<ShardingSphereSchema> schemas) {
         return new ShardingSphereDatabase("foo_db", databaseType, new ResourceMetaData(Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), schemas,
                 new ConfigurationProperties(new Properties()));
     }
diff --git a/mode/type/cluster/repository/provider/zookeeper/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/ZookeeperRepositoryTest.java b/mode/type/cluster/repository/provider/zookeeper/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/ZookeeperRepositoryTest.java
index e68a96f2c2a..0ff1077d963 100644
--- a/mode/type/cluster/repository/provider/zookeeper/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/ZookeeperRepositoryTest.java
+++ b/mode/type/cluster/repository/provider/zookeeper/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/ZookeeperRepositoryTest.java
@@ -39,6 +39,7 @@ import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.internal.configuration.plugins.Plugins;
 
+import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.nio.charset.StandardCharsets;
@@ -341,7 +342,7 @@ class ZookeeperRepositoryTest {
             }
         }
         
-        private final class CreateInvocationHandler implements java.lang.reflect.InvocationHandler {
+        private final class CreateInvocationHandler implements InvocationHandler {
             
             private CreateMode createMode = CreateMode.PERSISTENT;
             
diff --git a/parser/sql/engine/core/src/test/java/org/apache/shardingsphere/sql/parser/engine/core/ParseASTNodeTest.java b/parser/sql/engine/core/src/test/java/org/apache/shardingsphere/sql/parser/engine/core/ParseASTNodeTest.java
index f54c0b78713..a8b0b7fc602 100644
--- a/parser/sql/engine/core/src/test/java/org/apache/shardingsphere/sql/parser/engine/core/ParseASTNodeTest.java
+++ b/parser/sql/engine/core/src/test/java/org/apache/shardingsphere/sql/parser/engine/core/ParseASTNodeTest.java
@@ -187,7 +187,7 @@ class ParseASTNodeTest {
         return result;
     }
     
-    private static CommonTokenStream createMergeCapableTokenStream(final java.util.List<Token> tokens, final int intervalStart, final int intervalStop, final String mergedText) {
+    private static CommonTokenStream createMergeCapableTokenStream(final List<Token> tokens, final int intervalStart, final int intervalStop, final String mergedText) {
         CommonTokenStream result = mock(CommonTokenStream.class);
         when(result.getTokens()).thenReturn(tokens);
         TokenSource tokenSource = mock(TokenSource.class);
diff --git a/parser/sql/engine/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/engine/hive/visitor/statement/type/HiveDDLStatementVisitor.java b/parser/sql/engine/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/engine/hive/visitor/statement/type/HiveDDLStatementVisitor.java
index 1fea72cdd32..95d65760a90 100644
--- a/parser/sql/engine/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/engine/hive/visitor/statement/type/HiveDDLStatementVisitor.java
+++ b/parser/sql/engine/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/engine/hive/visitor/statement/type/HiveDDLStatementVisitor.java
@@ -70,6 +70,7 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.Tab
 import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.DataTypeSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
 import org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.TruncateStatement;
@@ -280,7 +281,7 @@ public final class HiveDDLStatementVisitor extends HiveStatementVisitor implemen
     
     @Override
     public ASTNode visitAddColumns(final AddColumnsContext ctx) {
-        java.util.Collection<ColumnDefinitionSegment> cols = new java.util.LinkedList<>();
+        Collection<ColumnDefinitionSegment> cols = new LinkedList<>();
         for (ColumnDefinitionContext each : ctx.columnDefinition()) {
             cols.add((ColumnDefinitionSegment) visit(each));
         }
@@ -289,7 +290,7 @@ public final class HiveDDLStatementVisitor extends HiveStatementVisitor implemen
     
     @Override
     public ASTNode visitReplaceColumns(final ReplaceColumnsContext ctx) {
-        java.util.Collection<ColumnDefinitionSegment> cols = new java.util.LinkedList<>();
+        Collection<ColumnDefinitionSegment> cols = new LinkedList<>();
         for (ColumnDefinitionContext each : ctx.columnDefinition()) {
             cols.add((ColumnDefinitionSegment) visit(each));
         }
@@ -327,7 +328,7 @@ public final class HiveDDLStatementVisitor extends HiveStatementVisitor implemen
         } else {
             SimpleTableSegment result = new SimpleTableSegment(new TableNameSegment(ctx.identifier(1).getStart().getStartIndex(),
                     ctx.identifier(1).getStop().getStopIndex(), new IdentifierValue(ctx.identifier(1).getText())));
-            result.setOwner(new org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment(
+            result.setOwner(new OwnerSegment(
                     ctx.identifier(0).getStart().getStartIndex(), ctx.identifier(0).getStop().getStopIndex(),
                     new IdentifierValue(ctx.identifier(0).getText())));
             return result;
@@ -366,7 +367,7 @@ public final class HiveDDLStatementVisitor extends HiveStatementVisitor implemen
         } else {
             SimpleTableSegment result = new SimpleTableSegment(new TableNameSegment(ctx.identifier(1).getStart().getStartIndex(),
                     ctx.identifier(1).getStop().getStopIndex(), new IdentifierValue(ctx.identifier(1).getText())));
-            result.setOwner(new org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment(
+            result.setOwner(new OwnerSegment(
                     ctx.identifier(0).getStart().getStartIndex(), ctx.identifier(0).getStop().getStopIndex(),
                     new IdentifierValue(ctx.identifier(0).getText())));
             return result;
diff --git a/pom.xml b/pom.xml
index 29816e5e3bf..64f5810c727 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1321,12 +1321,25 @@
                             <artifactId>spotless-maven-plugin</artifactId>
                             <version>${spotless-maven-plugin.version}</version>
                             <configuration>
+                                <formats>
+                                    <format>
+                                        <includes>
+                                            <include>.github/workflows/**/*.yml</include>
+                                        </includes>
+                                        <trimTrailingWhitespace />
+                                        <endWithNewline />
+                                    </format>
+                                </formats>
                                 <java>
+                                    <shortenFullyQualifiedTypes />
                                     <eclipse>
                                         <version>4.40</version>
                                         <!--suppress MavenModelInspection -->
                                         <file>${maven.multiModuleProjectDirectory}/src/resources/spotless/java.xml</file>
                                     </eclipse>
+                                    <removeUnusedImports>
+                                        <engine>google-java-format</engine>
+                                    </removeUnusedImports>
                                     <licenseHeader>
                                         <!--suppress MavenModelInspection -->
                                         <file>${maven.multiModuleProjectDirectory}/src/resources/spotless/copyright.txt</file>
diff --git a/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/simple/OpenGaussComQueryExecutorTest.java b/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/simple/OpenGaussComQueryExecutorTest.java
index 0c174539236..f0abfd719e8 100644
--- a/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/simple/OpenGaussComQueryExecutorTest.java
+++ b/proxy/frontend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/simple/OpenGaussComQueryExecutorTest.java
@@ -21,6 +21,7 @@ import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
 import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
 import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.PostgreSQLColumnDescription;
 import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.PostgreSQLDataRowPacket;
+import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.PostgreSQLEmptyQueryResponsePacket;
 import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.PostgreSQLRowDescriptionPacket;
 import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.simple.PostgreSQLComQueryPacket;
 import org.apache.shardingsphere.database.protocol.postgresql.packet.generic.PostgreSQLCommandCompletePacket;
@@ -166,7 +167,7 @@ class OpenGaussComQueryExecutorTest {
     void assertExecuteUpdateWithEmptyStatementReturnsEmptyQueryResponse() throws SQLException {
         when(proxyBackendHandler.execute()).thenReturn(new UpdateResponseHeader(new EmptyStatement(databaseType)));
         Collection<DatabasePacket> actualPackets = queryExecutor.execute();
-        assertThat(new LinkedList<>(actualPackets).getFirst(), is(isA(org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.PostgreSQLEmptyQueryResponsePacket.class)));
+        assertThat(new LinkedList<>(actualPackets).getFirst(), is(isA(PostgreSQLEmptyQueryResponsePacket.class)));
         assertThat(queryExecutor.getResponseType(), is(ResponseType.UPDATE));
     }
     
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/env/DataSetEnvironmentManager.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/env/DataSetEnvironmentManager.java
index 88acda02182..2f4f641574f 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/env/DataSetEnvironmentManager.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/env/DataSetEnvironmentManager.java
@@ -375,7 +375,7 @@ public final class DataSetEnvironmentManager {
         private void setParameters(final PreparedStatement preparedStatement, final SQLValueGroup sqlValueGroup) throws SQLException {
             for (SQLValue each : sqlValueGroup.getValues()) {
                 if ("Hive".equalsIgnoreCase(databaseType.getType()) && each.getValue() instanceof Date) {
-                    preparedStatement.setDate(each.getIndex(), (java.sql.Date) each.getValue());
+                    preparedStatement.setDate(each.getIndex(), (Date) each.getValue());
                 } else {
                     preparedStatement.setObject(each.getIndex(), each.getValue());
                 }