From f14bd5003373fc6ddd81b7efdedeffbdb0333685 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 8 Oct 2021 18:19:59 +0100 Subject: [PATCH] Prune empty method adapter classes --- .../support/ChannelInterceptorAdapter.java | 64 ------ .../CallableProcessingInterceptorAdapter.java | 61 ------ ...redResultProcessingInterceptorAdapter.java | 82 -------- .../annotation/WebMvcConfigurerAdapter.java | 191 ------------------ .../handler/HandlerInterceptorAdapter.java | 34 ---- 5 files changed, 432 deletions(-) delete mode 100644 spring-messaging/src/main/java/org/springframework/messaging/support/ChannelInterceptorAdapter.java delete mode 100644 spring-web/src/main/java/org/springframework/web/context/request/async/CallableProcessingInterceptorAdapter.java delete mode 100644 spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptorAdapter.java delete mode 100644 spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java delete mode 100644 spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerInterceptorAdapter.java diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/ChannelInterceptorAdapter.java b/spring-messaging/src/main/java/org/springframework/messaging/support/ChannelInterceptorAdapter.java deleted file mode 100644 index a8477f5843..0000000000 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/ChannelInterceptorAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.messaging.support; - -import org.springframework.lang.Nullable; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; - -/** - * A {@link ChannelInterceptor} base class with empty method implementations - * as a convenience. - * - * @author Mark Fisher - * @author Rossen Stoyanchev - * @since 4.0 - * @deprecated as of 5.0.7 {@link ChannelInterceptor} has default methods (made - * possible by a Java 8 baseline) and can be implemented directly without the - * need for this no-op adapter - */ -@Deprecated -public abstract class ChannelInterceptorAdapter implements ChannelInterceptor { - - @Override - public Message preSend(Message message, MessageChannel channel) { - return message; - } - - @Override - public void postSend(Message message, MessageChannel channel, boolean sent) { - } - - @Override - public void afterSendCompletion(Message message, MessageChannel channel, boolean sent, @Nullable Exception ex) { - } - - @Override - public boolean preReceive(MessageChannel channel) { - return true; - } - - @Override - public Message postReceive(Message message, MessageChannel channel) { - return message; - } - - @Override - public void afterReceiveCompletion(@Nullable Message message, MessageChannel channel, @Nullable Exception ex) { - } - -} diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/CallableProcessingInterceptorAdapter.java b/spring-web/src/main/java/org/springframework/web/context/request/async/CallableProcessingInterceptorAdapter.java deleted file mode 100644 index 4c04274e74..0000000000 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/CallableProcessingInterceptorAdapter.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002-2017 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.web.context.request.async; - -import java.util.concurrent.Callable; - -import org.springframework.web.context.request.NativeWebRequest; - -/** - * Abstract adapter class for the {@link CallableProcessingInterceptor} interface, - * for simplified implementation of individual methods. - * - * @author Rossen Stoyanchev - * @author Rob Winch - * @since 3.2 - * @deprecated as of 5.0 where CallableProcessingInterceptor has default methods - */ -@Deprecated -public abstract class CallableProcessingInterceptorAdapter implements CallableProcessingInterceptor { - - @Override - public void beforeConcurrentHandling(NativeWebRequest request, Callable task) throws Exception { - } - - @Override - public void preProcess(NativeWebRequest request, Callable task) throws Exception { - } - - @Override - public void postProcess(NativeWebRequest request, Callable task, Object concurrentResult) throws Exception { - } - - @Override - public Object handleTimeout(NativeWebRequest request, Callable task) throws Exception { - return RESULT_NONE; - } - - @Override - public Object handleError(NativeWebRequest request, Callable task, Throwable t) throws Exception { - return RESULT_NONE; - } - - @Override - public void afterCompletion(NativeWebRequest request, Callable task) throws Exception { - } - -} diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptorAdapter.java b/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptorAdapter.java deleted file mode 100644 index 9afac024a5..0000000000 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResultProcessingInterceptorAdapter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2002-2017 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.web.context.request.async; - -import org.springframework.web.context.request.NativeWebRequest; - -/** - * Abstract adapter class for the {@link DeferredResultProcessingInterceptor} - * interface for simplified implementation of individual methods. - * - * @author Rossen Stoyanchev - * @author Rob Winch - * @since 3.2 - * @deprecated as of 5.0 where DeferredResultProcessingInterceptor has default methods - */ -@Deprecated -public abstract class DeferredResultProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor { - - /** - * This implementation is empty. - */ - @Override - public void beforeConcurrentHandling(NativeWebRequest request, DeferredResult deferredResult) - throws Exception { - } - - /** - * This implementation is empty. - */ - @Override - public void preProcess(NativeWebRequest request, DeferredResult deferredResult) throws Exception { - } - - /** - * This implementation is empty. - */ - @Override - public void postProcess(NativeWebRequest request, DeferredResult deferredResult, - Object concurrentResult) throws Exception { - } - - /** - * This implementation returns {@code true} by default allowing other interceptors - * to be given a chance to handle the timeout. - */ - @Override - public boolean handleTimeout(NativeWebRequest request, DeferredResult deferredResult) throws Exception { - return true; - } - - /** - * This implementation returns {@code true} by default allowing other interceptors - * to be given a chance to handle the error. - */ - @Override - public boolean handleError(NativeWebRequest request, DeferredResult deferredResult, Throwable t) - throws Exception { - return true; - } - - /** - * This implementation is empty. - */ - @Override - public void afterCompletion(NativeWebRequest request, DeferredResult deferredResult) throws Exception { - } - -} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java deleted file mode 100644 index 3c9acbf1ec..0000000000 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2002-2016 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.web.servlet.config.annotation; - -import java.util.List; - -import org.springframework.format.FormatterRegistry; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.lang.Nullable; -import org.springframework.validation.MessageCodesResolver; -import org.springframework.validation.Validator; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.method.support.HandlerMethodReturnValueHandler; -import org.springframework.web.servlet.HandlerExceptionResolver; - -/** - * An implementation of {@link WebMvcConfigurer} with empty methods allowing - * subclasses to override only the methods they're interested in. - * - * @author Rossen Stoyanchev - * @since 3.1 - * @deprecated as of 5.0 {@link WebMvcConfigurer} has default methods (made - * possible by a Java 8 baseline) and can be implemented directly without the - * need for this adapter - */ -@Deprecated -public abstract class WebMvcConfigurerAdapter implements WebMvcConfigurer { - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configurePathMatch(PathMatchConfigurer configurer) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configureAsyncSupport(AsyncSupportConfigurer configurer) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addFormatters(FormatterRegistry registry) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addInterceptors(InterceptorRegistry registry) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addCorsMappings(CorsRegistry registry) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addViewControllers(ViewControllerRegistry registry) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configureViewResolvers(ViewResolverRegistry registry) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addArgumentResolvers(List argumentResolvers) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void addReturnValueHandlers(List returnValueHandlers) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configureMessageConverters(List> converters) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void extendMessageConverters(List> converters) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void configureHandlerExceptionResolvers(List exceptionResolvers) { - } - - /** - * {@inheritDoc} - *

This implementation is empty. - */ - @Override - public void extendHandlerExceptionResolvers(List exceptionResolvers) { - } - - /** - * {@inheritDoc} - *

This implementation returns {@code null}. - */ - @Override - @Nullable - public Validator getValidator() { - return null; - } - - /** - * {@inheritDoc} - *

This implementation returns {@code null}. - */ - @Override - @Nullable - public MessageCodesResolver getMessageCodesResolver() { - return null; - } - -} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerInterceptorAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerInterceptorAdapter.java deleted file mode 100644 index 9681be818d..0000000000 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerInterceptorAdapter.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2002-2020 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.web.servlet.handler; - -import org.springframework.web.servlet.AsyncHandlerInterceptor; -import org.springframework.web.servlet.HandlerInterceptor; - -/** - * Abstract adapter class for the {@link AsyncHandlerInterceptor} interface, - * for simplified implementation of pre-only/post-only interceptors. - * - * @author Juergen Hoeller - * @since 05.12.2003 - * @deprecated as of 5.3 in favor of implementing {@link HandlerInterceptor} - * and/or {@link AsyncHandlerInterceptor} directly. - */ -@Deprecated -public abstract class HandlerInterceptorAdapter implements AsyncHandlerInterceptor { - -}