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

@@ -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.
@@ -164,7 +164,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// exclude synthetic + bridged && static class initialization
if (!isSyntheticOrBridged(access) && !STATIC_CLASS_INIT.equals(name)) {
return new LocalVariableTableVisitor(clazz, memberMap, name, desc, isStatic(access));
return new LocalVariableTableVisitor(this.clazz, this.memberMap, name, desc, isStatic(access));
}
return null;
}

View File

@@ -118,7 +118,7 @@ public class ReactiveAdapterRegistry {
public void registerReactiveType(ReactiveTypeDescriptor descriptor,
Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter) {
if (reactorPresent) {
if (this.reactorPresent) {
this.adapters.add(new ReactorAdapter(descriptor, toAdapter, fromAdapter));
}
else {

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.
@@ -642,7 +642,7 @@ public class GenericConversionService implements ConfigurableConversionService {
private List<String> getConverterStrings() {
List<String> converterStrings = new ArrayList<>();
for (ConvertersForPair convertersForPair : converters.values()) {
for (ConvertersForPair convertersForPair : this.converters.values()) {
converterStrings.add(convertersForPair.toString());
}
Collections.sort(converterStrings);

View File

@@ -106,7 +106,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
private final Set<String> defaultProfiles = new LinkedHashSet<>(getReservedDefaultProfiles());
private final MutablePropertySources propertySources = new MutablePropertySources(this.logger);
private final MutablePropertySources propertySources = new MutablePropertySources(logger);
private final ConfigurablePropertyResolver propertyResolver =
new PropertySourcesPropertyResolver(this.propertySources);

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.
@@ -226,7 +226,7 @@ public class ClassPathResource extends AbstractFileResolvingResource {
@Override
public String getDescription() {
StringBuilder builder = new StringBuilder("class path resource [");
String pathToUse = path;
String pathToUse = this.path;
if (this.clazz != null && !pathToUse.startsWith("/")) {
builder.append(ClassUtils.classPackageAsResourcePath(this.clazz));
builder.append('/');

View File

@@ -750,8 +750,8 @@ public class AntPathMatcher implements PathMatcher {
return -1;
}
boolean pattern1EqualsPath = pattern1.equals(path);
boolean pattern2EqualsPath = pattern2.equals(path);
boolean pattern1EqualsPath = pattern1.equals(this.path);
boolean pattern2EqualsPath = pattern2.equals(this.path);
if (pattern1EqualsPath && pattern2EqualsPath) {
return 0;
}

View File

@@ -557,7 +557,7 @@ public abstract class CollectionUtils {
if (this == other) {
return true;
}
return map.equals(other);
return this.map.equals(other);
}
@Override

View File

@@ -260,7 +260,7 @@ public abstract class StreamUtils {
@Override
public void write(byte[] b, int off, int let) throws IOException {
// It is critical that we override this method for performance
out.write(b, off, let);
this.out.write(b, off, let);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@@ -117,7 +117,7 @@ public class ExponentialBackOff implements BackOff {
* Return the initial interval in milliseconds.
*/
public long getInitialInterval() {
return initialInterval;
return this.initialInterval;
}
/**
@@ -132,7 +132,7 @@ public class ExponentialBackOff implements BackOff {
* Return the value to multiply the current interval by for each retry attempt.
*/
public double getMultiplier() {
return multiplier;
return this.multiplier;
}
/**
@@ -146,7 +146,7 @@ public class ExponentialBackOff implements BackOff {
* Return the maximum back off time.
*/
public long getMaxInterval() {
return maxInterval;
return this.maxInterval;
}
/**
@@ -162,7 +162,7 @@ public class ExponentialBackOff implements BackOff {
* {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}.
*/
public long getMaxElapsedTime() {
return maxElapsedTime;
return this.maxElapsedTime;
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@@ -69,7 +69,7 @@ public class FixedBackOff implements BackOff {
* Return the interval between two attempts in milliseconds.
*/
public long getInterval() {
return interval;
return this.interval;
}
/**
@@ -83,7 +83,7 @@ public class FixedBackOff implements BackOff {
* Return the maximum number of attempts in milliseconds.
*/
public long getMaxAttempts() {
return maxAttempts;
return this.maxAttempts;
}
@Override

View File

@@ -53,10 +53,10 @@ public class CompletableToListenableFutureAdapter<T> implements ListenableFuture
this.completableFuture = completableFuture;
this.completableFuture.whenComplete((result, ex) -> {
if (ex != null) {
callbacks.failure(ex);
this.callbacks.failure(ex);
}
else {
callbacks.success(result);
this.callbacks.success(result);
}
});
}

View File

@@ -55,27 +55,27 @@ class DomContentHandler implements ContentHandler {
Assert.notNull(node, "node must not be null");
this.node = node;
if (node instanceof Document) {
document = (Document) node;
this.document = (Document) node;
}
else {
document = node.getOwnerDocument();
this.document = node.getOwnerDocument();
}
Assert.notNull(document, "document must not be null");
Assert.notNull(this.document, "document must not be null");
}
private Node getParent() {
if (!elements.isEmpty()) {
return elements.get(elements.size() - 1);
if (!this.elements.isEmpty()) {
return this.elements.get(this.elements.size() - 1);
}
else {
return node;
return this.node;
}
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
Node parent = getParent();
Element element = document.createElementNS(uri, qName);
Element element = this.document.createElementNS(uri, qName);
for (int i = 0; i < attributes.getLength(); i++) {
String attrUri = attributes.getURI(i);
String attrQname = attributes.getQName(i);
@@ -85,12 +85,12 @@ class DomContentHandler implements ContentHandler {
}
}
element = (Element) parent.appendChild(element);
elements.add(element);
this.elements.add(element);
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
elements.remove(elements.size() - 1);
this.elements.remove(this.elements.size() - 1);
}
@Override
@@ -102,7 +102,7 @@ class DomContentHandler implements ContentHandler {
((Text) lastChild).appendData(data);
}
else {
Text text = document.createTextNode(data);
Text text = this.document.createTextNode(data);
parent.appendChild(text);
}
}
@@ -110,7 +110,7 @@ class DomContentHandler implements ContentHandler {
@Override
public void processingInstruction(String target, String data) throws SAXException {
Node parent = getParent();
ProcessingInstruction pi = document.createProcessingInstruction(target, data);
ProcessingInstruction pi = this.document.createProcessingInstruction(target, data);
parent.appendChild(pi);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -95,7 +95,7 @@ class XMLEventStreamReader extends AbstractXMLStreamReader {
@Override
public boolean isStandalone() {
if (this.event.isStartDocument()) {
return ((StartDocument) event).isStandalone();
return ((StartDocument) this.event).isStandalone();
}
else {
throw new IllegalStateException();
@@ -152,7 +152,7 @@ class XMLEventStreamReader extends AbstractXMLStreamReader {
@Override
public String getText() {
if (this.event.isCharacters()) {
return event.asCharacters().getData();
return this.event.asCharacters().getData();
}
else if (this.event.getEventType() == XMLEvent.COMMENT) {
return ((Comment) this.event).getText();