Fix [serial] compiler warnings
Fix serialization warnings by applying @SuppressWarnings("serial")
when appropriate.
In certain cases and for unknown reasons, a correctly-placed
@SuppressWarnings("serial") annotation will fix the warning at the
javac level (i.e. the Gradle command-line), but will produce an
"unnecessary @SuppressWarnings" warning within Eclipse. In these
cases, a private static final serialVersionUID field has been added
with the default value of 1L.
This commit is contained in:
committed by
Chris Beams
parent
7f0aa5cfb2
commit
b0986049a3
@@ -24,6 +24,7 @@ import org.springframework.core.NestedRuntimeException;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpMessageConversionException extends NestedRuntimeException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,7 @@ package org.springframework.http.converter;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpMessageNotReadableException extends HttpMessageConversionException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ package org.springframework.http.converter;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpMessageNotWritableException extends HttpMessageConversionException {
|
||||
|
||||
/**
|
||||
@@ -44,4 +45,4 @@ public class HttpMessageNotWritableException extends HttpMessageConversionExcept
|
||||
public HttpMessageNotWritableException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.remoting.soap.SoapFaultException;
|
||||
* @deprecated in favor of JAX-WS support in {@code org.springframework.remoting.jaxws}
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("serial")
|
||||
public class JaxRpcSoapFaultException extends SoapFaultException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.remoting.soap.SoapFaultException;
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JaxWsSoapFaultException extends SoapFaultException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.http.MediaType;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class HttpMediaTypeException extends ServletException {
|
||||
|
||||
private final List<MediaType> supportedMediaTypes;
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.http.MediaType;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpMediaTypeNotAcceptableException extends HttpMediaTypeException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.http.MediaType;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpMediaTypeNotSupportedException extends HttpMediaTypeException {
|
||||
|
||||
private final MediaType contentType;
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.http.HttpMethod;
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpRequestMethodNotSupportedException extends ServletException {
|
||||
|
||||
private String method;
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.servlet.ServletException;
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpSessionRequiredException extends ServletException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.validation.ObjectError;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MethodArgumentNotValidException extends Exception {
|
||||
|
||||
private final MethodParameter parameter;
|
||||
|
||||
@@ -22,6 +22,7 @@ package org.springframework.web.bind;
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0.2
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MissingServletRequestParameterException extends ServletRequestBindingException {
|
||||
|
||||
private final String parameterName;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.web.util.NestedServletException;
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServletRequestBindingException extends NestedServletException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.web.util.WebUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @see org.springframework.web.util.WebUtils#getParametersStartingWith
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServletRequestParameterPropertyValues extends MutablePropertyValues {
|
||||
|
||||
/** Default prefix separator */
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
|
||||
* @since 3.0
|
||||
* @see org.springframework.web.bind.annotation.RequestMapping#params()
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class UnsatisfiedServletRequestParameterException extends ServletRequestBindingException {
|
||||
|
||||
private final String[] paramConditions;
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.core.NestedRuntimeException;
|
||||
* @since 2.5.6
|
||||
* @see HandlerMethodInvoker#invokeHandlerMethod
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HandlerMethodInvocationException extends NestedRuntimeException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -707,6 +707,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
/**
|
||||
* HTTP-specific subclass of UriTemplate, overriding the encode method.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
private static class HttpUrlTemplate extends UriTemplate {
|
||||
|
||||
public HttpUrlTemplate(String uriTemplate) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpSessionBindingListener;
|
||||
* @see RequestAttributes#registerDestructionCallback
|
||||
* @see ServletRequestAttributes#registerSessionDestructionCallback
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DestructionCallbackBindingListener implements HttpSessionBindingListener, Serializable {
|
||||
|
||||
private final Runnable destructionCallback;
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
* @see org.springframework.web.HttpRequestHandler
|
||||
* @see org.springframework.web.servlet.DispatcherServlet
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HttpRequestHandlerServlet extends HttpServlet {
|
||||
|
||||
private HttpRequestHandler target;
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.context.ApplicationEvent;
|
||||
* @see org.springframework.web.servlet.FrameworkServlet
|
||||
* @see org.springframework.context.ApplicationContext#publishEvent
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class RequestHandledEvent extends ApplicationEvent {
|
||||
|
||||
/** Session id that applied to the request, if any */
|
||||
|
||||
@@ -25,6 +25,7 @@ package org.springframework.web.context.support;
|
||||
* @see org.springframework.web.servlet.FrameworkServlet
|
||||
* @see org.springframework.context.ApplicationContext#publishEvent
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServletRequestHandledEvent extends RequestHandledEvent {
|
||||
|
||||
/** URL that the triggered the request */
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
* @author Colin Sampaleanu
|
||||
* @since 1.2.7
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DelegatingPhaseListenerMulticaster implements PhaseListener {
|
||||
|
||||
public PhaseId getPhaseId() {
|
||||
|
||||
@@ -23,6 +23,7 @@ package org.springframework.web.multipart;
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.0.1
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MaxUploadSizeExceededException extends MultipartException {
|
||||
|
||||
private final long maxUploadSize;
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.core.NestedRuntimeException;
|
||||
* @see MultipartResolver#resolveMultipart
|
||||
* @see org.springframework.web.multipart.support.MultipartFilter
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MultipartException extends NestedRuntimeException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* @since 29.09.2003
|
||||
* @see CommonsMultipartResolver
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CommonsMultipartFile implements MultipartFile, Serializable {
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(CommonsMultipartFile.class);
|
||||
|
||||
@@ -58,6 +58,7 @@ public class HttpSessionMutexListener implements HttpSessionListener {
|
||||
* Doesn't need to be anything but a plain Object to synchronize on.
|
||||
* Should be serializable to allow for HttpSession persistence.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
private static class Mutex implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.util.Assert;
|
||||
* @since 3.0
|
||||
* @see <a href="http://bitworking.org/projects/URI-Templates/">URI Templates</a>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class UriTemplate implements Serializable {
|
||||
|
||||
/** Captures URI template variable names. */
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.core.enums.ShortCodedLabeledEnum;
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class Colour extends ShortCodedLabeledEnum {
|
||||
|
||||
public static final Colour RED = new Colour(0, "RED");
|
||||
@@ -32,4 +33,4 @@ public class Colour extends ShortCodedLabeledEnum {
|
||||
super(code, label);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
* @author Juergen Hoeller
|
||||
* @since 21.08.2003
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean {
|
||||
|
||||
private String beanName;
|
||||
@@ -82,4 +83,4 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SerializablePerson implements Person, Serializable {
|
||||
|
||||
private String name;
|
||||
@@ -61,4 +62,4 @@ public class SerializablePerson implements Person, Serializable {
|
||||
return p.age == age && ObjectUtils.nullSafeEquals(name, p.name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,6 +450,7 @@ public class HttpInvokerTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class TestRemoteInvocation extends RemoteInvocation {
|
||||
|
||||
public TestRemoteInvocation(MethodInvocation methodInvocation) {
|
||||
@@ -458,6 +459,7 @@ public class HttpInvokerTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class TestRemoteInvocationWrapper implements Serializable {
|
||||
|
||||
private final RemoteInvocation remoteInvocation;
|
||||
@@ -468,6 +470,7 @@ public class HttpInvokerTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class TestRemoteInvocationResultWrapper implements Serializable {
|
||||
|
||||
private final RemoteInvocationResult remoteInvocationResult;
|
||||
|
||||
@@ -22,6 +22,7 @@ import javax.xml.ws.WebFault;
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@WebFault
|
||||
@SuppressWarnings("serial")
|
||||
public class OrderNotFoundException extends Exception {
|
||||
|
||||
private String faultInfo;
|
||||
|
||||
@@ -264,6 +264,7 @@ public class RestTemplateIntegrationTests {
|
||||
}
|
||||
|
||||
/** Servlet that sets the given status code. */
|
||||
@SuppressWarnings("serial")
|
||||
private static class StatusCodeServlet extends GenericServlet {
|
||||
|
||||
private final int sc;
|
||||
@@ -279,6 +280,7 @@ public class RestTemplateIntegrationTests {
|
||||
}
|
||||
|
||||
/** Servlet that returns an error message for a given status code. */
|
||||
@SuppressWarnings("serial")
|
||||
private static class ErrorServlet extends GenericServlet {
|
||||
|
||||
private final int sc;
|
||||
@@ -293,6 +295,7 @@ public class RestTemplateIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class GetServlet extends HttpServlet {
|
||||
|
||||
private final byte[] buf;
|
||||
@@ -315,6 +318,7 @@ public class RestTemplateIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class PostServlet extends HttpServlet {
|
||||
|
||||
private final String s;
|
||||
@@ -347,6 +351,7 @@ public class RestTemplateIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class UriServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
@@ -357,6 +362,7 @@ public class RestTemplateIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class MultipartServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,7 @@ public class ServletRequestAttributesTests {
|
||||
|
||||
private static final String KEY = "ThatThingThatThing";
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final Serializable VALUE = new Serializable() {
|
||||
};
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ public class SessionScopeTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class CustomSerializableDestructionAwareBeanPostProcessor
|
||||
implements DestructionAwareBeanPostProcessor, Serializable {
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public class DelegatingPhaseListenerTests extends TestCase {
|
||||
private StaticListableBeanFactory beanFactory;
|
||||
private DelegatingPhaseListenerMulticaster delPhaseListener;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
protected void setUp() {
|
||||
facesContext = new MockFacesContext();
|
||||
beanFactory = new StaticListableBeanFactory();
|
||||
@@ -80,6 +81,7 @@ public class DelegatingPhaseListenerTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class TestListener implements PhaseListener {
|
||||
|
||||
boolean beforeCalled = false;
|
||||
|
||||
@@ -397,6 +397,7 @@ public class CommonsMultipartResolverTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static class MockFileItem implements FileItem {
|
||||
|
||||
private String fieldName;
|
||||
|
||||
@@ -133,14 +133,17 @@ public final class TagUtilsTests {
|
||||
TagUtils.assertHasAncestorOfType(a, TagC.class, "a", "c");
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final class TagA extends TagSupport {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final class TagB extends TagSupport {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final class TagC extends TagSupport {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user