Always use 'this.' when accessing fields

Ensure that `this.` is used consistently when accessing class
fields.

Issue: SPR-16968
This commit is contained in:
Phillip Webb
2018-06-25 11:37:17 -07:00
committed by Juergen Hoeller
parent eeebd51f57
commit 0b53c1096a
154 changed files with 374 additions and 373 deletions

View File

@@ -306,12 +306,12 @@ public class VersionResourceResolver extends AbstractResourceResolver {
@Override
public String getDescription() {
return original.getDescription();
return this.original.getDescription();
}
@Override
public InputStream getInputStream() throws IOException {
return original.getInputStream();
return this.original.getInputStream();
}
@Override

View File

@@ -109,7 +109,7 @@ public class WebJarsResourceResolver extends AbstractResourceResolver {
if (endOffset != -1) {
String webjar = path.substring(startOffset, endOffset);
String partialPath = path.substring(endOffset + 1);
String webJarPath = webJarAssetLocator.getFullPathExact(webjar, partialPath);
String webJarPath = this.webJarAssetLocator.getFullPathExact(webjar, partialPath);
if (webJarPath != null) {
return webJarPath.substring(WEBJARS_LOCATION_LENGTH);
}

View File

@@ -166,7 +166,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
if (isEmpty()) {
return this;
}
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(expressions);
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(this.expressions);
result.removeIf(expression -> !expression.match(exchange));
return (result.isEmpty()) ? null : new ConsumesRequestCondition(result);
}

View File

@@ -113,7 +113,7 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
return PRE_FLIGHT_MATCH;
}
for (HeaderExpression expression : expressions) {
for (HeaderExpression expression : this.expressions) {
if (!expression.match(exchange)) {
return null;
}

View File

@@ -95,7 +95,7 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
*/
@Override
public ParamsRequestCondition getMatchingCondition(ServerWebExchange exchange) {
for (ParamExpression expression : expressions) {
for (ParamExpression expression : this.expressions) {
if (!expression.match(exchange)) {
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -142,7 +142,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
*/
private SortedSet<PathPattern> getMatchingPatterns(ServerWebExchange exchange) {
PathContainer lookupPath = exchange.getRequest().getPath().pathWithinApplication();
return patterns.stream()
return this.patterns.stream()
.filter(pattern -> pattern.matches(lookupPath))
.collect(Collectors.toCollection(TreeSet::new));
}

View File

@@ -190,7 +190,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
if (isEmpty()) {
return this;
}
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(expressions);
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(this.expressions);
result.removeIf(expression -> !expression.match(exchange));
return (result.isEmpty()) ? null : new ProducesRequestCondition(result, this.contentTypeResolver);
}
@@ -283,7 +283,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
* with a {@value MediaType#ALL_VALUE} expression.
*/
private List<ProduceMediaTypeExpression> getExpressionsToCompare() {
return (this.expressions.isEmpty() ? mediaTypeAllList : this.expressions);
return (this.expressions.isEmpty() ? this.mediaTypeAllList : this.expressions);
}

View File

@@ -492,7 +492,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
PatternsRequestCondition patternsCondition = new PatternsRequestCondition(parse(this.paths, parser));
return new RequestMappingInfo(this.mappingName, patternsCondition,
new RequestMethodsRequestCondition(methods),
new RequestMethodsRequestCondition(this.methods),
new ParamsRequestCondition(this.params),
new HeadersRequestCondition(this.headers),
new ConsumesRequestCondition(this.consumes, this.headers),

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ public class JettyWebSocketHandlerAdapter {
@OnWebSocketConnect
public void onWebSocketConnect(Session session) {
this.delegateSession = sessionFactory.apply(session);
this.delegateSession = this.sessionFactory.apply(session);
this.delegateHandler.handle(this.delegateSession).subscribe(this.delegateSession);
}
@@ -90,7 +90,7 @@ public class JettyWebSocketHandlerAdapter {
if (this.delegateSession != null) {
ByteBuffer buffer = ByteBuffer.wrap(message, offset, length);
WebSocketMessage webSocketMessage = toMessage(Type.BINARY, buffer);
delegateSession.handleMessage(webSocketMessage.getType(), webSocketMessage);
this.delegateSession.handleMessage(webSocketMessage.getType(), webSocketMessage);
}
}
@@ -100,7 +100,7 @@ public class JettyWebSocketHandlerAdapter {
if (OpCode.PONG == frame.getOpCode()) {
ByteBuffer buffer = (frame.getPayload() != null ? frame.getPayload() : EMPTY_PAYLOAD);
WebSocketMessage webSocketMessage = toMessage(Type.PONG, buffer);
delegateSession.handleMessage(webSocketMessage.getType(), webSocketMessage);
this.delegateSession.handleMessage(webSocketMessage.getType(), webSocketMessage);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,14 +84,14 @@ public class UndertowWebSocketHandlerAdapter extends AbstractReceiveListener {
private <T> WebSocketMessage toMessage(Type type, T message) {
if (Type.TEXT.equals(type)) {
byte[] bytes = ((String) message).getBytes(StandardCharsets.UTF_8);
return new WebSocketMessage(Type.TEXT, session.bufferFactory().wrap(bytes));
return new WebSocketMessage(Type.TEXT, this.session.bufferFactory().wrap(bytes));
}
else if (Type.BINARY.equals(type)) {
DataBuffer buffer = session.bufferFactory().allocateBuffer().write((ByteBuffer[]) message);
DataBuffer buffer = this.session.bufferFactory().allocateBuffer().write((ByteBuffer[]) message);
return new WebSocketMessage(Type.BINARY, buffer);
}
else if (Type.PONG.equals(type)) {
DataBuffer buffer = session.bufferFactory().allocateBuffer().write((ByteBuffer[]) message);
DataBuffer buffer = this.session.bufferFactory().allocateBuffer().write((ByteBuffer[]) message);
return new WebSocketMessage(Type.PONG, buffer);
}
else {

View File

@@ -190,7 +190,7 @@ public class UndertowWebSocketClient extends WebSocketClientSupport implements W
DefaultNegotiation negotiation, WebSocketChannel channel) {
HandshakeInfo info = afterHandshake(url, negotiation.getResponseHeaders());
UndertowWebSocketSession session = new UndertowWebSocketSession(channel, info, bufferFactory, completion);
UndertowWebSocketSession session = new UndertowWebSocketSession(channel, info, this.bufferFactory, completion);
UndertowWebSocketHandlerAdapter adapter = new UndertowWebSocketHandlerAdapter(session);
channel.getReceiveSetter().set(adapter);

View File

@@ -84,7 +84,7 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy, Life
*/
@Nullable
public WebSocketPolicy getWebSocketPolicy() {
return webSocketPolicy;
return this.webSocketPolicy;
}