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 27 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 @@ -114,6 +114,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 @@ -278,6 +279,7 @@ public void onFailure(Exception e) {
}
}

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

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

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

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

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

@SuppressWarnings("unused")
public void testReindexRethrottle() throws Exception {
RestHighLevelClient client = highLevelClient();
TaskId taskId = new TaskId("oTUltX4IQMOUUVeiohTt8A:124");
Expand Down Expand Up @@ -947,6 +953,7 @@ public void onFailure(Exception e) {
assertTrue(latch.await(30L, TimeUnit.SECONDS));
}

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

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

@SuppressWarnings("unused")
public void testGet() throws Exception {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -1487,6 +1496,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 @@ -706,6 +706,7 @@ public void onFailure(Exception e) {
}
}

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

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

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

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

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

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

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

Expand Down Expand Up @@ -1308,6 +1312,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 @@ -1381,6 +1386,7 @@ public void onFailure(Exception e) {
}
}

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

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

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

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

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

Expand Down Expand Up @@ -1915,6 +1923,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 @@ -1985,6 +1994,7 @@ public void onFailure(Exception e) {
}
}

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

Expand Down Expand Up @@ -2315,6 +2325,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 @@ -413,6 +413,7 @@ public void testSearchRequestSuggestions() throws IOException {
}
}

@SuppressWarnings("unused")
public void testSearchRequestHighlighting() throws IOException {
RestHighLevelClient client = highLevelClient();
{
Expand Down Expand Up @@ -831,6 +832,8 @@ public void onFailure(Exception e) {
assertTrue(latch.await(30L, TimeUnit.SECONDS));
}


@SuppressWarnings("unused")
public void testMultiSearchTemplateWithInlineScript() throws Exception {
indexSearchTestData();
RestHighLevelClient client = highLevelClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,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 @@ -66,6 +66,7 @@
*/
public class StoredScriptsDocumentationIT extends ESRestHighLevelClientTestCase {

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

Expand Down Expand Up @@ -128,6 +129,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,6 +222,7 @@ class TestStruct {
public void testFailOnValueType() throws IOException {
XContentParser parser = createParser(JsonXContent.jsonXContent, "{\"numeric_value\" : false}");
class TestStruct {
@SuppressWarnings("unused")
cbuescher marked this conversation as resolved.
Show resolved Hide resolved
public String test;
}
ObjectParser<TestStruct, Void> objectParser = new ObjectParser<>("foo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class KeepWordFilterFactory extends AbstractTokenFilterFactory {
private final CharArraySet keepWords;
private static final String KEEP_WORDS_KEY = "keep_words";
private static final String KEEP_WORDS_PATH_KEY = KEEP_WORDS_KEY + "_path";
@SuppressWarnings("unused")
private static final String KEEP_WORDS_CASE_KEY = KEEP_WORDS_KEY + "_case"; // for javadoc
cbuescher marked this conversation as resolved.
Show resolved Hide resolved

// unsupported ancient option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.apache.lucene.analysis.ru.RussianLightStemFilter;
import org.apache.lucene.analysis.snowball.SnowballFilter;
import org.apache.lucene.analysis.sv.SwedishLightStemFilter;
import org.elasticsearch.Version;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
Expand Down Expand Up @@ -94,8 +93,6 @@ public class StemmerTokenFilterFactory extends AbstractTokenFilterFactory {

@Override
public TokenStream create(TokenStream tokenStream) {
final Version indexVersion = indexSettings.getIndexVersionCreated();

if ("arabic".equalsIgnoreCase(language)) {
return new ArabicStemFilter(tokenStream);
} else if ("armenian".equalsIgnoreCase(language)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ public static final class Variable {
public final Class<?> clazz;
public final boolean readonly;
private final int slot;
private boolean used;

public Variable(Location location, String name, Class<?> clazz, int slot, boolean readonly) {
this.location = location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void setupCluster() throws Exception {
String category = categories[j] = uniqueCategories[catIndex++ % uniqueCategories.length];
Control control = categoryToControl.get(category);
if (control == null) {
categoryToControl.put(category, control = new Control(category));
categoryToControl.put(category, control = new Control());
}
control.articleIds.add(id);
}
Expand Down Expand Up @@ -457,14 +457,8 @@ public void testPostCollectAllLeafReaders() throws Exception {
}

private static final class Control {

final String category;
final Set<String> articleIds = new HashSet<>();
final Set<String> commentIds = new HashSet<>();
final Map<String, Set<String>> commenterToCommentId = new HashMap<>();

private Control(String category) {
this.category = category;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

public class ReindexDocumentationIT extends ESIntegTestCase {

@SuppressWarnings("unused")
public void reindex() {
Client client = client();
// tag::reindex1
Expand All @@ -55,6 +56,7 @@ public void reindex() {
// end::reindex1
}

@SuppressWarnings("unused")
public void updateByQuery() {
Client client = client();
{
Expand Down Expand Up @@ -165,6 +167,7 @@ public void updateByQuery() {
}
}

@SuppressWarnings("unused")
public void deleteByQuery() {
Client client = client();
// tag::delete-by-query-sync
Expand Down
Loading