Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of "unused variable" warnings #31876

Merged
merged 31 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3fd9cf6
WIP remove unused variable warnings
Jul 6, 2018
6ff4802
Remove TODO
Jul 9, 2018
efc0a46
iter
Jul 9, 2018
ae0b69d
Remove version variables, leftovers from 6861d357
Jul 10, 2018
ebd5f95
Merge branch 'master' into remove-unused-variables
Jul 10, 2018
076c36c
ScoreMode isn't used anymore, its CombineFunctions now
Jul 10, 2018
a2ec6cd
iter
Jul 10, 2018
d7b5e41
iter
Jul 10, 2018
77820c7
Remove loop that is never going to be executed
Jul 10, 2018
ca69bdc
Remove unused params from SSource and Walker
Jul 10, 2018
793fbe0
Merge branch 'master' into remove-unused-variables
Jul 10, 2018
4aa37f2
Merge branch 'master' into remove-unused-variables
Jul 11, 2018
b276197
Merge branch 'master' into remove-unused-variables
Jul 11, 2018
ef4af7d
Merge branch 'master' into remove-unused-variables
Jul 16, 2018
4d58df5
Merge branch 'master' into remove-unused-variables
Jul 17, 2018
9a4c0cb
Merge branch 'master' into remove-unused-variables
Jul 18, 2018
2720ae3
Re-add accidentally removed import
Jul 18, 2018
4bb6045
Merge branch 'master' into remove-unused-variables
Jul 20, 2018
fb96b0c
Merge branch 'master' into remove-unused-variables
Jul 24, 2018
c61e6e9
Merge branch 'master' into remove-unused-variables
Aug 6, 2018
643f2b5
Merge branch 'master' into remove-unused-variables
Aug 8, 2018
95f1adf
Merge branch 'master' into remove-unused-variables
Aug 27, 2018
fd344db
Merge branch 'master' into remove-unused-variables
Sep 3, 2018
95d8624
Merge branch 'master' into remove-unused-variables
Sep 17, 2018
ff0d7f4
Merge branch 'master' into remove-unused-variables
Sep 20, 2018
52979f1
Merge branch 'master' into remove-unused-variables
Sep 25, 2018
654f350
iteration: adressing comments
Sep 25, 2018
f407932
Muting MovAvgIT#testBadModelParams
Sep 25, 2018
21118b1
iter
Sep 25, 2018
460a7fa
Revert removing code in TemplateUpdateServiceTests
Sep 25, 2018
a5cc0c8
Merge branch 'master' into remove-unused-variables
Sep 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.fasterxml.jackson.core.JsonParseException;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
Expand Down Expand Up @@ -85,7 +84,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import static org.elasticsearch.client.RestClientTestUtil.randomHeaders;
import static org.elasticsearch.common.xcontent.XContentHelper.toXContent;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.mockito.Matchers.any;
Expand Down Expand Up @@ -137,7 +135,6 @@ public void testPingSocketTimeout() throws IOException {
}

public void testInfo() throws IOException {
Header[] headers = randomHeaders(random(), "Header");
MainResponse testInfo = new MainResponse("nodeName", Version.CURRENT, new ClusterName("clusterName"), "clusterUuid",
Build.CURRENT);
mockResponse(testInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
*/
public class CRUDDocumentationIT extends ESRestHighLevelClientTestCase {

@SuppressWarnings("unused")
cbuescher marked this conversation as resolved.
Show resolved Hide resolved
public void testIndex() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -264,6 +265,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testUpdate() throws Exception {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -532,6 +534,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testDelete() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -651,6 +654,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testBulk() throws Exception {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -753,6 +757,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testGet() throws Exception {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -1067,6 +1072,7 @@ public void afterBulk(long executionId, BulkRequest request, Throwable failure)
}
}

@SuppressWarnings("unused")
public void testMultiGet() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testClusterGetSettings() throws IOException {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -257,6 +258,7 @@ public void onFailure(Exception e) {
assertTrue(latch.await(30L, TimeUnit.SECONDS));
}

@SuppressWarnings("unused")
public void testClusterHealth() throws IOException {
RestHighLevelClient client = highLevelClient();
client.indices().create(new CreateIndexRequest("index"), RequestOptions.DEFAULT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testGetFieldMapping() throws IOException, InterruptedException {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -896,6 +897,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testRefreshIndex() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -964,6 +966,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testFlushIndex() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1040,6 +1043,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testSyncedFlushIndex() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1313,6 +1317,7 @@ public void onFailure(Exception e) {
assertTrue(latch.await(30L, TimeUnit.SECONDS));
}

@SuppressWarnings("unused")
public void testForceMergeIndex() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1386,6 +1391,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testClearCache() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1532,6 +1538,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testExistsAlias() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1595,6 +1602,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testUpdateAliases() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1920,6 +1928,7 @@ public void onFailure(Exception e) {
assertTrue(latch.await(30L, TimeUnit.SECONDS));
}

@SuppressWarnings("unused")
public void testGetAlias() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -1990,6 +1999,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testIndexPutSettings() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -2320,6 +2330,7 @@ public void onFailure(Exception e) {
assertTrue(latch.await(30L, TimeUnit.SECONDS));
}

@SuppressWarnings("unused")
public void testValidateQuery() throws IOException, InterruptedException {
RestHighLevelClient client = highLevelClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testGetPipeline() throws IOException {
RestHighLevelClient client = highLevelClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ public void testSearchRequestSuggestions() throws IOException {
}
}

@SuppressWarnings("unused")
public void testSearchRequestHighlighting() throws IOException {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -829,21 +830,22 @@ public void onFailure(Exception e) {

assertTrue(latch.await(30L, TimeUnit.SECONDS));
}


@SuppressWarnings("unused")
public void testMultiSearchTemplateWithInlineScript() throws Exception {
indexSearchTestData();
RestHighLevelClient client = highLevelClient();

// tag::multi-search-template-request-inline
String [] searchTerms = {"elasticsearch", "logstash", "kibana"};

MultiSearchTemplateRequest multiRequest = new MultiSearchTemplateRequest(); // <1>
for (String searchTerm : searchTerms) {
SearchTemplateRequest request = new SearchTemplateRequest(); // <2>
request.setRequest(new SearchRequest("posts"));
request.setRequest(new SearchRequest("posts"));

request.setScriptType(ScriptType.INLINE);
request.setScript(
request.setScript(
"{" +
" \"query\": { \"match\" : { \"{{field}}\" : \"{{value}}\" } }," +
" \"size\" : \"{{size}}\"" +
Expand All @@ -854,15 +856,15 @@ public void testMultiSearchTemplateWithInlineScript() throws Exception {
scriptParams.put("value", searchTerm);
scriptParams.put("size", 5);
request.setScriptParams(scriptParams);
multiRequest.add(request); // <3>

multiRequest.add(request); // <3>
}
// end::multi-search-template-request-inline

// tag::multi-search-template-request-sync
MultiSearchTemplateResponse multiResponse = client.multiSearchTemplate(multiRequest, RequestOptions.DEFAULT);
// end::multi-search-template-request-sync

// tag::multi-search-template-response
for (Item item : multiResponse.getResponses()) { // <1>
if (item.isFailure()) {
Expand All @@ -882,7 +884,7 @@ public void testMultiSearchTemplateWithInlineScript() throws Exception {
assertTrue(searchResponse.getHits().totalHits > 0);

}

public void testMultiSearchTemplateWithStoredScript() throws Exception {
indexSearchTestData();
RestHighLevelClient client = highLevelClient();
Expand All @@ -892,16 +894,16 @@ public void testMultiSearchTemplateWithStoredScript() throws Exception {

// tag::multi-search-template-request-stored
MultiSearchTemplateRequest multiRequest = new MultiSearchTemplateRequest();

String [] searchTerms = {"elasticsearch", "logstash", "kibana"};
for (String searchTerm : searchTerms) {

SearchTemplateRequest request = new SearchTemplateRequest();
request.setRequest(new SearchRequest("posts"));

request.setScriptType(ScriptType.STORED);
request.setScript("title_search");

Map<String, Object> params = new HashMap<>();
params.put("field", "title");
params.put("value", searchTerm);
Expand All @@ -911,8 +913,8 @@ public void testMultiSearchTemplateWithStoredScript() throws Exception {
}
// end::multi-search-template-request-stored




// tag::multi-search-template-execute
MultiSearchTemplateResponse multiResponse = client.multiSearchTemplate(multiRequest, RequestOptions.DEFAULT);
Expand Down Expand Up @@ -966,7 +968,7 @@ protected void registerQueryScript(RestClient restClient) throws IOException {
// end::register-script
assertEquals(RestStatus.OK.getStatus(), scriptResponse.getStatusLine().getStatusCode());
}


public void testExplain() throws Exception {
indexSearchTestData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
Expand Down Expand Up @@ -462,6 +462,7 @@ public void onFailure(Exception exception) {
}
}

@SuppressWarnings("unused")
public void testSnapshotGetSnapshots() throws IOException {
RestHighLevelClient client = highLevelClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
*/
public class StoredScriptsDocumentationIT extends ESRestHighLevelClientTestCase {

@SuppressWarnings("unused")
public void testGetStoredScript() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down Expand Up @@ -129,6 +130,7 @@ public void onFailure(Exception e) {

}

@SuppressWarnings("unused")
public void testDeleteStoredScript() throws Exception {
RestHighLevelClient client = highLevelClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
*/
public class TasksClientDocumentationIT extends ESRestHighLevelClientTestCase {

@SuppressWarnings("unused")
public void testListTasks() throws IOException {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -149,6 +150,7 @@ public void onFailure(Exception e) {
}
}

@SuppressWarnings("unused")
public void testCancelTasks() throws IOException {
RestHighLevelClient client = highLevelClient();
{
Expand Down
3 changes: 2 additions & 1 deletion libs/grok/src/main/java/org/elasticsearch/grok/Grok.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Collections;

public final class Grok {

Expand Down Expand Up @@ -184,6 +184,7 @@ public String toRegex(String grokPattern) {
String namedPatternRef = groupMatch(NAME_GROUP, region, grokPattern);
String subName = groupMatch(SUBNAME_GROUP, region, grokPattern);
// TODO(tal): Support definitions
cbuescher marked this conversation as resolved.
Show resolved Hide resolved
@SuppressWarnings("unused")
String definition = groupMatch(DEFINITION_GROUP, region, grokPattern);
String patternName = groupMatch(PATTERN_GROUP, region, grokPattern);

Expand Down
2 changes: 0 additions & 2 deletions libs/grok/src/test/java/org/elasticsearch/grok/GrokTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ public void testCircularReference() {
}

public void testBooleanCaptures() {
Map<String, String> bank = new HashMap<>();

String pattern = "%{WORD:name}=%{WORD:status:boolean}";
Grok g = new Grok(basePatterns, pattern);

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

import org.elasticsearch.test.ESTestCase;
import org.junit.Before;
import org.mockito.ArgumentCaptor;

import java.io.IOException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -61,8 +60,6 @@ public void testMultipleFlushesWithCompositeBuffer() throws IOException {
ByteBuffer[] buffers = {ByteBuffer.allocate(10), ByteBuffer.allocate(15), ByteBuffer.allocate(3)};
FlushOperation writeOp = new FlushOperation(buffers, listener);

ArgumentCaptor<ByteBuffer[]> buffersCaptor = ArgumentCaptor.forClass(ByteBuffer[].class);

writeOp.incrementIndex(5);
assertFalse(writeOp.isFullyFlushed());
ByteBuffer[] byteBuffers = writeOp.getBuffersToWrite();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class TestStruct {
public void testFailOnValueType() throws IOException {
XContentParser parser = createParser(JsonXContent.jsonXContent, "{\"numeric_value\" : false}");
class TestStruct {
public String test;
@SuppressWarnings("unused") public String test;
}
ObjectParser<TestStruct, Void> objectParser = new ObjectParser<>("foo");
TestStruct s = new TestStruct();
Expand Down
Loading