Skip to content

Commit

Permalink
Upgrade checkstyle to version 7.5
Browse files Browse the repository at this point in the history
This commit upgrades the checkstyle configuration from version 5.9 to
version 7.5, the latest version as of today. The main enhancement
obtained via this upgrade is better detection of redundant modifiers.

Relates #22960
  • Loading branch information
jasontedor committed Feb 3, 2017
1 parent cc3b203 commit e8c58c0
Show file tree
Hide file tree
Showing 367 changed files with 616 additions and 618 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class PrecommitTasks {
configProperties = [
suppressions: checkstyleSuppressions
]
toolVersion = 7.5
}
for (String taskName : ['checkstyleMain', 'checkstyleTest']) {
Task task = project.tasks.findByName(taskName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static final class LoadGenerator {
private final BlockingQueue<List<String>> bulkQueue;
private final int bulkSize;

public LoadGenerator(Path bulkDataFile, BlockingQueue<List<String>> bulkQueue, int bulkSize) {
LoadGenerator(Path bulkDataFile, BlockingQueue<List<String>> bulkQueue, int bulkSize) {
this.bulkDataFile = bulkDataFile;
this.bulkQueue = bulkQueue;
this.bulkSize = bulkSize;
Expand Down Expand Up @@ -143,7 +143,7 @@ private static final class BulkIndexer implements Runnable {
private final BulkRequestExecutor bulkRequestExecutor;
private final SampleRecorder sampleRecorder;

public BulkIndexer(BlockingQueue<List<String>> bulkData, int warmupIterations, int measurementIterations,
BulkIndexer(BlockingQueue<List<String>> bulkData, int warmupIterations, int measurementIterations,
SampleRecorder sampleRecorder, BulkRequestExecutor bulkRequestExecutor) {
this.bulkData = bulkData;
this.warmupIterations = warmupIterations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private static final class RestBulkRequestExecutor implements BulkRequestExecuto
private final RestClient client;
private final String actionMetaData;

public RestBulkRequestExecutor(RestClient client, String index, String type) {
RestBulkRequestExecutor(RestClient client, String index, String type) {
this.client = client;
this.actionMetaData = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static final class TransportBulkRequestExecutor implements BulkRequestEx
private final String indexName;
private final String typeName;

public TransportBulkRequestExecutor(TransportClient client, String indexName, String typeName) {
TransportBulkRequestExecutor(TransportClient client, String indexName, String typeName) {
this.client = client;
this.indexName = indexName;
this.typeName = typeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static class BulkRestBuilderListener extends RestBuilderListener<BulkReq
private final RestRequest request;


public BulkRestBuilderListener(RestChannel channel, RestRequest request) {
BulkRestBuilderListener(RestChannel channel, RestRequest request) {
super(channel);
this.request = request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HeapBufferedResponseConsumerFactory implements HttpAsyncResponseConsumerFa

private final int bufferLimit;

public HeapBufferedResponseConsumerFactory(int bufferLimitBytes) {
HeapBufferedResponseConsumerFactory(int bufferLimitBytes) {
this.bufferLimit = bufferLimitBytes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ private static class HostTuple<T> {
public final T hosts;
public final AuthCache authCache;

public HostTuple(final T hosts, final AuthCache authCache) {
HostTuple(final T hosts, final AuthCache authCache) {
this.hosts = hosts;
this.authCache = authCache;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void testGetWithBody() throws IOException {
public void testPreemptiveAuthEnabled() throws IOException {
final String[] methods = { "POST", "PUT", "GET", "DELETE" };

try (final RestClient restClient = createRestClient(true, true)) {
try (RestClient restClient = createRestClient(true, true)) {
for (final String method : methods) {
final Response response = bodyTest(restClient, method);

Expand All @@ -252,7 +252,7 @@ public void testPreemptiveAuthEnabled() throws IOException {
public void testPreemptiveAuthDisabled() throws IOException {
final String[] methods = { "POST", "PUT", "GET", "DELETE" };

try (final RestClient restClient = createRestClient(true, false)) {
try (RestClient restClient = createRestClient(true, false)) {
for (final String method : methods) {
final Response response = bodyTest(restClient, method);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static class ShardRef {
// Which hit within the shard:
int hitIndex;

public ShardRef(int shardIndex) {
ShardRef(int shardIndex) {
this.shardIndex = shardIndex;
}

Expand All @@ -72,7 +72,7 @@ private static class MergeSortQueue extends PriorityQueue<ShardRef> {
final FieldComparator<?>[] comparators;
final int[] reverseMul;

public MergeSortQueue(Sort sort, CollapseTopFieldDocs[] shardHits) throws IOException {
MergeSortQueue(Sort sort, CollapseTopFieldDocs[] shardHits) throws IOException {
super(shardHits.length);
this.shardHits = new ScoreDoc[shardHits.length][];
for (int shardIDX = 0; shardIDX < shardHits.length; shardIDX++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static class Numeric extends CollapsingDocValuesSource<Long> {
private NumericDocValues values;
private Bits docsWithField;

public Numeric(String field) throws IOException {
Numeric(String field) throws IOException {
super(field);
}

Expand Down Expand Up @@ -122,7 +122,7 @@ static class Keyword extends CollapsingDocValuesSource<BytesRef> {
private Bits docsWithField;
private SortedDocValues values;

public Keyword(String field) throws IOException {
Keyword(String field) throws IOException {
super(field);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ private static final class EscapingTokenStreamToAutomaton extends TokenStreamTo
final BytesRefBuilder spare = new BytesRefBuilder();
private char sepLabel;

public EscapingTokenStreamToAutomaton(char sepLabel) {
EscapingTokenStreamToAutomaton(char sepLabel) {
this.sepLabel = sepLabel;
}

Expand Down Expand Up @@ -432,7 +432,7 @@ private static class AnalyzingComparator implements Comparator<BytesRef> {

private final boolean hasPayloads;

public AnalyzingComparator(boolean hasPayloads) {
AnalyzingComparator(boolean hasPayloads) {
this.hasPayloads = hasPayloads;
}

Expand Down Expand Up @@ -1114,7 +1114,7 @@ private static final class SurfaceFormAndPayload implements Comparable<SurfaceFo
BytesRef payload;
long weight;

public SurfaceFormAndPayload(BytesRef payload, long cost) {
SurfaceFormAndPayload(BytesRef payload, long cost) {
super();
this.payload = payload;
this.weight = cost;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/elasticsearch/ExceptionsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static class GroupBy {
final String index;
final Class<? extends Throwable> causeType;

public GroupBy(Throwable t) {
GroupBy(Throwable t) {
if (t instanceof ElasticsearchException) {
final Index index = ((ElasticsearchException) t).getIndex();
if (index != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public ActionModule(boolean transportClient, Settings settings, IndexNameExpress
static Map<String, ActionHandler<?, ?>> setupActions(List<ActionPlugin> actionPlugins) {
// Subclass NamedRegistry for easy registration
class ActionRegistry extends NamedRegistry<ActionHandler<?, ?>> {
public ActionRegistry() {
ActionRegistry() {
super("action");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public interface ListenableActionFuture<T> extends ActionFuture<T> {
/**
* Add an action listener to be invoked when a response has received.
*/
void addListener(final ActionListener<T> listener);
void addListener(ActionListener<T> listener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private static class BanLock {
private final AtomicInteger counter;
private final int nodesSize;

public BanLock(int nodesSize, Runnable finish) {
BanLock(int nodesSize, Runnable finish) {
counter = new AtomicInteger(0);
this.finish = finish;
this.nodesSize = nodesSize;
Expand Down Expand Up @@ -268,7 +268,7 @@ private BanParentTaskRequest(TaskId parentTaskId) {
this.ban = false;
}

public BanParentTaskRequest() {
BanParentTaskRequest() {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public enum SnapshotIndexShardStage {

private boolean completed;

private SnapshotIndexShardStage(byte value, boolean completed) {
SnapshotIndexShardStage(byte value, boolean completed) {
this.value = value;
this.completed = completed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {

public static enum Feature {
public enum Feature {
ALIASES((byte) 0, "_aliases", "_alias"),
MAPPINGS((byte) 1, "_mappings", "_mapping"),
SETTINGS((byte) 2, "_settings");
Expand All @@ -52,7 +52,7 @@ public static enum Feature {
private final String preferredName;
private final byte id;

private Feature(byte id, String... validNames) {
Feature(byte id, String... validNames) {
assert validNames != null && validNames.length > 0;
this.id = id;
this.validNames = Arrays.asList(validNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected Condition(String name) {
this.name = name;
}

public abstract Result evaluate(final Stats stats);
public abstract Result evaluate(Stats stats);

@Override
public final String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public class Response {
private final List<NodeGatewayStartedShards> responses;
private final List<FailedNodeException> failures;

public Response(ShardId shardId, List<NodeGatewayStartedShards> responses, List<FailedNodeException> failures) {
Response(ShardId shardId, List<NodeGatewayStartedShards> responses, List<FailedNodeException> failures) {
this.shardId = shardId;
this.responses = responses;
this.failures = failures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private static final class ConstantBackoff extends BackoffPolicy {

private final int numberOfElements;

public ConstantBackoff(TimeValue delay, int numberOfElements) {
ConstantBackoff(TimeValue delay, int numberOfElements) {
assert numberOfElements >= 0;
this.delay = delay;
this.numberOfElements = numberOfElements;
Expand All @@ -188,7 +188,7 @@ private static final class ConstantBackoffIterator implements Iterator<TimeValue
private final int numberOfElements;
private int curr;

public ConstantBackoffIterator(TimeValue delay, int numberOfElements) {
ConstantBackoffIterator(TimeValue delay, int numberOfElements) {
this.delay = delay;
this.numberOfElements = numberOfElements;
}
Expand All @@ -212,7 +212,7 @@ private static final class WrappedBackoffPolicy extends BackoffPolicy {
private final BackoffPolicy delegate;
private final Runnable onBackoff;

public WrappedBackoffPolicy(BackoffPolicy delegate, Runnable onBackoff) {
WrappedBackoffPolicy(BackoffPolicy delegate, Runnable onBackoff) {
this.delegate = delegate;
this.onBackoff = onBackoff;
}
Expand All @@ -227,7 +227,7 @@ private static final class WrappedBackoffIterator implements Iterator<TimeValue>
private final Iterator<TimeValue> delegate;
private final Runnable onBackoff;

public WrappedBackoffIterator(Iterator<TimeValue> delegate, Runnable onBackoff) {
WrappedBackoffIterator(Iterator<TimeValue> delegate, Runnable onBackoff) {
this.delegate = delegate;
this.onBackoff = onBackoff;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static class SyncBulkRequestHandler extends BulkRequestHandler {
private final BulkProcessor.Listener listener;
private final BackoffPolicy backoffPolicy;

public SyncBulkRequestHandler(Client client, BackoffPolicy backoffPolicy, BulkProcessor.Listener listener) {
SyncBulkRequestHandler(Client client, BackoffPolicy backoffPolicy, BulkProcessor.Listener listener) {
super(client);
this.backoffPolicy = backoffPolicy;
this.listener = listener;
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/elasticsearch/action/bulk/Retry.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static class AbstractRetryHandler implements ActionListener<BulkResponse> {
private volatile BulkRequest currentBulkRequest;
private volatile ScheduledFuture<?> scheduledRequestFuture;

public AbstractRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, ActionListener<BulkResponse> listener) {
AbstractRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, ActionListener<BulkResponse> listener) {
this.retryOnThrowable = retryOnThrowable;
this.backoff = backoffPolicy.iterator();
this.client = client;
Expand Down Expand Up @@ -213,7 +213,7 @@ public void execute(BulkRequest bulkRequest) {
}

static class AsyncRetryHandler extends AbstractRetryHandler {
public AsyncRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, ActionListener<BulkResponse> listener) {
AsyncRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, ActionListener<BulkResponse> listener) {
super(retryOnThrowable, backoffPolicy, client, listener);
}
}
Expand All @@ -226,7 +226,7 @@ public static SyncRetryHandler create(Class<? extends Throwable> retryOnThrowabl
return new SyncRetryHandler(retryOnThrowable, backoffPolicy, client, actionFuture);
}

public SyncRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, PlainActionFuture<BulkResponse> actionFuture) {
SyncRetryHandler(Class<? extends Throwable> retryOnThrowable, BackoffPolicy backoffPolicy, Client client, PlainActionFuture<BulkResponse> actionFuture) {
super(retryOnThrowable, backoffPolicy, client, actionFuture);
this.actionFuture = actionFuture;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private static class RunOnce extends AbstractRunnable {
private final AtomicBoolean hasRun = new AtomicBoolean(false);
private final AbstractRunnable delegate;

public RunOnce(AbstractRunnable delegate) {
RunOnce(AbstractRunnable delegate) {
this.delegate = delegate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ final class FetchPhase implements CheckedRunnable<Exception> {
private final SearchPhaseController searchPhaseController;
private final AtomicArray<QuerySearchResultProvider> queryResults;

public FetchPhase(AtomicArray<QuerySearchResultProvider> queryResults,
FetchPhase(AtomicArray<QuerySearchResultProvider> queryResults,
SearchPhaseController searchPhaseController) {
this.fetchResults = new AtomicArray<>(queryResults.length());
this.searchPhaseController = searchPhaseController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ParsedScrollId {

private final ScrollIdForNode[] context;

public ParsedScrollId(String source, String type, ScrollIdForNode[] context) {
ParsedScrollId(String source, String type, ScrollIdForNode[] context) {
this.source = source;
this.type = type;
this.context = context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ScrollIdForNode {
private final String node;
private final long scrollId;

public ScrollIdForNode(String node, long scrollId) {
ScrollIdForNode(String node, long scrollId) {
this.node = node;
this.scrollId = scrollId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private final class DfsQueryPhase implements CheckedRunnable<Exception> {
private final AtomicArray<DfsSearchResult> firstResults;
private final Function<AtomicArray<QuerySearchResultProvider>, CheckedRunnable<Exception>> nextPhaseFactory;

public DfsQueryPhase(AtomicArray<DfsSearchResult> firstResults,
DfsQueryPhase(AtomicArray<DfsSearchResult> firstResults,
SearchPhaseController searchPhaseController,
Function<AtomicArray<QuerySearchResultProvider>, CheckedRunnable<Exception>> nextPhaseFactory) {
this.queryResult = new AtomicArray<>(firstResults.length());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void writeTo(StreamOutput out) throws IOException {
static class SearchFreeContextRequest extends ScrollFreeContextRequest implements IndicesRequest {
private OriginalIndices originalIndices;

public SearchFreeContextRequest() {
SearchFreeContextRequest() {
}

SearchFreeContextRequest(SearchRequest request, long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <Request extends ActionRequest, Response extends ActionResponse> void apply(Task
* filter chain. This base class should serve any action filter implementations that doesn't require
* to apply async filtering logic.
*/
public abstract static class Simple extends AbstractComponent implements ActionFilter {
abstract class Simple extends AbstractComponent implements ActionFilter {

protected Simple(Settings settings) {
super(settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ public interface ActionFilterChain<Request extends ActionRequest, Response exten
* Continue processing the request. Should only be called if a response has not been sent through
* the given {@link ActionListener listener}
*/
void proceed(Task task, final String action, final Request request, final ActionListener<Response> listener);
void proceed(Task task, String action, Request request, ActionListener<Response> listener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,10 @@ class NodeResponse extends TransportResponse {
protected List<BroadcastShardOperationFailedException> exceptions;
protected List<ShardOperationResult> results;

public NodeResponse() {
NodeResponse() {
}

public NodeResponse(String nodeId,
NodeResponse(String nodeId,
int totalShards,
List<ShardOperationResult> results,
List<BroadcastShardOperationFailedException> exceptions) {
Expand Down
Loading

0 comments on commit e8c58c0

Please sign in to comment.