Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[EH] TypeParameterUnusedInFormals (#5782)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaretic authored Nov 24, 2021
1 parent 29dbc8f commit 0a9db65
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private AtlasDbServices connect() throws IOException {
return DaggerAtlasDbServices.builder().servicesConfigModule(scm).build();
}

public <T extends AtlasDbServices> T connect(AtlasDbServicesFactory factory) throws IOException {
public AtlasDbServices connect(AtlasDbServicesFactory factory) throws IOException {
return factory.connect(ServicesConfigModule.create(getAtlasDbConfig(), getAtlasDbRuntimeConfig()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private InMemoryTestRunner makeRunner(String... args) {
public void testSweepTable() throws Exception {
try (SingleBackendCliTestRunner runner =
makeRunner(paramsWithDryRunSet(SWEEP_COMMAND, "-t", TABLE_ONE.getQualifiedName()))) {
TestAtlasDbServices services = runner.connect(moduleFactory);
TestAtlasDbServices services = (TestAtlasDbServices) runner.connect(moduleFactory);
SerializableTransactionManager txm = services.getTransactionManager();
TimestampService tss = services.getManagedTimestampService();
KeyValueService kvs = services.getKeyValueService();
Expand Down Expand Up @@ -135,7 +135,7 @@ public void testSweepTable() throws Exception {
public void testSweepNonExistingTable() throws Exception {
try (SingleBackendCliTestRunner runner =
makeRunner(paramsWithDryRunSet(SWEEP_COMMAND, "-t", NON_EXISTING_TABLE.getQualifiedName()))) {
TestAtlasDbServices services = runner.connect(moduleFactory);
TestAtlasDbServices services = (TestAtlasDbServices) runner.connect(moduleFactory);

long ts5 = services.getManagedTimestampService().getFreshTimestamp();
String stdout = sweep(runner, ts5);
Expand All @@ -149,7 +149,7 @@ public void testSweepNonExistingTable() throws Exception {
@Test
public void testSweepNamespace() throws Exception {
try (SingleBackendCliTestRunner runner = makeRunner(paramsWithDryRunSet(SWEEP_COMMAND, "-n", NS1.getName()))) {
TestAtlasDbServices services = runner.connect(moduleFactory);
TestAtlasDbServices services = (TestAtlasDbServices) runner.connect(moduleFactory);
SerializableTransactionManager txm = services.getTransactionManager();
TimestampService tss = services.getManagedTimestampService();
KeyValueService kvs = services.getKeyValueService();
Expand Down Expand Up @@ -181,7 +181,7 @@ public void testSweepNamespace() throws Exception {
@Test
public void testSweepAll() throws Exception {
try (SingleBackendCliTestRunner runner = makeRunner(paramsWithDryRunSet(SWEEP_COMMAND, "-a"))) {
TestAtlasDbServices services = runner.connect(moduleFactory);
TestAtlasDbServices services = (TestAtlasDbServices) runner.connect(moduleFactory);
SerializableTransactionManager txm = services.getTransactionManager();
TimestampService tss = services.getManagedTimestampService();
KeyValueService kvs = services.getKeyValueService();
Expand Down Expand Up @@ -218,7 +218,7 @@ public void testSweepStartRow() throws Exception {
TABLE_ONE.getQualifiedName(),
"-r",
BaseEncoding.base16().encode("foo".getBytes(StandardCharsets.UTF_8))))) {
TestAtlasDbServices services = runner.connect(moduleFactory);
TestAtlasDbServices services = (TestAtlasDbServices) runner.connect(moduleFactory);
SerializableTransactionManager txm = services.getTransactionManager();
TimestampService tss = services.getManagedTimestampService();
KeyValueService kvs = services.getKeyValueService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void runAndVerifyCliForFile(String inputFileString) throws Exception {

private void runAndVerifyCli(Verifier verifier) throws Exception {
try (SingleBackendCliTestRunner runner = makeRunner(cliArgs.toArray(new String[0]))) {
TestAtlasDbServices services = runner.connect(moduleFactory);
TestAtlasDbServices services = (TestAtlasDbServices) runner.connect(moduleFactory);
LockService lockService = services.getLockService();
TimestampService tss = services.getManagedTimestampService();
LockClient client = services.getTestLockClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
import java.util.concurrent.Callable;
import org.apache.commons.lang3.ArrayUtils;

public abstract class AbstractTestRunner<S extends AtlasDbServices> implements SingleBackendCliTestRunner {
public abstract class AbstractTestRunner implements SingleBackendCliTestRunner {

private final Class<? extends SingleBackendCommand> cmdClass;

private String[] args;
private SingleBackendCommand cmd;
private S services;
private AtlasDbServices services;

protected AbstractTestRunner(Class<? extends SingleBackendCommand> cmdClass, String... args) {
this.cmdClass = cmdClass;
this.args = args;
}

@Override
public S connect(AtlasDbServicesFactory factory) throws Exception {
public AtlasDbServices connect(AtlasDbServicesFactory factory) throws Exception {
cmd = buildCommand(cmdClass, buildArgs());
services = cmd.connect(factory);
return services;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
package com.palantir.atlasdb.cli.runner;

import com.palantir.atlasdb.cli.command.SingleBackendCommand;
import com.palantir.atlasdb.services.AtlasDbServices;
import com.palantir.atlasdb.spi.KeyValueServiceConfig;

public class InMemoryTestRunner extends AbstractTestRunner<AtlasDbServices> {
public class InMemoryTestRunner extends AbstractTestRunner {

public static final String CONFIG_LOCATION = "cli_test_config.yml";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public interface SingleBackendCliTestRunner extends AutoCloseable {

<T extends AtlasDbServices> T connect(AtlasDbServicesFactory factory) throws Exception;
AtlasDbServices connect(AtlasDbServicesFactory factory) throws Exception;

void parse(String... args);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
package com.palantir.atlasdb.services;

public interface AtlasDbServicesFactory {
<T extends AtlasDbServices> T connect(ServicesConfigModule servicesConfigModule);
AtlasDbServices connect(ServicesConfigModule servicesConfigModule);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ default Set<C> hello() {
throw new UnsupportedOperationException("This class doesn't know how to say hello.");
}

static <A, D> D hidingParameter(A argument) {
return null;
static <A> boolean hidingParameter(A argument) {
return true;
}
}
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ allprojects {
'ThreadPriorityCheck',
'ThrowSpecificity',
'TooManyArguments',
'TypeParameterUnusedInFormals',
'ValidateConstantMessage'
}
}
Expand Down

0 comments on commit 0a9db65

Please sign in to comment.