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

@@ -140,6 +140,7 @@ public class ConcurrentMapCache implements Cache {
}
@SuppressWarnings("serial")
private static class NullHolder implements Serializable {
}

View File

@@ -23,6 +23,7 @@ import org.springframework.beans.FatalBeanException;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class ApplicationContextException extends FatalBeanException {
/**

View File

@@ -23,6 +23,7 @@ import java.util.Locale;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class NoSuchMessageException extends RuntimeException {
/**

View File

@@ -25,6 +25,7 @@ import org.springframework.context.ApplicationEvent;
* @author Juergen Hoeller
* @since 2.5
*/
@SuppressWarnings("serial")
public abstract class ApplicationContextEvent extends ApplicationEvent {
/**

View File

@@ -25,6 +25,7 @@ import org.springframework.context.ApplicationContext;
* @since 12.08.2003
* @see ContextRefreshedEvent
*/
@SuppressWarnings("serial")
public class ContextClosedEvent extends ApplicationContextEvent {
/**

View File

@@ -25,6 +25,7 @@ import org.springframework.context.ApplicationContext;
* @since 04.03.2003
* @see ContextClosedEvent
*/
@SuppressWarnings("serial")
public class ContextRefreshedEvent extends ApplicationContextEvent {
/**

View File

@@ -26,6 +26,7 @@ import org.springframework.context.ApplicationContext;
* @since 2.5
* @see ContextStoppedEvent
*/
@SuppressWarnings("serial")
public class ContextStartedEvent extends ApplicationContextEvent {
/**

View File

@@ -26,6 +26,7 @@ import org.springframework.context.ApplicationContext;
* @since 2.5
* @see ContextStartedEvent
*/
@SuppressWarnings("serial")
public class ContextStoppedEvent extends ApplicationContextEvent {
/**

View File

@@ -66,6 +66,7 @@ public class MapAccessor implements PropertyAccessor {
* Exception thrown from {@code read} in order to reset a cached
* PropertyAccessor, allowing other accessors to have a try.
*/
@SuppressWarnings("serial")
private static class MapAccessException extends AccessException {
private final String key;

View File

@@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
* @since 13.02.2004
* @see org.springframework.context.MessageSource#getMessage(MessageSourceResolvable, java.util.Locale)
*/
@SuppressWarnings("serial")
public class DefaultMessageSourceResolvable implements MessageSourceResolvable, Serializable {
private final String[] codes;

View File

@@ -24,6 +24,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class EjbAccessException extends NestedRuntimeException {
/**

View File

@@ -54,6 +54,7 @@ import org.springframework.util.WeakReferenceMonitor;
* @deprecated as of Spring 3.2, in favor of implementing EJBs in EJB 3 style
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractEnterpriseBean implements EnterpriseBean {
public static final String BEAN_FACTORY_PATH_ENVIRONMENT_KEY = "java:comp/env/ejb/BeanFactoryPath";

View File

@@ -26,6 +26,7 @@ import javax.jms.MessageListener;
* @deprecated as of Spring 3.2, in favor of implementing EJBs in EJB 3 style
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractJmsMessageDrivenBean extends AbstractMessageDrivenBean implements MessageListener {
// Empty: The purpose of this class is to ensure

View File

@@ -43,6 +43,7 @@ import org.apache.commons.logging.LogFactory;
* @deprecated as of Spring 3.2, in favor of implementing EJBs in EJB 3 style
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractMessageDrivenBean extends AbstractEnterpriseBean
implements MessageDrivenBean {

View File

@@ -31,6 +31,7 @@ import javax.ejb.SessionContext;
* @deprecated as of Spring 3.2, in favor of implementing EJBs in EJB 3 style
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractSessionBean extends AbstractEnterpriseBean implements SmartSessionBean {
/** The SessionContext passed to this EJB */

View File

@@ -44,6 +44,7 @@ import org.springframework.beans.FatalBeanException;
* @deprecated as of Spring 3.2, in favor of implementing EJBs in EJB 3 style
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractStatefulSessionBean extends AbstractSessionBean {
/**

View File

@@ -48,6 +48,7 @@ import org.apache.commons.logging.LogFactory;
* @deprecated as of Spring 3.2, in favor of implementing EJBs in EJB 3 style
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractStatelessSessionBean extends AbstractSessionBean {
/** Logger available to subclasses */

View File

@@ -25,6 +25,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class JmxException extends NestedRuntimeException {
/**

View File

@@ -25,6 +25,7 @@ package org.springframework.jmx;
* @since 1.2
* @see org.springframework.jmx.support.JmxUtils#locateMBeanServer
*/
@SuppressWarnings("serial")
public class MBeanServerNotFoundException extends JmxException {
/**

View File

@@ -27,6 +27,7 @@ import javax.management.JMRuntimeException;
* @since 1.2
* @see MBeanClientInterceptor
*/
@SuppressWarnings("serial")
public class InvalidInvocationException extends JMRuntimeException {
/**

View File

@@ -26,6 +26,7 @@ import org.springframework.jmx.JmxException;
* @since 1.2
* @see MBeanClientInterceptor
*/
@SuppressWarnings("serial")
public class InvocationFailureException extends JmxException {
/**

View File

@@ -26,6 +26,7 @@ import org.springframework.jmx.JmxException;
* @since 2.5.6
* @see MBeanClientInterceptor
*/
@SuppressWarnings("serial")
public class MBeanConnectFailureException extends JmxException {
/**

View File

@@ -28,6 +28,7 @@ import org.springframework.jmx.JmxException;
* @see MBeanClientInterceptor
* @see MBeanProxyFactoryBean
*/
@SuppressWarnings("serial")
public class MBeanInfoRetrievalException extends JmxException {
/**

View File

@@ -25,6 +25,7 @@ import org.springframework.jmx.JmxException;
* @since 2.0
* @see MBeanExportOperations
*/
@SuppressWarnings("serial")
public class MBeanExportException extends JmxException {
/**

View File

@@ -1069,6 +1069,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
* {@link org.springframework.jmx.export.notification.NotificationPublisher}
* into the lazy resource as it is created if required.
*/
@SuppressWarnings("serial")
private class NotificationPublisherAwareLazyTargetSource extends LazyInitTargetSource {
private ModelMBean modelMBean;

View File

@@ -23,6 +23,7 @@ package org.springframework.jmx.export;
* @author Rob Harrop
* @since 2.0
*/
@SuppressWarnings("serial")
public class UnableToRegisterMBeanException extends MBeanExportException {
/**

View File

@@ -27,6 +27,7 @@ import org.springframework.jmx.JmxException;
* @see JmxAttributeSource
* @see org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler
*/
@SuppressWarnings("serial")
public class InvalidMetadataException extends JmxException {
/**

View File

@@ -28,6 +28,7 @@ import org.springframework.jmx.JmxException;
* @since 2.0
* @see NotificationPublisher
*/
@SuppressWarnings("serial")
public class UnableToSendNotificationException extends JmxException {
/**

View File

@@ -29,6 +29,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Juergen Hoeller
* @since 2.0.3
*/
@SuppressWarnings("serial")
public class JndiLookupFailureException extends NestedRuntimeException {
/**

View File

@@ -26,6 +26,7 @@ import javax.naming.NamingException;
* @since 1.2.8
* @see JndiTemplate#lookup(String, Class)
*/
@SuppressWarnings("serial")
public class TypeMismatchNamingException extends NamingException {
private Class requiredType;

View File

@@ -23,6 +23,7 @@ package org.springframework.remoting;
* @author Juergen Hoeller
* @since 1.1
*/
@SuppressWarnings("serial")
public class RemoteConnectFailureException extends RemoteAccessException {
/**

View File

@@ -25,6 +25,7 @@ package org.springframework.remoting;
* @since 2.5
* @see RemoteProxyFailureException
*/
@SuppressWarnings("serial")
public class RemoteInvocationFailureException extends RemoteAccessException {
/**

View File

@@ -23,6 +23,7 @@ package org.springframework.remoting;
* @author Juergen Hoeller
* @since 1.1
*/
@SuppressWarnings("serial")
public class RemoteLookupFailureException extends RemoteAccessException {
/**

View File

@@ -25,6 +25,7 @@ package org.springframework.remoting;
* @since 1.2.8
* @see RemoteInvocationFailureException
*/
@SuppressWarnings("serial")
public class RemoteProxyFailureException extends RemoteAccessException {
/**

View File

@@ -29,6 +29,7 @@ import org.springframework.remoting.RemoteInvocationFailureException;
* @see javax.xml.rpc.soap.SOAPFaultException
* @see javax.xml.ws.soap.SOAPFaultException
*/
@SuppressWarnings("serial")
public abstract class SoapFaultException extends RemoteInvocationFailureException {
/**

View File

@@ -26,6 +26,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class SchedulingException extends NestedRuntimeException {
/**

View File

@@ -34,6 +34,7 @@ import org.springframework.util.CustomizableThreadCreator;
* @see #setThreadPriority
* @deprecated as of Spring 3.2, in favor of using the native JDK 6 concurrent support
*/
@SuppressWarnings("serial")
@Deprecated
public class CustomizableThreadFactory extends CustomizableThreadCreator implements ThreadFactory {

View File

@@ -75,6 +75,7 @@ import org.springframework.util.Assert;
* @deprecated as of Spring 3.2, in favor of using the native JDK 6 concurrent support
*/
@Deprecated
@SuppressWarnings("serial")
public class ThreadPoolTaskExecutor extends CustomizableThreadFactory
implements SchedulingTaskExecutor, Executor, BeanNameAware, InitializingBean, DisposableBean {

View File

@@ -32,6 +32,7 @@ import org.springframework.util.CustomizableThreadCreator;
* @see #setThreadNamePrefix
* @see #setThreadPriority
*/
@SuppressWarnings("serial")
public class CustomizableThreadFactory extends CustomizableThreadCreator implements ThreadFactory {
/**

View File

@@ -40,6 +40,7 @@ import org.springframework.beans.factory.InitializingBean;
* @see java.util.concurrent.Executors
* @see java.util.concurrent.ThreadPoolExecutor
*/
@SuppressWarnings("serial")
public abstract class ExecutorConfigurationSupport extends CustomizableThreadFactory
implements BeanNameAware, InitializingBean, DisposableBean {

View File

@@ -60,6 +60,7 @@ import org.springframework.util.ObjectUtils;
* @see java.util.concurrent.ScheduledExecutorService
* @see java.util.concurrent.ScheduledThreadPoolExecutor
*/
@SuppressWarnings("serial")
public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
implements FactoryBean<ScheduledExecutorService> {

View File

@@ -49,6 +49,7 @@ import org.springframework.beans.factory.InitializingBean;
* @see java.util.concurrent.Executors
* @see java.util.concurrent.ThreadPoolExecutor
*/
@SuppressWarnings("serial")
public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
implements FactoryBean<ExecutorService>, InitializingBean, DisposableBean {

View File

@@ -63,6 +63,7 @@ import org.springframework.util.Assert;
* @see java.util.concurrent.ThreadPoolExecutor
* @see ConcurrentTaskExecutor
*/
@SuppressWarnings("serial")
public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport implements SchedulingTaskExecutor {
private final Object poolSizeMonitor = new Object();

View File

@@ -48,6 +48,7 @@ import org.springframework.util.ErrorHandler;
* @see #setThreadFactory
* @see #setErrorHandler
*/
@SuppressWarnings("serial")
public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
implements TaskScheduler, SchedulingTaskExecutor {

View File

@@ -24,6 +24,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class ScriptCompilationException extends NestedRuntimeException {
private ScriptSource scriptSource;

View File

@@ -212,6 +212,7 @@ public abstract class BshScriptUtils {
/**
* Exception to be thrown on script execution failure.
*/
@SuppressWarnings("serial")
public static class BshExecutionException extends NestedRuntimeException {
private BshExecutionException(EvalError ex) {

View File

@@ -233,6 +233,7 @@ public abstract class JRubyScriptUtils {
* have useful {@link Object#toString()}, {@link Throwable#getMessage()},
* and {@link Throwable#printStackTrace} implementations.
*/
@SuppressWarnings("serial")
public static class JRubyExecutionException extends NestedRuntimeException {
/**

View File

@@ -38,6 +38,7 @@ import org.springframework.util.Assert;
* @see org.springframework.web.servlet.ModelAndView
* @see org.springframework.web.portlet.ModelAndView
*/
@SuppressWarnings("serial")
public class ModelMap extends LinkedHashMap<String, Object> {
/**

View File

@@ -33,6 +33,7 @@ import org.springframework.validation.BindingResult;
* @since 2.5.6
* @see org.springframework.validation.BindingResult
*/
@SuppressWarnings("serial")
public class BindingAwareModelMap extends ExtendedModelMap {
@Override