Skip to content

Commit

Permalink
Enable ErrorProne MissingOverride (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored Aug 8, 2024
1 parent 4613d61 commit 32eebae
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build-logic/src/main/kotlin/polaris-java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ tasks.withType(JavaCompile::class.java).configureEach {
options.compilerArgs.addAll(listOf("-Xlint:unchecked", "-Xlint:deprecation"))
options.errorprone.disableAllWarnings = true
options.errorprone.disableWarningsInGeneratedCode = true
options.errorprone.error("StringCaseLocaleUsage")
options.errorprone.error(
"MissingOverride",
"StringCaseLocaleUsage",
)
}

tasks.register("format").configure { dependsOn("spotlessApply") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ public class EclipseLinkPolarisMetaStoreManagerFactory
@JsonProperty("persistence-unit")
private String persistenceUnitName;

@Override
protected PolarisEclipseLinkStore createBackingStore(@NotNull PolarisDiagnostics diagnostics) {
return new PolarisEclipseLinkStore(diagnostics);
}

@Override
protected PolarisMetaStoreSession createMetaStoreSession(
@NotNull PolarisEclipseLinkStore store, @NotNull RealmContext realmContext) {
return new PolarisEclipseLinkMetaStoreSessionImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ public List<PolarisEntityActiveRecord> lookupEntityActiveBatch(
}

/** {@inheritDoc} */
@Override
public boolean hasChildren(
@NotNull PolarisCallContext callContext,
@Nullable PolarisEntityType entityType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public RuntimeException fail(
* @throws RuntimeException if `reference` is null
*/
@Contract("null, _ -> fail")
@Override
public <T> T checkNotNull(final T reference, final String signature) {
return Preconditions.checkNotNull(reference, signature);
}
Expand All @@ -82,6 +83,7 @@ public <T> T checkNotNull(final T reference, final String signature) {
* @throws RuntimeException if `reference` is null
*/
@Contract("null, _, _, _ -> fail")
@Override
public <T> T checkNotNull(
final T reference,
final String signature,
Expand All @@ -100,6 +102,7 @@ public <T> T checkNotNull(
* @throws RuntimeException if `condition` is not true
*/
@Contract("false, _ -> fail")
@Override
public void check(final boolean expression, final String signature) {
Preconditions.checkState(expression, signature);
}
Expand All @@ -116,6 +119,7 @@ public void check(final boolean expression, final String signature) {
* @throws RuntimeException if condition` is not true
*/
@Contract("false, _, _, _ -> fail")
@Override
public void check(
final boolean expression,
final String signature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public Map<String, Object> contextVariables() {
contextVariables().computeIfAbsent(CLOSEABLES, key -> new CloseableGroup());
}

@Override
default void close() {
if (CURRENT_CONTEXT.get() == this) {
unsetCurrentContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public Builder setStorageConfigurationInfo(
return this;
}

@Override
public CatalogEntity build() {
return new CatalogEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public Builder(CatalogRoleEntity original) {
super(original);
}

@Override
public CatalogRoleEntity build() {
return new CatalogRoleEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public Builder setParentNamespace(Namespace namespace) {
return this;
}

@Override
public NamespaceEntity build() {
return new NamespaceEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,13 @@ public PolarisEntity(@NotNull PolarisBaseEntity sourceEntity) {
}

@JsonIgnore
@Override
public PolarisEntityType getType() {
return PolarisEntityType.fromCode(getTypeCode());
}

@JsonIgnore
@Override
public PolarisEntitySubType getSubType() {
return PolarisEntitySubType.fromCode(getSubTypeCode());
}
Expand Down Expand Up @@ -268,6 +270,7 @@ public Builder(PolarisEntity original) {
super(original);
}

@Override
public PolarisEntity build() {
return buildBase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public Builder setCredentialRotationRequiredState() {
return this;
}

@Override
public PrincipalEntity build() {
return new PrincipalEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public Builder(PrincipalRoleEntity original) {
super(original);
}

@Override
public PrincipalRoleEntity build() {
return new PrincipalRoleEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public Builder(TableLikeEntity original) {
super(original);
}

@Override
public TableLikeEntity build() {
return new TableLikeEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public Builder withLastAttemptStartedTimestamp(long timestamp) {
return this;
}

@Override
public TaskEntity build() {
return new TaskEntity(buildBase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ public Map<String, String> deserializeProperties(PolarisCallContext callCtx, Str
}

/** {@inheritDoc} */
@Override
public @NotNull CreatePrincipalResult createPrincipal(
@NotNull PolarisCallContext callCtx, @NotNull PolarisBaseEntity principal) {
// get metastore we should be using
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void runActionInReadTransaction(
/**
* @return new unique entity identifier
*/
@Override
public long generateNewId(@NotNull PolarisCallContext callCtx) {
return this.store.getNextSequence();
}
Expand Down Expand Up @@ -369,6 +370,7 @@ public List<PolarisEntityActiveRecord> lookupEntityActiveBatch(
}

/** {@inheritDoc} */
@Override
public boolean hasChildren(
@NotNull PolarisCallContext callContext,
@Nullable PolarisEntityType entityType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public abstract class BasePolarisAuthenticator

protected RealmEntityManagerFactory entityManagerFactory;

@Override
public void setEntityManagerFactory(RealmEntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void setEntityManagerFactory(RealmEntityManagerFactory entityManagerFacto
}
}

@Override
public void setTokenBroker(TokenBrokerFactory tokenBrokerFactory) {
this.tokenBrokerFactory = tokenBrokerFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ abstract class JWTBroker implements TokenBroker {

abstract Algorithm getAlgorithm();

@Override
public DecodedToken verify(String token) {
JWTVerifier verifier = JWT.require(getAlgorithm()).build();
DecodedJWT decodedJWT = verifier.verify(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void setActive(boolean active) {
private String scope;

@JsonProperty("scope")
@Override
public String getScope() {
return scope;
}
Expand All @@ -46,6 +47,7 @@ public void setScope(String scope) {
private String clientId;

@JsonProperty("client_id")
@Override
public String getClientId() {
return clientId;
}
Expand Down Expand Up @@ -82,6 +84,7 @@ public void setExp(Long exp) {
private String sub;

@JsonProperty("sub")
@Override
public String getSub() {
return sub;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ public void testDropNotificationWhenTableExists() {
}

@Test
@Override
public void testDropTableWithPurge() {
if (this.requiresNamespaceCreate()) {
((SupportsNamespaces) catalog).createNamespace(NS);
Expand Down

0 comments on commit 32eebae

Please sign in to comment.