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:
Phillip Webb
2012-12-19 14:35:57 -08:00
committed by Chris Beams
parent 7f0aa5cfb2
commit b0986049a3
550 changed files with 705 additions and 36 deletions

View File

@@ -24,6 +24,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Arjen Poutsma
* @since 3.0
*/
@SuppressWarnings("serial")
public class HttpMessageConversionException extends NestedRuntimeException {
/**

View File

@@ -23,6 +23,7 @@ package org.springframework.http.converter;
* @author Arjen Poutsma
* @since 3.0
*/
@SuppressWarnings("serial")
public class HttpMessageNotReadableException extends HttpMessageConversionException {
/**

View File

@@ -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);
}
}
}

View File

@@ -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 {
/**

View File

@@ -29,6 +29,7 @@ import org.springframework.remoting.soap.SoapFaultException;
* @author Juergen Hoeller
* @since 2.5
*/
@SuppressWarnings("serial")
public class JaxWsSoapFaultException extends SoapFaultException {
/**

View File

@@ -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;

View File

@@ -26,6 +26,7 @@ import org.springframework.http.MediaType;
* @author Arjen Poutsma
* @since 3.0
*/
@SuppressWarnings("serial")
public class HttpMediaTypeNotAcceptableException extends HttpMediaTypeException {
/**

View File

@@ -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;

View File

@@ -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;

View File

@@ -24,6 +24,7 @@ import javax.servlet.ServletException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class HttpSessionRequiredException extends ServletException {
/**

View File

@@ -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;

View File

@@ -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;

View File

@@ -29,6 +29,7 @@ import org.springframework.web.util.NestedServletException;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class ServletRequestBindingException extends NestedServletException {
/**

View File

@@ -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 */

View File

@@ -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;

View File

@@ -27,6 +27,7 @@ import org.springframework.core.NestedRuntimeException;
* @since 2.5.6
* @see HandlerMethodInvoker#invokeHandlerMethod
*/
@SuppressWarnings("serial")
public class HandlerMethodInvocationException extends NestedRuntimeException {
/**

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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() {

View File

@@ -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;

View File

@@ -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 {
/**

View File

@@ -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);

View File

@@ -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 {
}

View File

@@ -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. */

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -22,6 +22,7 @@ import javax.xml.ws.WebFault;
* @author Juergen Hoeller
*/
@WebFault
@SuppressWarnings("serial")
public class OrderNotFoundException extends Exception {
private String faultInfo;

View File

@@ -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

View File

@@ -34,6 +34,7 @@ public class ServletRequestAttributesTests {
private static final String KEY = "ThatThingThatThing";
@SuppressWarnings("serial")
private static final Serializable VALUE = new Serializable() {
};

View File

@@ -175,6 +175,7 @@ public class SessionScopeTests extends TestCase {
}
@SuppressWarnings("serial")
private static class CustomSerializableDestructionAwareBeanPostProcessor
implements DestructionAwareBeanPostProcessor, Serializable {

View File

@@ -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;

View File

@@ -397,6 +397,7 @@ public class CommonsMultipartResolverTests {
}
@SuppressWarnings("serial")
private static class MockFileItem implements FileItem {
private String fieldName;

View File

@@ -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 {
}