Browse Source

Polish: "@Override" should be used on overriding and implementing methods

pull/1658/merge
igor-suhorukov 7 years ago committed by Juergen Hoeller
parent
commit
8080f56db8
  1. 1
      spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java
  2. 4
      spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java
  3. 3
      spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionWrapper.java
  4. 2
      spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java
  5. 17
      spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java
  6. 1
      spring-jms/src/main/java/org/springframework/jms/support/JmsMessageHeaderAccessor.java
  7. 2
      spring-jms/src/main/java/org/springframework/jms/support/SimpleJmsHeaderMapper.java
  8. 1
      spring-test/src/main/java/org/springframework/test/context/TestContextManager.java
  9. 4
      spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java
  10. 1
      spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/webdriver/WebConnectionHtmlUnitDriver.java
  11. 1
      spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java
  12. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java
  13. 1
      spring-web/src/main/java/org/springframework/web/util/pattern/RegexPathElement.java
  14. 1
      spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/CompositeRequestCondition.java
  15. 1
      spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java
  16. 1
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/CompositeRequestCondition.java
  17. 1
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ConsumesRequestCondition.java
  18. 1
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java
  19. 2
      spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java
  20. 1
      spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java
  21. 1
      spring-websocket/src/main/java/org/springframework/web/socket/server/standard/TomcatRequestUpgradeStrategy.java
  22. 1
      spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java

1
spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java

@ -121,6 +121,7 @@ public class TypeMismatchException extends PropertyAccessException { @@ -121,6 +121,7 @@ public class TypeMismatchException extends PropertyAccessException {
* Return the name of the affected property, if available.
*/
@Nullable
@Override
public String getPropertyName() {
return this.propertyName;
}

4
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java

@ -237,6 +237,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp @@ -237,6 +237,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
}
Closure beans = new Closure(this) {
@Override
public Object call(Object[] args) {
invokeBeanDefiningClosure((Closure) args[0]);
return null;
@ -815,14 +816,17 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp @@ -815,14 +816,17 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
return retVal;
}
@Override
public Object invokeMethod(String name, Object args) {
return InvokerHelper.invokeMethod(this.propertyValue, name, args);
}
@Override
public Object getProperty(String name) {
return InvokerHelper.getProperty(this.propertyValue, name);
}
@Override
public void setProperty(String name, Object value) {
InvokerHelper.setProperty(this.propertyValue, name, value);
}

3
spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionWrapper.java

@ -161,7 +161,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -161,7 +161,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
return this;
}
@Override
public Object getProperty(String property) {
if (this.definitionWrapper.isReadableProperty(property)) {
return this.definitionWrapper.getPropertyValue(property);
@ -172,6 +172,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -172,6 +172,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
return super.getProperty(property);
}
@Override
public void setProperty(String property, Object newValue) {
if (PARENT.equals(property)) {
setParent(newValue);

2
spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java

@ -471,6 +471,7 @@ public class FastByteArrayOutputStream extends OutputStream { @@ -471,6 +471,7 @@ public class FastByteArrayOutputStream extends OutputStream {
* Update the message digest with the remaining bytes in this stream.
* @param messageDigest The message digest to update
*/
@Override
public void updateMessageDigest(MessageDigest messageDigest) {
updateMessageDigest(messageDigest, available());
}
@ -481,6 +482,7 @@ public class FastByteArrayOutputStream extends OutputStream { @@ -481,6 +482,7 @@ public class FastByteArrayOutputStream extends OutputStream {
* @param messageDigest The message digest to update
* @param len how many bytes to read from this stream and use to update the message digest
*/
@Override
public void updateMessageDigest(MessageDigest messageDigest, int len) {
if (this.currentBuffer == null) {
// This stream doesn't have any data in it...

17
spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java

@ -431,74 +431,87 @@ public abstract class LogFactory { @@ -431,74 +431,87 @@ public abstract class LogFactory {
super(logger);
}
@Override
public void fatal(Object message) {
error(message);
}
@Override
public void fatal(Object message, Throwable exception) {
error(message, exception);
}
@Override
public void error(Object message) {
if (message instanceof String || this.logger.isErrorEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
}
}
@Override
public void error(Object message, Throwable exception) {
if (message instanceof String || this.logger.isErrorEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, exception);
}
}
@Override
public void warn(Object message) {
if (message instanceof String || this.logger.isWarnEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, null);
}
}
@Override
public void warn(Object message, Throwable exception) {
if (message instanceof String || this.logger.isWarnEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, exception);
}
}
@Override
public void info(Object message) {
if (message instanceof String || this.logger.isInfoEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, null);
}
}
@Override
public void info(Object message, Throwable exception) {
if (message instanceof String || this.logger.isInfoEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, exception);
}
}
@Override
public void debug(Object message) {
if (message instanceof String || this.logger.isDebugEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, null);
}
}
@Override
public void debug(Object message, Throwable exception) {
if (message instanceof String || this.logger.isDebugEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, exception);
}
}
@Override
public void trace(Object message) {
if (message instanceof String || this.logger.isTraceEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, null);
}
}
@Override
public void trace(Object message, Throwable exception) {
if (message instanceof String || this.logger.isTraceEnabled()) {
this.logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, exception);
}
}
@Override
protected Object readResolve() {
return Slf4jDelegate.createLocationAwareLog(this.name);
}
@ -623,6 +636,7 @@ public abstract class LogFactory { @@ -623,6 +636,7 @@ public abstract class LogFactory {
super(level, msg);
}
@Override
public String getSourceClassName() {
if (!this.resolved) {
resolve();
@ -630,11 +644,13 @@ public abstract class LogFactory { @@ -630,11 +644,13 @@ public abstract class LogFactory {
return super.getSourceClassName();
}
@Override
public void setSourceClassName(String sourceClassName) {
super.setSourceClassName(sourceClassName);
this.resolved = true;
}
@Override
public String getSourceMethodName() {
if (!this.resolved) {
resolve();
@ -642,6 +658,7 @@ public abstract class LogFactory { @@ -642,6 +658,7 @@ public abstract class LogFactory {
return super.getSourceMethodName();
}
@Override
public void setSourceMethodName(String sourceMethodName) {
super.setSourceMethodName(sourceMethodName);
this.resolved = true;

1
spring-jms/src/main/java/org/springframework/jms/support/JmsMessageHeaderAccessor.java

@ -128,6 +128,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor { @@ -128,6 +128,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
* @see JmsHeaders#TIMESTAMP
*/
@Nullable
@Override
public Long getTimestamp() {
return (Long) getHeader(JmsHeaders.TIMESTAMP);
}

2
spring-jms/src/main/java/org/springframework/jms/support/SimpleJmsHeaderMapper.java

@ -235,6 +235,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme @@ -235,6 +235,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
* <p>Convert {@link MessageHeaders#CONTENT_TYPE} to {@code content_type} for JMS compliance.
* @see #CONTENT_TYPE_PROPERTY
*/
@Override
protected String fromHeaderName(String headerName) {
if (MessageHeaders.CONTENT_TYPE.equals(headerName)) {
return CONTENT_TYPE_PROPERTY;
@ -247,6 +248,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme @@ -247,6 +248,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
* <p>Convert the JMS-compliant {@code content_type} to {@link MessageHeaders#CONTENT_TYPE}.
* @see #CONTENT_TYPE_PROPERTY
*/
@Override
protected String toHeaderName(String propertyName) {
if (CONTENT_TYPE_PROPERTY.equals(propertyName)) {
return MessageHeaders.CONTENT_TYPE;

1
spring-test/src/main/java/org/springframework/test/context/TestContextManager.java

@ -96,6 +96,7 @@ public class TestContextManager { @@ -96,6 +96,7 @@ public class TestContextManager {
private final ThreadLocal<TestContext> testContextHolder = new ThreadLocal<TestContext>() {
@Override
protected TestContext initialValue() {
return copyTestContext(TestContextManager.this.testContext);
}

4
spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java

@ -446,6 +446,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -446,6 +446,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
super(servletContext, method, requestURI);
}
@Override
public HttpSession getSession(boolean create) {
HttpSession session = super.getSession(false);
if (session == null && create) {
@ -462,10 +463,12 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -462,10 +463,12 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
return session;
}
@Override
public HttpSession getSession() {
return super.getSession();
}
@Override
public void setSession(HttpSession session) {
super.setSession(session);
}
@ -491,6 +494,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -491,6 +494,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
this.request = request;
}
@Override
public void invalidate() {
super.invalidate();
synchronized (HtmlUnitRequestBuilder.this.sessions) {

1
spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/webdriver/WebConnectionHtmlUnitDriver.java

@ -93,6 +93,7 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver { @@ -93,6 +93,7 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
* Return the current {@link WebClient}.
* @since 4.3
*/
@Override
public WebClient getWebClient() {
Assert.state(this.webClient != null, "No WebClient set");
return this.webClient;

1
spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java

@ -272,6 +272,7 @@ public abstract class AbstractListenerReadPublisher<T> implements Publisher<T> { @@ -272,6 +272,7 @@ public abstract class AbstractListenerReadPublisher<T> implements Publisher<T> {
* send onComplete and onError until we after onSubscribe.
*/
SUBSCRIBING {
@Override
<T> void request(AbstractListenerReadPublisher<T> publisher, long n) {
if (Operators.validate(n)) {
Operators.addCap(DEMAND_FIELD_UPDATER, publisher, n);

2
spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java

@ -262,6 +262,7 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo @@ -262,6 +262,7 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo
},
FLUSHING {
@Override
public <T> void onFlushPossible(AbstractListenerWriteFlushProcessor<T> processor) {
try {
processor.flush();
@ -277,6 +278,7 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo @@ -277,6 +278,7 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo
processor.state.get().onComplete(processor);
}
}
@Override
public <T> void onNext(AbstractListenerWriteFlushProcessor<T> proc, Publisher<? extends T> pub) {
// ignore
}

1
spring-web/src/main/java/org/springframework/web/util/pattern/RegexPathElement.java

@ -186,6 +186,7 @@ class RegexPathElement extends PathElement { @@ -186,6 +186,7 @@ class RegexPathElement extends PathElement {
return (this.regex.length - varsLength - this.variableNames.size());
}
@Override
public int getCaptureCount() {
return this.variableNames.size();
}

1
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/CompositeRequestCondition.java

@ -70,6 +70,7 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit @@ -70,6 +70,7 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
/**
* Whether this instance contains 0 conditions or not.
*/
@Override
public boolean isEmpty() {
return ObjectUtils.isEmpty(this.requestConditions);
}

1
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java

@ -147,6 +147,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro @@ -147,6 +147,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
/**
* Whether the condition has any media type expressions.
*/
@Override
public boolean isEmpty() {
return this.expressions.isEmpty();
}

1
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/CompositeRequestCondition.java

@ -71,6 +71,7 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit @@ -71,6 +71,7 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
/**
* Whether this instance contains 0 conditions or not.
*/
@Override
public boolean isEmpty() {
return ObjectUtils.isEmpty(this.requestConditions);
}

1
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ConsumesRequestCondition.java

@ -126,6 +126,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con @@ -126,6 +126,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
/**
* Whether the condition has any media type expressions.
*/
@Override
public boolean isEmpty() {
return this.expressions.isEmpty();
}

1
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java

@ -150,6 +150,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro @@ -150,6 +150,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
/**
* Whether the condition has any media type expressions.
*/
@Override
public boolean isEmpty() {
return this.expressions.isEmpty();
}

2
spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

@ -112,7 +112,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat @@ -112,7 +112,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
return (start > 0 ? (System.currentTimeMillis() - start) : 0);
}
@Override
public void sendMessage(WebSocketMessage<?> message) throws IOException {
if (shouldNotSend()) {
return;

1
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java

@ -114,6 +114,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda @@ -114,6 +114,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda
return StringUtils.tokenizeToStringArray(Version.getSupportedWireProtocolVersions(), ",");
}
@Override
protected List<WebSocketExtension> getInstalledExtensions(WebSocketContainer container) {
try {
return super.getInstalledExtensions(container);

1
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/TomcatRequestUpgradeStrategy.java

@ -81,6 +81,7 @@ public class TomcatRequestUpgradeStrategy extends AbstractStandardUpgradeStrateg @@ -81,6 +81,7 @@ public class TomcatRequestUpgradeStrategy extends AbstractStandardUpgradeStrateg
}
}
@Override
public WsServerContainer getContainer(HttpServletRequest request) {
return (WsServerContainer) super.getContainer(request);
}

1
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java

@ -86,6 +86,7 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat @@ -86,6 +86,7 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat
}
}
@Override
public ServerWebSocketContainer getContainer(HttpServletRequest request) {
return (ServerWebSocketContainer) super.getContainer(request);
}

Loading…
Cancel
Save