Skip to content

Commit

Permalink
Checkstyle rule for redundant initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
chtyim committed Mar 17, 2022
1 parent fab9cfd commit 42b6ef3
Show file tree
Hide file tree
Showing 128 changed files with 188 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public SplitReaderAdapter(SplitReader<FROM_KEY, FROM_VALUE> delegate) {
protected abstract TO_KEY convertKey(FROM_KEY key);
protected abstract TO_VALUE convertValue(FROM_VALUE value);

private TO_KEY nextKey = null;
private TO_VALUE nextValue = null;
private TO_KEY nextKey;
private TO_VALUE nextValue;

@Override
public void initialize(Split split) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public Iterator<Counter> read(byte[] counter, long startTime, long endTime,
// Returns a limiting Iterator
return new Iterator<Counter>() {

private int count = 0;
private int count;

@Override
public boolean hasNext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public static Map<String, String> propertiesWithPrefix(Map<String, String> prope
*/
public static class Builder extends ExploreProperties.AbstractBuilder<Builder> {

private String format = null;
private String format;

/**
* Package visible default constructor, to allow sub-classing by other datasets in this package.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public CloseableIterator<KeyValue<byte[], byte[]>> scan(byte[] startRow, byte[]
final Scanner scanner = table.scan(startRow, stopRow);

return new AbstractCloseableIterator<KeyValue<byte[], byte[]>>() {
private boolean closed = false;
private boolean closed;
@Override
protected KeyValue<byte[], byte[]> computeNext() {
if (closed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public final Iterator<Entry> read(byte[] key, long startTime, long endTime,
}

return new Iterator<Entry>() {
int count = 0;
int count;

@Override
public boolean hasNext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum Return {
*/
final class Limit implements PartitionAcceptor {

private int count = 0;
private int count;
private int limit;

public Limit(int limit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public static class Builder {
private boolean evaluateLookups = true;
private boolean evaluateFunctions = true;
private boolean escapingEnabled = true;
private boolean skipInvalid = false;
private boolean skipInvalid;
private int maxRecurseDepth = 10;
private Set<String> functionWhitelist = new HashSet<>();
private final Set<String> functionWhitelist = new HashSet<>();

public Builder disableLookups() {
evaluateLookups = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class TypeRepresentation implements ParameterizedType {
private final String rawType;
private final TypeRepresentation enclosingType;
private final TypeRepresentation[] parameters;
private transient ClassLoader classLoader = null;
private transient ClassLoader classLoader;

/**
* Set the class loader to be used by toType(), getRawType(), etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public URL apply(File file) {
}
};

private static ClassLoader exploreClassLoader = null;
private static ClassLoader exploreClassLoader;

/**
* Builds a class loader with the class path provided.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public class PreviewDataSubscriberService extends AbstractMessagingSubscriberSer
private final MultiThreadMessagingContext messagingContext;
private final TransactionRunner transactionRunner;
private final int maxRetriesOnError;
private int errorCount = 0;
private String erroredMessageId = null;
private int errorCount;
private String erroredMessageId;
private MetricsCollectionService metricsCollectionService;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public class PreviewTMSLogSubscriber extends AbstractMessagingSubscriberService<
private final TransactionRunner transactionRunner;
private final RemoteExecutionLogProcessor logProcessor;
private final int maxRetriesOnError;
private int errorCount = 0;
private String erroredMessageId = null;
private int errorCount;
private String erroredMessageId;

@Inject
PreviewTMSLogSubscriber(CConfiguration cConf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ private WrappedMapper.Context createAutoFlushingContext(final Context context,

@SuppressWarnings("unchecked")
WrappedMapper.Context flushingContext = new WrappedMapper().new Context(context) {
private int processedRecords = 0;
private long nextTimeToReportMetrics = 0L;
private int processedRecords;
private long nextTimeToReportMetrics;

@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ private WrappedReducer.Context createAutoFlushingContext(final Context context,

@SuppressWarnings("unchecked")
WrappedReducer.Context flushingContext = new WrappedReducer().new Context(context) {
private int processedRecords = 0;
private long nextTimeToReportMetrics = 0L;
private int processedRecords;
private long nextTimeToReportMetrics;

@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class SimpleJob implements Job {
private final List<Notification> notifications;
private final State state;
private final long scheduleLastUpdatedTime;
private Long deleteTimeMillis = null;
private Long deleteTimeMillis;

/**
* @param scheduleLastUpdatedTime the last modification time of the schedule, at the time this job is created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private static class RunnableTaskBodyProducer extends BodyProducer {
private final BiConsumer<Boolean, TaskDetails> stopper;
private final TaskDetails taskDetails;
private final boolean terminateOnComplete;
private boolean done = false;
private boolean done;

RunnableTaskBodyProducer(RunnableTaskContext context, BiConsumer<Boolean, TaskDetails> stopper,
TaskDetails taskDetails) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private String exceptionToJson(Exception ex) {
private static class RunnableTaskBodyProducer extends BodyProducer {
private final ByteBuffer response;
private final TaskDetails taskDetails;
private boolean done = false;
private boolean done;

RunnableTaskBodyProducer(RunnableTaskContext context, TaskDetails taskDetails) {
this.response = context.getResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class DefaultWorkflowConfigurer extends AbstractConfigurer
private final AppDeploymentRuntimeInfo runtimeInfo;
private final List<WorkflowNode> nodes = Lists.newArrayList();

private int nodeIdentifier = 0;
private int nodeIdentifier;
private String name;
private String description;
private Map<String, String> properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public class MetadataSubscriberService extends AbstractMessagingSubscriberServic
private final int maxRetriesOnConflict;
private final MetricsCollectionService metricsCollectionService;

private String conflictMessageId = null;
private int conflictCount = 0;
private String conflictMessageId;
private int conflictCount;

private boolean didBackfill = false;
private int backfillAttempts = 0;
private boolean didBackfill;
private int backfillAttempts;

@Inject
MetadataSubscriberService(CConfiguration cConf, MessagingService messagingService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ConstraintCheckerService extends AbstractIdleService {
private final TransactionRunner transactionRunner;
private ScheduleTaskRunner taskRunner;
private ListeningExecutorService taskExecutorService;
private volatile boolean stopping = false;
private volatile boolean stopping;

@Inject
ConstraintCheckerService(Store store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static Builder builder() {
*/
public static class Builder {
private final PermissionCollection perms;
private Class<?> klass = null;
private Class<?> klass;

/**
* Invoked by the {@link #builder()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void configure() {
*/
public static class MisbehavedDataset extends AbstractDataset {

private boolean active = false;
private boolean active;

public MisbehavedDataset(DatasetSpecification spec, @EmbeddedDataset("t") Table table) {
super(spec.getName(), table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

public class ProgramStateWriterWithHeartBeatTest {
private static class MockProgramStatePublisher implements ProgramStatePublisher {
long heartBeatCount = 0;
long heartBeatCount;

@Override
public void publish(Notification.Type notificationType, Map<String, String> properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static class FileMapper
extends Mapper<LongWritable, Text, Text, LongWritable>
implements ProgramLifecycle<MapReduceTaskContext> {

private KeyValueTable counters = null;
private KeyValueTable counters;

public static final String ONLY_KEY = "x";
@Override
Expand All @@ -141,7 +141,7 @@ public static class FileReducer
extends Reducer<Text, LongWritable, String, Long>
implements ProgramLifecycle<MapReduceTaskContext> {

private KeyValueTable counters = null;
private KeyValueTable counters;

public void reduce(Text key, Iterable<LongWritable> values, Context context)
throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ protected void map(Integer key, Integer value, Context context) throws IOExcepti
}

public static class PedanticTxAware extends AbstractDataset implements BatchReadable<Integer, Integer> {
private Transaction tx = null;
private Transaction remembered = null;
private Transaction tx;
private Transaction remembered;

public PedanticTxAware(DatasetSpecification spec, @EmbeddedDataset("t") Table embedded) {
super(spec.getName(), embedded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void chunk(FullHttpRequest request, HttpResponder responder) {

responder.sendContent(HttpResponseStatus.OK, new BodyProducer() {

int count = 0;
int count;

@Override
public ByteBuf nextChunk() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ProgramLifecycleHttpHandlerInternalTest extends AppFabricTestBase {
private static final String STOPPED = "STOPPED";
private static final String RUNNING = "RUNNING";

private static ProgramRunRecordFetcher programRunRecordFetcher = null;
private static ProgramRunRecordFetcher programRunRecordFetcher;

@BeforeClass
public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ private void validateContext(ProvisionerContext context) {
*/
public static class PropertyBuilder {
private Integer failRetryablyEveryN;
private boolean failCreate = false;
private boolean failGet = false;
private boolean failInit = false;
private boolean failDelete = false;
private boolean failCreate;
private boolean failGet;
private boolean failInit;
private boolean failDelete;
private long waitCreateMillis = -1L;
private long waitDeleteMillis = -1L;
private ClusterStatus firstClusterStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public class MockTetheringServerHandler extends AbstractHttpHandler {
private static final Gson GSON = new Gson();
private HttpResponseStatus responseStatus = HttpResponseStatus.OK;
private boolean tetheringCreated = false;
private boolean tetheringCreated;

@GET
@Path("/tethering/controlchannels/{peer}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public enum PreferencesFetcherType {
REMOTE,
};

private PreferencesFetcherType fetcherType = null;
private PreferencesFetcherType fetcherType;

public PreferencesFetcherInternalTest(PreferencesFetcherType type) {
this.fetcherType = type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public static String[] getRunScriptCommand(File script) {
public static final String READ_LINK_COMMAND = "readlink";

/**Time after which the executing script would be timedout*/
protected long timeOutInterval = 0L;
protected long timeOutInterval;
/** If or not script timed out*/
private AtomicBoolean timedOut;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public class SmartWorkflow extends AbstractWorkflow {
private Metrics workflowMetrics;
private ETLBatchConfig config;
private BatchPipelineSpec spec;
private int connectorNum = 0;
private int publisherNum = 0;
private int connectorNum;
private int publisherNum;

public SmartWorkflow(ETLBatchConfig config, Set<String> supportedPluginTypes,
ApplicationConfigurer applicationConfigurer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class AutoJoinerTest extends HydratorTestBase {
private static final ArtifactId APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT = new ArtifactSummary("app", "1.0.0");

private static int startCount = 0;
private static int startCount;
private static final Schema USER_SCHEMA = Schema.recordOf(
"user",
Schema.Field.of("region", Schema.of(Schema.Type.STRING)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class DataPipelineConnectionTest extends HydratorTestBase {
new GsonBuilder().registerTypeAdapter(Schema.class, new SchemaTypeAdapter())
.registerTypeAdapter(SampleResponse.class, new SampleResponseCodec()).setPrettyPrinting().create();

private static int startCount = 0;
private static int startCount;

@ClassRule
public static final TestConfiguration CONFIG =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public class DataPipelineTest extends HydratorTestBase {
private static final ArtifactId OLD_APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "0.0.9");

private static final ArtifactSummary APP_ARTIFACT_RANGE = new ArtifactSummary("app", "[0.1.0,1.1.0)");
private static int startCount = 0;
private static int startCount;

@ClassRule
public static final TestConfiguration CONFIG = new TestConfiguration(Constants.Explore.EXPLORE_ENABLED, false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class ReducibleAggregatorTestBase extends HydratorTestBase {
private static final ArtifactId APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT = new ArtifactSummary("app", "1.0.0");

private static int startCount = 0;
private static int startCount;

@ClassRule
public static final TestConfiguration CONFIG = new TestConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class PreviewDataPipelineTest extends HydratorTestBase {
private static final ArtifactId APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT = new ArtifactSummary("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT_RANGE = new ArtifactSummary("app", "[0.1.0,1.1.0)");
private static int startCount = 0;
private static int startCount;
@ClassRule
public static final TestConfiguration CONFIG = new TestConfiguration(Constants.Explore.EXPLORE_ENABLED, false,
Constants.Security.Store.PROVIDER, "file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class DataStreamsSparkSinkTest extends HydratorTestBase {

private static final ArtifactId APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT = new ArtifactSummary("app", "1.0.0");
private static int startCount = 0;
private static int startCount;
@ClassRule
public static final TestConfiguration CONFIG = new TestConfiguration(Constants.Explore.EXPLORE_ENABLED, false,
Constants.AppFabric.SPARK_COMPAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class DataStreamsTest extends HydratorTestBase {
private static final ArtifactId APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT = new ArtifactSummary("app", "1.0.0");
private static String checkpointDir;
private static int startCount = 0;
private static int startCount;
@ClassRule
public static final TestConfiguration CONFIG = new TestConfiguration(Constants.Explore.EXPLORE_ENABLED, false,
Constants.AppFabric.SPARK_COMPAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class PreviewDataStreamsTest extends HydratorTestBase {

private static final ArtifactId APP_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("app", "1.0.0");
private static final ArtifactSummary APP_ARTIFACT = new ArtifactSummary("app", "1.0.0");
private static int startCount = 0;
private static int startCount;
@ClassRule
public static final TestConfiguration CONFIG = new TestConfiguration(Constants.Explore.EXPLORE_ENABLED, false,
Constants.AppFabric.SPARK_COMPAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public Iterator<Object> iterator() {
return ((Collection<Object>) array).iterator();
}
return new Iterator<Object>() {
private int curr = 0;
private int curr;

@Override
public boolean hasNext() {
Expand Down
Loading

0 comments on commit 42b6ef3

Please sign in to comment.