Skip to content

Commit

Permalink
Ignore Spotbugs warning CT_CONSTRUCTOR_THROW (#2421)
Browse files Browse the repository at this point in the history
  • Loading branch information
brfrn169 authored Dec 24, 2024
1 parent 98b5e1b commit a706e7f
Show file tree
Hide file tree
Showing 27 changed files with 2 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ public JdbcAdminImportTestUtils(Properties properties) {
majorVersion = getMajorVersion();
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public Map<String, TableMetadata> createExistingDatabaseWithAllDataTypes(String namespace)
throws SQLException {
execute(rdbEngine.createSchemaSqls(namespace));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ private ActiveTransaction(DistributedTransaction transaction) throws Transaction
add(this);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
public synchronized Optional<Result> get(Get get) throws CrudException {
return super.get(get);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ private ActiveTransaction(TwoPhaseCommitTransaction transaction) throws Transact
add(this);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
public synchronized Optional<Result> get(Get get) throws CrudException {
return super.get(get);
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/com/scalar/db/config/DatabaseConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ public DatabaseConfig(Path propertiesPath) throws IOException {
this(propertiesPath.toFile());
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public Properties getProperties() {
Properties ret = new Properties();
ret.putAll(props);
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/com/scalar/db/io/BigIntColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ private BigIntColumn(String name, long value, boolean hasNullValue) {
this.hasNullValue = hasNullValue;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
public String getName() {
return name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ public Cassandra(DatabaseConfig config) {
this.operationChecker = operationChecker;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
@Nonnull
public Optional<Result> get(Get get) throws ExecutionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public CassandraConfig(DatabaseConfig databaseConfig) {
metadataKeyspace = databaseConfig.getSystemNamespaceName();
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public String getMetadataKeyspace() {
return metadataKeyspace;
}
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/com/scalar/db/storage/cosmos/Cosmos.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ public Cosmos(DatabaseConfig databaseConfig) {
this.operationChecker = operationChecker;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
@Nonnull
public Optional<Result> get(Get get) throws ExecutionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public CosmosConfig(DatabaseConfig databaseConfig) {
consistencyLevel = getString(databaseConfig.getProperties(), CONSISTENCY_LEVEL, null);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public String getEndpoint() {
return endpoint;
}
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/com/scalar/db/storage/dynamo/Dynamo.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ public Dynamo(DatabaseConfig databaseConfig) {
this.operationChecker = operationChecker;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
@Nonnull
public Optional<Result> get(Get get) throws ExecutionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ public DynamoConfig(DatabaseConfig databaseConfig) {
namespacePrefix = getString(databaseConfig.getProperties(), NAMESPACE_PREFIX, null);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public String getRegion() {
return region;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ private Namespace(String prefix, String name) {
this.name = name;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public static Namespace of(String prefix, String name) {
return new Namespace(prefix, name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public ConditionalMutator(
this.queryBuilder = queryBuilder;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public boolean mutate() throws SQLException {
mutation.getCondition().ifPresent(condition -> condition.accept(this));
throwSQLExceptionIfOccurred();
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/java/com/scalar/db/storage/jdbc/JdbcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ public JdbcConfig(DatabaseConfig databaseConfig) {
}
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public String getJdbcUrl() {
return jdbcUrl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public SelectWithFetchFirstNRowsOnly(Builder builder, int limit) {
this.limit = limit;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
public String sql() {
return super.sql() + " FETCH FIRST " + limit + " ROWS ONLY";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public SelectWithLimitQuery(Builder builder, int limit) {
this.limit = limit;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
public String sql() {
return super.sql() + " LIMIT " + limit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public SelectWithTop(Builder builder, int limit) {
this.limit = limit;
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@Override
public String sql() {
// This inserts "TOP ${limit}" clause, specific to SqlServer, right after the "SELECT" clause of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ public MultiStorageConfig(DatabaseConfig databaseConfig) {
checkIfStorageExists(defaultStorage);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

private ImmutableMap<String, Properties> loadDatabasePropertiesMapping(Properties properties) {
String[] storages = getStringArray(properties, STORAGES, null);
if (storages == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ public ConsensusCommitConfig(DatabaseConfig databaseConfig) {
false);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public Isolation getIsolation() {
return isolation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ public State(String id, TransactionState state) {
this(id, state, System.currentTimeMillis());
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@VisibleForTesting
State(String id, List<String> childIds, TransactionState state, long createdAt) {
this.id = checkNotNull(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public GroupCommitConfig(
false);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public int slotCapacity() {
return slotCapacity;
}
Expand Down
3 changes: 2 additions & 1 deletion gradle/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
<Bug pattern="THROWS_METHOD_THROWS_CLAUSE_THROWABLE"/>
<Bug pattern="THROWS_METHOD_THROWS_RUNTIMEEXCEPTION"/>
<!-- Temporarily excluded. See https://github.com/spotbugs/spotbugs/issues/1694 -->
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE" />
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
<!-- To exclude Lombok thrown warnings -->
<Bug pattern="SAME_NAME_BUT_DIFFERENT"/>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Or>
</Match>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public ImportSchemaParser(String serializedSchemaJson, Map<String, String> optio
this.options = ImmutableMap.copyOf(options);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public List<ImportTableSchema> parse() {
List<ImportTableSchema> tableSchemaList = new ArrayList<>();
for (Map.Entry<String, JsonElement> entry : schemaJson.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public ImportTableSchema(
this.options = buildOptions(tableDefinition, options);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

private ImmutableMap<String, String> buildOptions(
JsonObject tableDefinition, Map<String, String> globalOptions) {
ImmutableMap.Builder<String, String> optionsBuilder = ImmutableMap.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ public SchemaOperator(Properties properties) {
this(StorageFactory.create(properties), TransactionFactory.create(properties));
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

@VisibleForTesting
SchemaOperator(StorageFactory storageFactory, TransactionFactory transactionFactory) {
storageAdmin =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public SchemaParser(String serializedSchemaJson, Map<String, String> options) {
this.options = ImmutableMap.copyOf(options);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

public List<TableSchema> parse() {
List<TableSchema> tableSchemaList = new ArrayList<>();
for (Map.Entry<String, JsonElement> entry : schemaJson.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ public TableSchema(
this.options = buildOptions(tableDefinition, options);
}

// For the SpotBugs warning CT_CONSTRUCTOR_THROW
@Override
protected final void finalize() {}

protected TableMetadata buildTableMetadata(String tableFullName, JsonObject tableDefinition) {
TableMetadata.Builder tableBuilder = TableMetadata.newBuilder();

Expand Down

0 comments on commit a706e7f

Please sign in to comment.