This is an automated email from the ASF dual-hosted git repository. snazy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push: new 0faf948c4 Removing star import and adding errorprone rule (#1831) 0faf948c4 is described below commit 0faf948c482ca1177da8e3016bfaa28b85f0f3ea Author: gfakbar20 <gfakba...@gmail.com> AuthorDate: Thu Jun 12 16:14:02 2025 +0700 Removing star import and adding errorprone rule (#1831) Fixes #1100 --- codestyle/errorprone-rules.properties | 3 +++ .../persistence/impl/eclipselink/PolarisSequenceUtil.java | 2 +- .../polaris/persistence/relational/jdbc/QueryGenerator.java | 8 +++++++- .../polaris/persistence/relational/jdbc/QueryGeneratorTest.java | 7 ++++++- .../org/apache/polaris/spark/quarkus/it/SparkCatalogBaseIT.java | 9 ++++++++- .../transactional/TransactionalMetaStoreManagerImpl.java | 6 +++++- .../service/quarkus/storage/QuarkusStorageConfiguration.java | 2 +- .../service/quarkus/catalog/AccessDelegationModeTest.java | 2 +- .../apache/polaris/service/quarkus/catalog/GetConfigTest.java | 7 ++++++- .../org/apache/polaris/service/storage/StorageConfiguration.java | 3 ++- .../org/apache/polaris/service/catalog/io/FileIOFactoryTest.java | 3 ++- .../apache/polaris/service/storage/StorageConfigurationTest.java | 5 ++++- .../org/apache/polaris/misc/types/memorysize/MemorySize.java | 2 +- 13 files changed, 47 insertions(+), 12 deletions(-) diff --git a/codestyle/errorprone-rules.properties b/codestyle/errorprone-rules.properties index 1322ce766..079e2c03d 100644 --- a/codestyle/errorprone-rules.properties +++ b/codestyle/errorprone-rules.properties @@ -294,3 +294,6 @@ UnnecessaryBoxedVariable=ERROR UseEnumSwitch=ERROR # Prefer using a switch instead of a chained if-else for enums + +WildcardImport=ERROR +# Wildcard imports, static or otherwise, should not be used diff --git a/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisSequenceUtil.java b/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisSequenceUtil.java index 48582dd3c..ba1ec9f1f 100644 --- a/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisSequenceUtil.java +++ b/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisSequenceUtil.java @@ -18,7 +18,7 @@ */ package org.apache.polaris.extension.persistence.impl.eclipselink; -import jakarta.persistence.*; +import jakarta.persistence.EntityManager; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelSequenceId; diff --git a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java b/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java index 1ba2ae283..ecd5b2783 100644 --- a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java +++ b/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java @@ -20,7 +20,13 @@ package org.apache.polaris.persistence.relational.jdbc; import com.google.common.annotations.VisibleForTesting; import jakarta.annotation.Nonnull; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; import org.apache.polaris.core.entity.PolarisEntityCore; import org.apache.polaris.core.entity.PolarisEntityId; diff --git a/persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/QueryGeneratorTest.java b/persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/QueryGeneratorTest.java index d1b71b841..c7a589ca5 100644 --- a/persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/QueryGeneratorTest.java +++ b/persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/QueryGeneratorTest.java @@ -23,7 +23,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.polaris.core.entity.PolarisEntityCore; import org.apache.polaris.core.entity.PolarisEntityId; import org.apache.polaris.persistence.relational.jdbc.models.ModelEntity; diff --git a/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkCatalogBaseIT.java b/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkCatalogBaseIT.java index 2e8d0e4a9..23f2f1f5f 100644 --- a/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkCatalogBaseIT.java +++ b/plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkCatalogBaseIT.java @@ -31,7 +31,14 @@ import org.apache.iceberg.exceptions.NamespaceNotEmptyException; import org.apache.iceberg.spark.SupportsReplaceView; import org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException; import org.apache.spark.sql.catalyst.analysis.NoSuchViewException; -import org.apache.spark.sql.connector.catalog.*; +import org.apache.spark.sql.connector.catalog.CatalogPlugin; +import org.apache.spark.sql.connector.catalog.Identifier; +import org.apache.spark.sql.connector.catalog.NamespaceChange; +import org.apache.spark.sql.connector.catalog.StagingTableCatalog; +import org.apache.spark.sql.connector.catalog.SupportsNamespaces; +import org.apache.spark.sql.connector.catalog.View; +import org.apache.spark.sql.connector.catalog.ViewCatalog; +import org.apache.spark.sql.connector.catalog.ViewChange; import org.apache.spark.sql.types.StructType; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java b/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java index 71686165d..a81566c99 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java @@ -47,7 +47,11 @@ import org.apache.polaris.core.entity.PolarisGrantRecord; import org.apache.polaris.core.entity.PolarisPrincipalSecrets; import org.apache.polaris.core.entity.PolarisPrivilege; import org.apache.polaris.core.entity.PolarisTaskConstants; -import org.apache.polaris.core.persistence.*; +import org.apache.polaris.core.persistence.BaseMetaStoreManager; +import org.apache.polaris.core.persistence.PolarisMetaStoreManager; +import org.apache.polaris.core.persistence.PolarisObjectMapperUtil; +import org.apache.polaris.core.persistence.PolicyMappingAlreadyExistsException; +import org.apache.polaris.core.persistence.RetryOnConcurrencyException; import org.apache.polaris.core.persistence.dao.entity.BaseResult; import org.apache.polaris.core.persistence.dao.entity.ChangeTrackingResult; import org.apache.polaris.core.persistence.dao.entity.CreateCatalogResult; diff --git a/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/storage/QuarkusStorageConfiguration.java b/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/storage/QuarkusStorageConfiguration.java index 975c74d22..e18b2ed19 100644 --- a/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/storage/QuarkusStorageConfiguration.java +++ b/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/storage/QuarkusStorageConfiguration.java @@ -21,7 +21,7 @@ package org.apache.polaris.service.quarkus.storage; import io.smallrye.config.ConfigMapping; import io.smallrye.config.WithName; import java.time.Duration; -import java.util.*; +import java.util.Optional; import org.apache.polaris.service.storage.StorageConfiguration; @ConfigMapping(prefix = "polaris.storage") diff --git a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AccessDelegationModeTest.java b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AccessDelegationModeTest.java index 1a24fe3ae..e26eb5711 100644 --- a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AccessDelegationModeTest.java +++ b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AccessDelegationModeTest.java @@ -18,8 +18,8 @@ */ package org.apache.polaris.service.quarkus.catalog; -import static org.apache.polaris.service.catalog.AccessDelegationMode.*; import static org.apache.polaris.service.catalog.AccessDelegationMode.REMOTE_SIGNING; +import static org.apache.polaris.service.catalog.AccessDelegationMode.UNKNOWN; import static org.apache.polaris.service.catalog.AccessDelegationMode.VENDED_CREDENTIALS; import static org.apache.polaris.service.catalog.AccessDelegationMode.fromProtocolValuesList; import static org.assertj.core.api.Assertions.assertThat; diff --git a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/GetConfigTest.java b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/GetConfigTest.java index 858edb1fa..91b88d6b1 100644 --- a/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/GetConfigTest.java +++ b/quarkus/service/src/test/java/org/apache/polaris/service/quarkus/catalog/GetConfigTest.java @@ -26,7 +26,12 @@ import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.iceberg.rest.responses.ConfigResponse; -import org.apache.polaris.core.admin.model.*; +import org.apache.polaris.core.admin.model.Catalog; +import org.apache.polaris.core.admin.model.CatalogProperties; +import org.apache.polaris.core.admin.model.CreateCatalogRequest; +import org.apache.polaris.core.admin.model.FileStorageConfigInfo; +import org.apache.polaris.core.admin.model.PolarisCatalog; +import org.apache.polaris.core.admin.model.StorageConfigInfo; import org.apache.polaris.core.rest.PolarisEndpoints; import org.apache.polaris.service.TestServices; import org.junit.jupiter.params.ParameterizedTest; diff --git a/service/common/src/main/java/org/apache/polaris/service/storage/StorageConfiguration.java b/service/common/src/main/java/org/apache/polaris/service/storage/StorageConfiguration.java index 5db8d1586..fbe3061d4 100644 --- a/service/common/src/main/java/org/apache/polaris/service/storage/StorageConfiguration.java +++ b/service/common/src/main/java/org/apache/polaris/service/storage/StorageConfiguration.java @@ -24,7 +24,8 @@ import com.google.common.base.Suppliers; import java.io.IOException; import java.time.Duration; import java.time.Instant; -import java.util.*; +import java.util.Date; +import java.util.Optional; import java.util.function.Supplier; import org.slf4j.LoggerFactory; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; diff --git a/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java b/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java index ee47c14f2..9928e00d1 100644 --- a/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java +++ b/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java @@ -44,7 +44,8 @@ import org.apache.polaris.core.admin.model.PolarisCatalog; import org.apache.polaris.core.admin.model.StorageConfigInfo; import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.context.RealmContext; -import org.apache.polaris.core.entity.*; +import org.apache.polaris.core.entity.PolarisBaseEntity; +import org.apache.polaris.core.entity.TaskEntity; import org.apache.polaris.core.persistence.pagination.PageToken; import org.apache.polaris.service.TestServices; import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView; diff --git a/service/common/src/test/java/org/apache/polaris/service/storage/StorageConfigurationTest.java b/service/common/src/test/java/org/apache/polaris/service/storage/StorageConfigurationTest.java index c999f4bcf..40bb12950 100644 --- a/service/common/src/test/java/org/apache/polaris/service/storage/StorageConfigurationTest.java +++ b/service/common/src/test/java/org/apache/polaris/service/storage/StorageConfigurationTest.java @@ -19,7 +19,10 @@ package org.apache.polaris.service.storage; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; diff --git a/tools/misc-types/src/main/java/org/apache/polaris/misc/types/memorysize/MemorySize.java b/tools/misc-types/src/main/java/org/apache/polaris/misc/types/memorysize/MemorySize.java index 754849888..09daa9cde 100644 --- a/tools/misc-types/src/main/java/org/apache/polaris/misc/types/memorysize/MemorySize.java +++ b/tools/misc-types/src/main/java/org/apache/polaris/misc/types/memorysize/MemorySize.java @@ -18,7 +18,7 @@ */ package org.apache.polaris.misc.types.memorysize; -import static com.fasterxml.jackson.annotation.JsonFormat.*; +import static com.fasterxml.jackson.annotation.JsonFormat.Shape; import static java.lang.String.format; import static java.util.Locale.ROOT;