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

@@ -23,6 +23,7 @@ package org.springframework.beans;
* @author Juergen Hoeller
* @since 1.2.8
*/
@SuppressWarnings("serial")
public class BeanInstantiationException extends FatalBeanException {
private Class beanClass;

View File

@@ -26,6 +26,7 @@ import org.springframework.core.AttributeAccessorSupport;
* @author Juergen Hoeller
* @since 2.5
*/
@SuppressWarnings("serial")
public class BeanMetadataAttributeAccessor extends AttributeAccessorSupport implements BeanMetadataElement {
private Object source;

View File

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

View File

@@ -25,6 +25,7 @@ import java.beans.PropertyChangeEvent;
* @author Juergen Hoeller
* @since 3.0
*/
@SuppressWarnings("serial")
public class ConversionNotSupportedException extends TypeMismatchException {
/**

View File

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

View File

@@ -23,6 +23,7 @@ package org.springframework.beans;
* @author Juergen Hoeller
* @since 1.0.2
*/
@SuppressWarnings("serial")
public class InvalidPropertyException extends FatalBeanException {
private Class beanClass;

View File

@@ -24,6 +24,7 @@ import java.beans.PropertyChangeEvent;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class MethodInvocationException extends PropertyAccessException {
/**

View File

@@ -35,6 +35,7 @@ import org.springframework.util.StringUtils;
* @author Rob Harrop
* @since 13 May 2001
*/
@SuppressWarnings("serial")
public class MutablePropertyValues implements PropertyValues, Serializable {
private final List<PropertyValue> propertyValueList;

View File

@@ -23,6 +23,7 @@ package org.springframework.beans;
* @author Juergen Hoeller
* @since 1.0.2
*/
@SuppressWarnings("serial")
public class NotReadablePropertyException extends InvalidPropertyException {
/**

View File

@@ -24,6 +24,7 @@ package org.springframework.beans;
* @author Alef Arendsen
* @author Arjen Poutsma
*/
@SuppressWarnings("serial")
public class NotWritablePropertyException extends InvalidPropertyException {
private String[] possibleMatches = null;

View File

@@ -25,6 +25,7 @@ package org.springframework.beans;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class NullValueInNestedPathException extends InvalidPropertyException {
/**

View File

@@ -27,6 +27,7 @@ import org.springframework.core.ErrorCoded;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public abstract class PropertyAccessException extends BeansException implements ErrorCoded {
private transient PropertyChangeEvent propertyChangeEvent;

View File

@@ -35,6 +35,7 @@ import org.springframework.util.ObjectUtils;
* @author Juergen Hoeller
* @since 18 April 2001
*/
@SuppressWarnings("serial")
public class PropertyBatchUpdateException extends BeansException {
/** List of PropertyAccessException objects */

View File

@@ -39,6 +39,7 @@ import org.springframework.util.ObjectUtils;
* @see PropertyValues
* @see BeanWrapper
*/
@SuppressWarnings("serial")
public class PropertyValue extends BeanMetadataAttributeAccessor implements Serializable {
private final String name;

View File

@@ -26,6 +26,7 @@ import org.springframework.util.ClassUtils;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class TypeMismatchException extends PropertyAccessException {
/**

View File

@@ -30,6 +30,7 @@ import org.springframework.core.NestedRuntimeException;
*
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class BeanCreationException extends FatalBeanException {
private String beanName;

View File

@@ -24,6 +24,7 @@ package org.springframework.beans.factory;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class BeanCreationNotAllowedException extends BeanCreationException {
/**

View File

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

View File

@@ -26,6 +26,7 @@ import org.springframework.beans.FatalBeanException;
* @author Juergen Hoeller
* @author Rob Harrop
*/
@SuppressWarnings("serial")
public class BeanDefinitionStoreException extends FatalBeanException {
private String resourceDescription;

View File

@@ -24,6 +24,7 @@ import org.springframework.beans.FatalBeanException;
* @author Juergen Hoeller
* @since 3.0
*/
@SuppressWarnings("serial")
public class BeanExpressionException extends FatalBeanException {
/**
@@ -44,4 +45,4 @@ public class BeanExpressionException extends FatalBeanException {
super(msg, cause);
}
}
}

View File

@@ -31,6 +31,7 @@ import org.springframework.beans.FatalBeanException;
* @see BeanFactoryAware#setBeanFactory
* @see InitializingBean#afterPropertiesSet
*/
@SuppressWarnings("serial")
public class BeanInitializationException extends FatalBeanException {
/**

View File

@@ -24,6 +24,7 @@ package org.springframework.beans.factory;
* @since 1.1
* @see org.springframework.beans.factory.support.AbstractBeanDefinition#setAbstract
*/
@SuppressWarnings("serial")
public class BeanIsAbstractException extends BeanCreationException {
/**

View File

@@ -25,6 +25,7 @@ package org.springframework.beans.factory;
* @since 10.03.2003
* @see org.springframework.beans.factory.FactoryBean
*/
@SuppressWarnings("serial")
public class BeanIsNotAFactoryException extends BeanNotOfRequiredTypeException {
/**

View File

@@ -24,6 +24,7 @@ import org.springframework.beans.BeansException;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class BeanNotOfRequiredTypeException extends BeansException {
/** The name of the instance that was of the wrong type */

View File

@@ -25,6 +25,7 @@ import org.springframework.beans.FatalBeanException;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class CannotLoadBeanClassException extends FatalBeanException {
private String resourceDescription;

View File

@@ -34,6 +34,7 @@ import org.springframework.beans.FatalBeanException;
* @since 30.10.2003
* @see FactoryBean#getObject()
*/
@SuppressWarnings("serial")
public class FactoryBeanNotInitializedException extends FatalBeanException {
/**

View File

@@ -28,6 +28,7 @@ import org.springframework.util.ClassUtils;
* @author Juergen Hoeller
* @since 03.09.2003
*/
@SuppressWarnings("serial")
public class UnsatisfiedDependencyException extends BeanCreationException {
/**

View File

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

View File

@@ -37,6 +37,7 @@ import org.springframework.util.Assert;
* @author Juergen Hoeller
* @since 2.5
*/
@SuppressWarnings("serial")
public class DependencyDescriptor implements Serializable {
private transient MethodParameter methodParameter;

View File

@@ -131,6 +131,7 @@ public class ObjectFactoryCreatingFactoryBean extends AbstractFactoryBean<Object
/**
* Independent inner class - for serialization purposes.
*/
@SuppressWarnings("serial")
private static class TargetBeanObjectFactory implements ObjectFactory, Serializable {
private final BeanFactory beanFactory;

View File

@@ -76,6 +76,7 @@ public class ProviderCreatingFactoryBean extends AbstractFactoryBean<Provider> {
/**
* Independent inner class - for serialization purposes.
*/
@SuppressWarnings("serial")
private static class TargetBeanProvider implements Provider, Serializable {
private final BeanFactory beanFactory;

View File

@@ -26,6 +26,7 @@ import org.springframework.beans.factory.BeanDefinitionStoreException;
* @author Rob Harrop
* @since 2.0
*/
@SuppressWarnings("serial")
public class BeanDefinitionParsingException extends BeanDefinitionStoreException {
/**

View File

@@ -1643,6 +1643,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
* Special DependencyDescriptor variant for autowire="byType".
* Always optional; never considering the parameter name for choosing a primary candidate.
*/
@SuppressWarnings("serial")
private static class AutowireByTypeDependencyDescriptor extends DependencyDescriptor {
public AutowireByTypeDependencyDescriptor(MethodParameter methodParameter, boolean eager) {

View File

@@ -52,6 +52,7 @@ import org.springframework.util.StringUtils;
* @see RootBeanDefinition
* @see ChildBeanDefinition
*/
@SuppressWarnings("serial")
public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccessor
implements BeanDefinition, Cloneable {

View File

@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
* @since 2.5
* @see org.springframework.beans.factory.annotation.Qualifier
*/
@SuppressWarnings("serial")
public class AutowireCandidateQualifier extends BeanMetadataAttributeAccessor {
public static String VALUE_KEY = "value";

View File

@@ -153,6 +153,7 @@ abstract class AutowireUtils {
/**
* Reflective InvocationHandler for lazy access to the current target object.
*/
@SuppressWarnings("serial")
private static class ObjectFactoryDelegatingInvocationHandler implements InvocationHandler, Serializable {
private final ObjectFactory objectFactory;

View File

@@ -25,6 +25,7 @@ import org.springframework.beans.FatalBeanException;
* @since 21.11.2003
* @see AbstractBeanDefinition#validate()
*/
@SuppressWarnings("serial")
public class BeanDefinitionValidationException extends FatalBeanException {
/**

View File

@@ -43,6 +43,7 @@ import org.springframework.util.ObjectUtils;
* @see GenericBeanDefinition
* @see RootBeanDefinition
*/
@SuppressWarnings("serial")
public class ChildBeanDefinition extends AbstractBeanDefinition {
private String parentName;

View File

@@ -94,6 +94,7 @@ import org.springframework.util.StringUtils;
* @see PropertiesBeanDefinitionReader
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
*/
@SuppressWarnings("serial")
public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFactory
implements ConfigurableListableBeanFactory, BeanDefinitionRegistry, Serializable {
@@ -992,7 +993,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
* Minimal id reference to the factory.
* Resolved to the actual factory instance on deserialization.
*/
@SuppressWarnings("serial")
private static class SerializedBeanFactoryReference implements Serializable {
private final String id;
@@ -1020,7 +1020,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
/**
* Serializable ObjectFactory for lazy resolution of a dependency.
*/
@SuppressWarnings("serial")
private class DependencyObjectFactory implements ObjectFactory<Object>, Serializable {
private final DependencyDescriptor descriptor;
@@ -1042,7 +1041,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
/**
* Serializable ObjectFactory for lazy resolution of a dependency.
*/
@SuppressWarnings("serial")
private class DependencyProvider extends DependencyObjectFactory implements Provider<Object> {
public DependencyProvider(DependencyDescriptor descriptor, String beanName) {

View File

@@ -35,6 +35,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
* @see RootBeanDefinition
* @see ChildBeanDefinition
*/
@SuppressWarnings("serial")
public class GenericBeanDefinition extends AbstractBeanDefinition {
private String parentName;

View File

@@ -25,6 +25,7 @@ import org.springframework.util.Assert;
* @author Juergen Hoeller
* @since 3.0
*/
@SuppressWarnings("serial")
public class ManagedArray extends ManagedList<Object> {
/** Resolved element type for runtime creation of the target array */

View File

@@ -31,6 +31,7 @@ import org.springframework.beans.Mergeable;
* @author Juergen Hoeller
* @since 27.05.2003
*/
@SuppressWarnings("serial")
public class ManagedList<E> extends ArrayList<E> implements Mergeable, BeanMetadataElement {
private Object source;

View File

@@ -30,6 +30,7 @@ import org.springframework.beans.Mergeable;
* @author Rob Harrop
* @since 27.05.2003
*/
@SuppressWarnings("serial")
public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable, BeanMetadataElement {
private Object source;

View File

@@ -29,6 +29,7 @@ import org.springframework.beans.Mergeable;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class ManagedProperties extends Properties implements Mergeable, BeanMetadataElement {
private Object source;

View File

@@ -30,6 +30,7 @@ import org.springframework.beans.Mergeable;
* @author Rob Harrop
* @since 21.01.2004
*/
@SuppressWarnings("serial")
public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMetadataElement {
private Object source;

View File

@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
* @see GenericBeanDefinition
* @see ChildBeanDefinition
*/
@SuppressWarnings("serial")
public class RootBeanDefinition extends AbstractBeanDefinition {
// using a ConcurrentHashMap as a Set

View File

@@ -31,6 +31,7 @@ import org.springframework.beans.factory.BeanDefinitionStoreException;
* @see #getLineNumber()
* @see org.xml.sax.SAXParseException
*/
@SuppressWarnings("serial")
public class XmlBeanDefinitionStoreException extends BeanDefinitionStoreException {
/**

View File

@@ -51,6 +51,7 @@ import org.springframework.core.io.Resource;
* {@link XmlBeanDefinitionReader}
*/
@Deprecated
@SuppressWarnings({"serial", "all"})
public class XmlBeanFactory extends DefaultListableBeanFactory {
private final XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this);

View File

@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
* @since 26.05.2003
* @see #setToggleAscendingOnProperty
*/
@SuppressWarnings("serial")
public class MutableSortDefinition implements SortDefinition, Serializable {
private String property = "";

View File

@@ -47,6 +47,7 @@ import org.springframework.util.Assert;
* @see #getPageList()
* @see org.springframework.beans.support.MutableSortDefinition
*/
@SuppressWarnings("serial")
public class PagedListHolder<E> implements Serializable {
public static final int DEFAULT_PAGE_SIZE = 10;