diff --git a/build-tools-internal/src/main/resources/checkstyle.xml b/build-tools-internal/src/main/resources/checkstyle.xml
index fa3fe067480d9..abaab3a1a8ae0 100644
--- a/build-tools-internal/src/main/resources/checkstyle.xml
+++ b/build-tools-internal/src/main/resources/checkstyle.xml
@@ -114,6 +114,7 @@
+
-->
diff --git a/libs/nio/src/test/java/org/elasticsearch/nio/EventHandlerTests.java b/libs/nio/src/test/java/org/elasticsearch/nio/EventHandlerTests.java
index 857fab8017925..82f211a3eb3be 100644
--- a/libs/nio/src/test/java/org/elasticsearch/nio/EventHandlerTests.java
+++ b/libs/nio/src/test/java/org/elasticsearch/nio/EventHandlerTests.java
@@ -83,18 +83,18 @@ public void testRegisterCallsContext() throws IOException {
}
public void testActiveNonServerAddsOP_CONNECTAndOP_READInterest() throws IOException {
- SocketChannelContext context = mock(SocketChannelContext.class);
- when(context.getSelectionKey()).thenReturn(new TestSelectionKey(0));
- handler.handleActive(context);
- assertEquals(SelectionKey.OP_READ | SelectionKey.OP_CONNECT, context.getSelectionKey().interestOps());
+ SocketChannelContext mockContext = mock(SocketChannelContext.class);
+ when(mockContext.getSelectionKey()).thenReturn(new TestSelectionKey(0));
+ handler.handleActive(mockContext);
+ assertEquals(SelectionKey.OP_READ | SelectionKey.OP_CONNECT, mockContext.getSelectionKey().interestOps());
}
public void testHandleServerActiveSetsOP_ACCEPTInterest() throws IOException {
- ServerChannelContext serverContext = mock(ServerChannelContext.class);
- when(serverContext.getSelectionKey()).thenReturn(new TestSelectionKey(0));
- handler.handleActive(serverContext);
+ ServerChannelContext mockServerContext = mock(ServerChannelContext.class);
+ when(mockServerContext.getSelectionKey()).thenReturn(new TestSelectionKey(0));
+ handler.handleActive(mockServerContext);
- assertEquals(SelectionKey.OP_ACCEPT, serverContext.getSelectionKey().interestOps());
+ assertEquals(SelectionKey.OP_ACCEPT, mockServerContext.getSelectionKey().interestOps());
}
public void testHandleAcceptAccept() throws IOException {
@@ -146,9 +146,9 @@ public void testConnectExceptionCallsExceptionHandler() throws IOException {
}
public void testHandleReadDelegatesToContext() throws IOException {
- SocketChannelContext context = mock(SocketChannelContext.class);
- handler.handleRead(context);
- verify(context).read();
+ SocketChannelContext mockContext = mock(SocketChannelContext.class);
+ handler.handleRead(mockContext);
+ verify(mockContext).read();
}
public void testReadExceptionCallsExceptionHandler() {
@@ -165,53 +165,53 @@ public void testWriteExceptionCallsExceptionHandler() {
public void testPostHandlingCallWillCloseTheChannelIfReady() throws IOException {
NioSocketChannel channel = mock(NioSocketChannel.class);
- SocketChannelContext context = mock(SocketChannelContext.class);
+ SocketChannelContext mockContext = mock(SocketChannelContext.class);
- when(channel.getContext()).thenReturn(context);
- when(context.selectorShouldClose()).thenReturn(true);
- handler.postHandling(context);
+ when(channel.getContext()).thenReturn(mockContext);
+ when(mockContext.selectorShouldClose()).thenReturn(true);
+ handler.postHandling(mockContext);
- verify(context).closeFromSelector();
+ verify(mockContext).closeFromSelector();
}
public void testPostHandlingCallWillNotCloseTheChannelIfNotReady() throws IOException {
- SocketChannelContext context = mock(SocketChannelContext.class);
- when(context.getSelectionKey()).thenReturn(new TestSelectionKey(SelectionKey.OP_READ | SelectionKey.OP_WRITE));
- when(context.selectorShouldClose()).thenReturn(false);
+ SocketChannelContext mockContext = mock(SocketChannelContext.class);
+ when(mockContext.getSelectionKey()).thenReturn(new TestSelectionKey(SelectionKey.OP_READ | SelectionKey.OP_WRITE));
+ when(mockContext.selectorShouldClose()).thenReturn(false);
NioSocketChannel channel = mock(NioSocketChannel.class);
- when(channel.getContext()).thenReturn(context);
+ when(channel.getContext()).thenReturn(mockContext);
- handler.postHandling(context);
+ handler.postHandling(mockContext);
- verify(context, times(0)).closeFromSelector();
+ verify(mockContext, times(0)).closeFromSelector();
}
public void testPostHandlingWillAddWriteIfNecessary() throws IOException {
TestSelectionKey selectionKey = new TestSelectionKey(SelectionKey.OP_READ);
- SocketChannelContext context = mock(SocketChannelContext.class);
- when(context.getSelectionKey()).thenReturn(selectionKey);
- when(context.readyForFlush()).thenReturn(true);
+ SocketChannelContext mockContext = mock(SocketChannelContext.class);
+ when(mockContext.getSelectionKey()).thenReturn(selectionKey);
+ when(mockContext.readyForFlush()).thenReturn(true);
NioSocketChannel channel = mock(NioSocketChannel.class);
- when(channel.getContext()).thenReturn(context);
+ when(channel.getContext()).thenReturn(mockContext);
assertEquals(SelectionKey.OP_READ, selectionKey.interestOps());
- handler.postHandling(context);
+ handler.postHandling(mockContext);
assertEquals(SelectionKey.OP_READ | SelectionKey.OP_WRITE, selectionKey.interestOps());
}
public void testPostHandlingWillRemoveWriteIfNecessary() throws IOException {
TestSelectionKey key = new TestSelectionKey(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
- SocketChannelContext context = mock(SocketChannelContext.class);
- when(context.getSelectionKey()).thenReturn(key);
- when(context.readyForFlush()).thenReturn(false);
+ SocketChannelContext mockContext = mock(SocketChannelContext.class);
+ when(mockContext.getSelectionKey()).thenReturn(key);
+ when(mockContext.readyForFlush()).thenReturn(false);
NioSocketChannel channel = mock(NioSocketChannel.class);
- when(channel.getContext()).thenReturn(context);
+ when(channel.getContext()).thenReturn(mockContext);
assertEquals(SelectionKey.OP_READ | SelectionKey.OP_WRITE, key.interestOps());
- handler.postHandling(context);
+ handler.postHandling(mockContext);
assertEquals(SelectionKey.OP_READ, key.interestOps());
}
diff --git a/libs/nio/src/test/java/org/elasticsearch/nio/NioSelectorTests.java b/libs/nio/src/test/java/org/elasticsearch/nio/NioSelectorTests.java
index 030bb5f3bad72..5fbe122415398 100644
--- a/libs/nio/src/test/java/org/elasticsearch/nio/NioSelectorTests.java
+++ b/libs/nio/src/test/java/org/elasticsearch/nio/NioSelectorTests.java
@@ -85,12 +85,12 @@ public void setUp() throws Exception {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testQueueChannelForClosed() throws IOException {
- NioChannel channel = mock(NioChannel.class);
+ NioChannel mockChannel = mock(NioChannel.class);
ChannelContext context = mock(ChannelContext.class);
- when(channel.getContext()).thenReturn(context);
+ when(mockChannel.getContext()).thenReturn(context);
when(context.getSelector()).thenReturn(selector);
- selector.queueChannelClose(channel);
+ selector.queueChannelClose(mockChannel);
selector.singleLoop();
@@ -100,12 +100,12 @@ public void testQueueChannelForClosed() throws IOException {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testCloseException() throws IOException, InterruptedException {
IOException ioException = new IOException();
- NioChannel channel = mock(NioChannel.class);
+ NioChannel mockChannel = mock(NioChannel.class);
ChannelContext context = mock(ChannelContext.class);
- when(channel.getContext()).thenReturn(context);
+ when(mockChannel.getContext()).thenReturn(context);
when(context.getSelector()).thenReturn(selector);
- executeOnNewThread(() -> selector.queueChannelClose(channel));
+ executeOnNewThread(() -> selector.queueChannelClose(mockChannel));
doThrow(ioException).when(eventHandler).handleClose(context);
diff --git a/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java b/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java
index a9f845073bf4f..1c2f9f6adfd57 100644
--- a/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java
+++ b/libs/nio/src/test/java/org/elasticsearch/nio/SocketChannelContextTests.java
@@ -126,8 +126,8 @@ public void testRegisterInitiatesConnect() throws IOException {
isAccepted
);
InboundChannelBuffer buffer = InboundChannelBuffer.allocatingInstance();
- TestSocketChannelContext context = new TestSocketChannelContext(channel, selector, exceptionHandler, handler, buffer, config);
- context.register();
+ TestSocketChannelContext testContext = new TestSocketChannelContext(channel, selector, exceptionHandler, handler, buffer, config);
+ testContext.register();
if (isAccepted) {
verify(rawChannel, times(0)).connect(any(InetSocketAddress.class));
} else {
@@ -205,11 +205,11 @@ public void testConnectCanSetSocketOptions() throws IOException {
false
);
InboundChannelBuffer buffer = InboundChannelBuffer.allocatingInstance();
- TestSocketChannelContext context = new TestSocketChannelContext(channel, selector, exceptionHandler, handler, buffer, config);
+ TestSocketChannelContext testContext = new TestSocketChannelContext(channel, selector, exceptionHandler, handler, buffer, config);
doThrow(new SocketException()).doNothing().when(rawSocket).setReuseAddress(tcpReuseAddress);
- context.register();
+ testContext.register();
when(rawChannel.finishConnect()).thenReturn(true);
- context.connect();
+ testContext.connect();
verify(rawSocket, times(2)).setReuseAddress(tcpReuseAddress);
verify(rawSocket).setKeepAlive(tcpKeepAlive);
@@ -339,7 +339,7 @@ public void testCloseClosesWriteProducer() throws IOException {
when(channel.getRawChannel()).thenReturn(realChannel);
when(channel.isOpen()).thenReturn(true);
InboundChannelBuffer buffer = InboundChannelBuffer.allocatingInstance();
- BytesChannelContext context = new BytesChannelContext(
+ BytesChannelContext bytesChannelContext = new BytesChannelContext(
channel,
selector,
mock(Config.Socket.class),
@@ -347,7 +347,7 @@ public void testCloseClosesWriteProducer() throws IOException {
handler,
buffer
);
- context.closeFromSelector();
+ bytesChannelContext.closeFromSelector();
verify(handler).close();
}
}
@@ -360,8 +360,8 @@ public void testCloseClosesChannelBuffer() throws IOException {
IntFunction pageAllocator = (n) -> new Page(ByteBuffer.allocate(n), closer);
InboundChannelBuffer buffer = new InboundChannelBuffer(pageAllocator);
buffer.ensureCapacity(1);
- TestSocketChannelContext context = new TestSocketChannelContext(channel, selector, exceptionHandler, handler, buffer);
- context.closeFromSelector();
+ TestSocketChannelContext testContext = new TestSocketChannelContext(channel, selector, exceptionHandler, handler, buffer);
+ testContext.closeFromSelector();
verify(closer).close();
}
}
diff --git a/libs/nio/src/test/java/org/elasticsearch/nio/TestSelectionKey.java b/libs/nio/src/test/java/org/elasticsearch/nio/TestSelectionKey.java
index 91ee754eef886..b0da6af7d730a 100644
--- a/libs/nio/src/test/java/org/elasticsearch/nio/TestSelectionKey.java
+++ b/libs/nio/src/test/java/org/elasticsearch/nio/TestSelectionKey.java
@@ -15,11 +15,11 @@
public class TestSelectionKey extends AbstractSelectionKey {
- private int ops = 0;
+ private int interestOps = 0;
private int readyOps;
public TestSelectionKey(int ops) {
- this.ops = ops;
+ this.interestOps = ops;
}
@Override
@@ -34,12 +34,12 @@ public Selector selector() {
@Override
public int interestOps() {
- return ops;
+ return interestOps;
}
@Override
public SelectionKey interestOps(int ops) {
- this.ops = ops;
+ this.interestOps = ops;
return this;
}
diff --git a/libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParserConfiguration.java b/libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParserConfiguration.java
index b2e3ea504350a..21765a7e3a54d 100644
--- a/libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParserConfiguration.java
+++ b/libs/x-content/src/main/java/org/elasticsearch/xcontent/XContentParserConfiguration.java
@@ -93,13 +93,13 @@ public RestApiVersion restApiVersion() {
/**
* Replace the configured filtering.
*/
- public XContentParserConfiguration withFiltering(Set includes, Set excludes) {
+ public XContentParserConfiguration withFiltering(Set includeStrings, Set excludeStrings) {
return new XContentParserConfiguration(
registry,
deprecationHandler,
restApiVersion,
- FilterPath.compile(includes),
- FilterPath.compile(excludes)
+ FilterPath.compile(includeStrings),
+ FilterPath.compile(excludeStrings)
);
}
diff --git a/libs/x-content/src/test/java/org/elasticsearch/xcontent/ConstructingObjectParserTests.java b/libs/x-content/src/test/java/org/elasticsearch/xcontent/ConstructingObjectParserTests.java
index ce83b11007896..3fc353ad0f103 100644
--- a/libs/x-content/src/test/java/org/elasticsearch/xcontent/ConstructingObjectParserTests.java
+++ b/libs/x-content/src/test/java/org/elasticsearch/xcontent/ConstructingObjectParserTests.java
@@ -380,7 +380,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
private static ConstructingObjectParser buildParser(boolean animalRequired, boolean vegetableRequired) {
ConstructingObjectParser parser = new ConstructingObjectParser<>(
"has_required_arguments",
- a -> new HasCtorArguments((String) a[0], (Integer) a[1])
+ args -> new HasCtorArguments((String) args[0], (Integer) args[1])
);
parser.declareString(animalRequired ? constructorArg() : optionalConstructorArg(), new ParseField("animal"));
parser.declareInt(vegetableRequired ? constructorArg() : optionalConstructorArg(), new ParseField("vegetable"));
diff --git a/libs/x-content/src/test/java/org/elasticsearch/xcontent/ObjectParserTests.java b/libs/x-content/src/test/java/org/elasticsearch/xcontent/ObjectParserTests.java
index 9d5f6e1450500..3bfb29bc2a269 100644
--- a/libs/x-content/src/test/java/org/elasticsearch/xcontent/ObjectParserTests.java
+++ b/libs/x-content/src/test/java/org/elasticsearch/xcontent/ObjectParserTests.java
@@ -167,7 +167,7 @@ public void setName(String name) {
this.name = name;
}
- public void setURI(URI uri) {
+ public void setUri(URI uri) {
this.uri = uri;
}
}
@@ -180,9 +180,9 @@ class CustomParseContext {
this.parser = parser;
}
- public URI parseURI(XContentParser parser) {
+ public URI parseURI(XContentParser xContentParser) {
try {
- return this.parser.parseURI(parser);
+ return this.parser.parseURI(xContentParser);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
@@ -194,7 +194,7 @@ public URI parseURI(XContentParser parser) {
);
ObjectParser objectParser = new ObjectParser<>("foo");
objectParser.declareString(Foo::setName, new ParseField("name"));
- objectParser.declareObjectOrDefault(Foo::setURI, (p, s) -> s.parseURI(p), () -> null, new ParseField("url"));
+ objectParser.declareObjectOrDefault(Foo::setUri, (p, s) -> s.parseURI(p), () -> null, new ParseField("url"));
Foo s = objectParser.parse(parser, new Foo(), new CustomParseContext(new ClassicParser()));
assertEquals(s.uri.getHost(), "foobar");
assertEquals(s.uri.getPort(), 80);
@@ -705,8 +705,8 @@ public void setInts(List ints) {
this.ints = ints;
}
- public void setArray(List