From ed936cbd8951a0337ca581db76d637d4680b6cad Mon Sep 17 00:00:00 2001 From: igor-suhorukov Date: Fri, 2 Mar 2018 01:58:05 +0300 Subject: [PATCH] Polish: Overriding methods should do more than simply call the same method in the super class --- .../support/GenericApplicationContext.java | 5 ----- .../htmlunit/HtmlUnitRequestBuilder.java | 10 --------- .../org/springframework/http/MediaType.java | 22 ------------------- .../standard/ServerEndpointRegistration.java | 16 -------------- 4 files changed, 53 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java index 0314b69b72..1a73c6be72 100644 --- a/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java @@ -156,11 +156,6 @@ public class GenericApplicationContext extends AbstractApplicationContext implem this.beanFactory.setParentBeanFactory(getInternalParentBeanFactory()); } - @Override - public void setId(String id) { - super.setId(id); - } - /** * Set whether it should be allowed to override bean definitions by registering * a different definition with the same name, automatically replacing the former. diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java b/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java index 8766a9b88d..91860229ba 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java @@ -462,16 +462,6 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { } return session; } - - @Override - public HttpSession getSession() { - return super.getSession(); - } - - @Override - public void setSession(HttpSession session) { - super.setSession(session); - } } diff --git a/spring-web/src/main/java/org/springframework/http/MediaType.java b/spring-web/src/main/java/org/springframework/http/MediaType.java index 5e0aa4d362..575b66f0d9 100644 --- a/spring-web/src/main/java/org/springframework/http/MediaType.java +++ b/spring-web/src/main/java/org/springframework/http/MediaType.java @@ -436,28 +436,6 @@ public class MediaType extends MimeType implements Serializable { return (qualityFactory != null ? Double.parseDouble(unquote(qualityFactory)) : 1D); } - /** - * Indicate whether this {@code MediaType} includes the given media type. - *

For instance, {@code text/*} includes {@code text/plain} and {@code text/html}, and {@code application/*+xml} - * includes {@code application/soap+xml}, etc. This method is not symmetric. - * @param other the reference media type with which to compare - * @return {@code true} if this media type includes the given media type; {@code false} otherwise - */ - public boolean includes(@Nullable MediaType other) { - return super.includes(other); - } - - /** - * Indicate whether this {@code MediaType} is compatible with the given media type. - *

For instance, {@code text/*} is compatible with {@code text/plain}, {@code text/html}, and vice versa. - * In effect, this method is similar to {@link #includes(MediaType)}, except that it is symmetric. - * @param other the reference media type with which to compare - * @return {@code true} if this media type is compatible with the given media type; {@code false} otherwise - */ - public boolean isCompatibleWith(@Nullable MediaType other) { - return super.isCompatibleWith(other); - } - /** * Return a replica of this instance with the quality value of the given MediaType. * @return the same instance if the given MediaType doesn't have a quality value, or a new one otherwise diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java index 01019d37cf..fbc2bf7f50 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java @@ -201,22 +201,6 @@ public class ServerEndpointRegistration extends ServerEndpointConfig.Configurato super.modifyHandshake(this, request, response); } - @Override - public boolean checkOrigin(String originHeaderValue) { - return super.checkOrigin(originHeaderValue); - } - - @Override - public String getNegotiatedSubprotocol(List supported, List requested) { - return super.getNegotiatedSubprotocol(supported, requested); - } - - @Override - public List getNegotiatedExtensions(List installed, List requested) { - return super.getNegotiatedExtensions(installed, requested); - } - - @Override public String toString() { return "ServerEndpointRegistration for path '" + getPath() + "': " + getEndpointClass();