Skip to content

Commit

Permalink
Enable errorprone PatternMatchingInstanceof (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored Oct 22, 2024
1 parent 734ecd4 commit 6850881
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions build-logic/src/main/kotlin/polaris-java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ tasks.withType(JavaCompile::class.java).configureEach {
"MissingOverride",
"ModifiedButNotUsed",
"OrphanedFormatString",
"PatternMatchingInstanceof",
"StringCaseLocaleUsage",
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public PolarisResolvedPathWrapper getResolvedPath(Object key) {
PolarisResolutionManifest manifest =
entityManager.prepareResolutionManifest(callContext, authenticatedPrincipal, catalogName);

if (key instanceof Namespace) {
Namespace namespace = (Namespace) key;
if (key instanceof Namespace namespace) {
manifest.addPath(
new ResolverPath(Arrays.asList(namespace.levels()), PolarisEntityType.NAMESPACE),
namespace);
Expand All @@ -88,8 +87,7 @@ public PolarisResolvedPathWrapper getResolvedPath(Object key, PolarisEntitySubTy
PolarisResolutionManifest manifest =
entityManager.prepareResolutionManifest(callContext, authenticatedPrincipal, catalogName);

if (key instanceof TableIdentifier) {
TableIdentifier identifier = (TableIdentifier) key;
if (key instanceof TableIdentifier identifier) {
manifest.addPath(
new ResolverPath(
PolarisCatalogHelpers.tableIdentifierToList(identifier),
Expand All @@ -110,8 +108,7 @@ public PolarisResolvedPathWrapper getPassthroughResolvedPath(Object key) {
PolarisResolutionManifest manifest =
entityManager.prepareResolutionManifest(callContext, authenticatedPrincipal, catalogName);

if (key instanceof Namespace) {
Namespace namespace = (Namespace) key;
if (key instanceof Namespace namespace) {
manifest.addPassthroughPath(
new ResolverPath(Arrays.asList(namespace.levels()), PolarisEntityType.NAMESPACE),
namespace);
Expand All @@ -129,8 +126,7 @@ public PolarisResolvedPathWrapper getPassthroughResolvedPath(
PolarisResolutionManifest manifest =
entityManager.prepareResolutionManifest(callContext, authenticatedPrincipal, catalogName);

if (key instanceof TableIdentifier) {
TableIdentifier identifier = (TableIdentifier) key;
if (key instanceof TableIdentifier identifier) {
manifest.addPassthroughPath(
new ResolverPath(
PolarisCatalogHelpers.tableIdentifierToList(identifier),
Expand Down

0 comments on commit 6850881

Please sign in to comment.