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

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

View File

@@ -23,6 +23,7 @@ import java.io.Serializable;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
class TrueClassFilter implements ClassFilter, Serializable {
public static final TrueClassFilter INSTANCE = new TrueClassFilter();

View File

@@ -24,6 +24,7 @@ import java.lang.reflect.Method;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
class TrueMethodMatcher implements MethodMatcher, Serializable {
public static final TrueMethodMatcher INSTANCE = new TrueMethodMatcher();

View File

@@ -23,6 +23,7 @@ import java.io.Serializable;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
class TruePointcut implements Pointcut, Serializable {
public static final TruePointcut INSTANCE = new TruePointcut();

View File

@@ -790,6 +790,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
* Thrown in response to an ambiguous binding being detected when
* trying to resolve a method's parameter names.
*/
@SuppressWarnings("serial")
public static class AmbiguousBindingException extends RuntimeException {
/**

View File

@@ -76,6 +76,7 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
* @since 2.0
*/
@SuppressWarnings("serial")
public class AspectJExpressionPointcut extends AbstractExpressionPointcut
implements ClassFilter, IntroductionAwareMethodMatcher, BeanFactoryAware {

View File

@@ -25,6 +25,7 @@ import org.springframework.aop.support.AbstractGenericPointcutAdvisor;
* @author Rob Harrop
* @since 2.0
*/
@SuppressWarnings("serial")
public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdvisor {
private final AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();

View File

@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
* @since 2.0
* @see org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory
*/
@SuppressWarnings("serial")
public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorAutoProxyCreator {
private List<Pattern> includePatterns;

View File

@@ -46,6 +46,7 @@ import org.springframework.util.ClassUtils;
* @see #getProxy(ClassLoader)
* @see org.springframework.aop.framework.ProxyFactory
*/
@SuppressWarnings("serial")
public class AspectJProxyFactory extends ProxyCreatorSupport {
/** Cache for singleton aspect instances */

View File

@@ -26,6 +26,7 @@ import org.springframework.aop.framework.AopConfigException;
* @author Rod Johnson
* @since 2.0
*/
@SuppressWarnings("serial")
public class NotAnAtAspectException extends AopConfigException {
private Class<?> nonAspectClass;

View File

@@ -43,6 +43,7 @@ import org.springframework.util.ClassUtils;
* @author Ramnivas Laddad
* @since 2.0
*/
@SuppressWarnings("serial")
public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator {
private static final Comparator DEFAULT_PRECEDENCE_COMPARATOR = new AspectJPrecedenceComparator();

View File

@@ -33,6 +33,7 @@ import org.springframework.util.ClassUtils;
* @author Juergen Hoeller
* @since 3.2
*/
@SuppressWarnings("serial")
public abstract class AbstractAdvisingBeanPostProcessor extends ProxyConfig
implements BeanPostProcessor, BeanClassLoaderAware, Ordered {

View File

@@ -24,6 +24,7 @@ import org.springframework.core.NestedRuntimeException;
* @author Rod Johnson
* @since 13.03.2003
*/
@SuppressWarnings("serial")
public class AopConfigException extends NestedRuntimeException {
/**

View File

@@ -43,6 +43,7 @@ import org.springframework.aop.support.MethodMatchers;
* @author Adrian Colyer
* @since 2.0.3
*/
@SuppressWarnings("serial")
public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializable {
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(

View File

@@ -45,6 +45,7 @@ import org.springframework.aop.SpringProxy;
* @see AdvisedSupport#setProxyTargetClass
* @see AdvisedSupport#setInterfaces
*/
@SuppressWarnings("serial")
public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {

View File

@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
* @since 2.0.3
* @see #createAopProxy()
*/
@SuppressWarnings("serial")
public class ProxyCreatorSupport extends AdvisedSupport {
private AopProxyFactory aopProxyFactory;

View File

@@ -32,6 +32,7 @@ import org.springframework.util.ClassUtils;
* @author Rob Harrop
* @since 14.03.2003
*/
@SuppressWarnings("serial")
public class ProxyFactory extends ProxyCreatorSupport {
/**

View File

@@ -88,6 +88,7 @@ import org.springframework.util.ObjectUtils;
* @see org.springframework.aop.Advisor
* @see Advised
*/
@SuppressWarnings("serial")
public class ProxyFactoryBean extends ProxyCreatorSupport
implements FactoryBean<Object>, BeanClassLoaderAware, BeanFactoryAware {

View File

@@ -31,6 +31,7 @@ import org.springframework.aop.AfterReturningAdvice;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
class AfterReturningAdviceAdapter implements AdvisorAdapter, Serializable {
public boolean supportsAdvice(Advice advice) {

View File

@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class AfterReturningAdviceInterceptor implements MethodInterceptor, AfterAdvice, Serializable {
private final AfterReturningAdvice advice;

View File

@@ -37,6 +37,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
* @author Rob Harrop
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Serializable {
private final List<AdvisorAdapter> adapters = new ArrayList<AdvisorAdapter>(3);

View File

@@ -31,6 +31,7 @@ import org.springframework.aop.MethodBeforeAdvice;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
class MethodBeforeAdviceAdapter implements AdvisorAdapter, Serializable {
public boolean supportsAdvice(Advice advice) {

View File

@@ -31,6 +31,7 @@ import org.springframework.util.Assert;
*
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class MethodBeforeAdviceInterceptor implements MethodInterceptor, Serializable {
private MethodBeforeAdvice advice;

View File

@@ -31,6 +31,7 @@ import org.springframework.aop.ThrowsAdvice;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
class ThrowsAdviceAdapter implements AdvisorAdapter, Serializable {
public boolean supportsAdvice(Advice advice) {

View File

@@ -25,6 +25,7 @@ package org.springframework.aop.framework.adapter;
* @see org.aopalliance.aop.Advice
* @see org.springframework.aop.Advisor
*/
@SuppressWarnings("serial")
public class UnknownAdviceTypeException extends IllegalArgumentException {
/**

View File

@@ -44,6 +44,7 @@ import org.springframework.core.OrderComparator;
* @author Juergen Hoeller
* @see #findCandidateAdvisors
*/
@SuppressWarnings("serial")
public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyCreator {
private BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;

View File

@@ -87,6 +87,7 @@ import org.springframework.util.ClassUtils;
* @see BeanNameAutoProxyCreator
* @see DefaultAdvisorAutoProxyCreator
*/
@SuppressWarnings("serial")
public abstract class AbstractAutoProxyCreator extends ProxyConfig
implements SmartInstantiationAwareBeanPostProcessor, BeanClassLoaderAware, BeanFactoryAware,
Ordered, AopInfrastructureBean {

View File

@@ -42,6 +42,7 @@ import org.springframework.util.StringUtils;
* @see #setInterceptorNames
* @see AbstractAutoProxyCreator
*/
@SuppressWarnings("serial")
public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
private List<String> beanNames;

View File

@@ -33,6 +33,7 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Rod Johnson
* @author Rob Harrop
*/
@SuppressWarnings("serial")
public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator implements BeanNameAware {
/** Separator between prefix and remainder of bean name */

View File

@@ -26,6 +26,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
* @author Juergen Hoeller
* @since 2.0.7
*/
@SuppressWarnings("serial")
public class InfrastructureAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator {
private ConfigurableListableBeanFactory beanFactory;

View File

@@ -36,6 +36,7 @@ import org.aopalliance.intercept.MethodInvocation;
* @see #setSuffix
* @see #createInvocationTraceName
*/
@SuppressWarnings("serial")
public abstract class AbstractMonitoringInterceptor extends AbstractTraceInterceptor {
private String prefix = "";

View File

@@ -43,6 +43,7 @@ import org.springframework.aop.support.AopUtils;
* @see #setUseDynamicLogger
* @see #invokeUnderTrace(org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log)
*/
@SuppressWarnings("serial")
public abstract class AbstractTraceInterceptor implements MethodInterceptor, Serializable {
/**

View File

@@ -39,6 +39,7 @@ import org.springframework.util.ConcurrencyThrottleSupport;
* @since 11.02.2004
* @see #setConcurrencyLimit
*/
@SuppressWarnings("serial")
public class ConcurrencyThrottleInterceptor extends ConcurrencyThrottleSupport
implements MethodInterceptor, Serializable {

View File

@@ -67,6 +67,7 @@ import org.springframework.util.StringUtils;
* @see #setExceptionMessage
* @see SimpleTraceInterceptor
*/
@SuppressWarnings("serial")
public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
/**

View File

@@ -32,6 +32,7 @@ import org.aopalliance.intercept.MethodInvocation;
* @see SimpleTraceInterceptor
* @see CustomizableTraceInterceptor
*/
@SuppressWarnings("serial")
public class DebugInterceptor extends SimpleTraceInterceptor {
private volatile long count;

View File

@@ -123,6 +123,7 @@ public abstract class ExposeBeanNameAdvisors {
/**
* Introduction that exposes the specified bean name as invocation attribute.
*/
@SuppressWarnings("serial")
private static class ExposeBeanNameIntroduction extends DelegatingIntroductionInterceptor implements NamedBean {
private final String beanName;

View File

@@ -40,6 +40,7 @@ import org.springframework.core.Ordered;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class ExposeInvocationInterceptor implements MethodInterceptor, Ordered, Serializable {
/** Singleton instance of this class */

View File

@@ -35,6 +35,7 @@ import org.apache.commons.logging.Log;
* @see com.jamonapi.MonitorFactory
* @see PerformanceMonitorInterceptor
*/
@SuppressWarnings("serial")
public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterceptor {
private boolean trackAllInvocations = false;

View File

@@ -33,6 +33,7 @@ import org.springframework.util.StopWatch;
* @see org.springframework.util.StopWatch
* @see JamonPerformanceMonitorInterceptor
*/
@SuppressWarnings("serial")
public class PerformanceMonitorInterceptor extends AbstractMonitoringInterceptor {
/**

View File

@@ -32,6 +32,7 @@ import org.apache.commons.logging.Log;
* @since 1.2
* @see CustomizableTraceInterceptor
*/
@SuppressWarnings("serial")
public class SimpleTraceInterceptor extends AbstractTraceInterceptor {
/**

View File

@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
* @see org.springframework.beans.factory.BeanFactory#getBean
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#destroyScopedBean
*/
@SuppressWarnings("serial")
public class DefaultScopedObject implements ScopedObject, Serializable {
private final ConfigurableBeanFactory beanFactory;

View File

@@ -49,6 +49,7 @@ import org.springframework.util.ClassUtils;
* @since 2.0
* @see #setProxyTargetClass
*/
@SuppressWarnings("serial")
public class ScopedProxyFactoryBean extends ProxyConfig implements FactoryBean<Object>, BeanFactoryAware {
/** The TargetSource that manages scoping */

View File

@@ -38,6 +38,7 @@ import org.springframework.util.Assert;
* @see #setAdviceBeanName
* @see DefaultBeanFactoryPointcutAdvisor
*/
@SuppressWarnings("serial")
public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcutAdvisor implements BeanFactoryAware {
private String adviceBeanName;

View File

@@ -28,6 +28,7 @@ import java.io.Serializable;
* @see #setLocation
* @see #setExpression
*/
@SuppressWarnings("serial")
public abstract class AbstractExpressionPointcut implements ExpressionPointcut, Serializable {
private String location;

View File

@@ -26,6 +26,7 @@ import org.aopalliance.aop.Advice;
* @see #setAdvice
* @see DefaultPointcutAdvisor
*/
@SuppressWarnings("serial")
public abstract class AbstractGenericPointcutAdvisor extends AbstractPointcutAdvisor {
private Advice advice;

View File

@@ -34,6 +34,7 @@ import org.springframework.util.ObjectUtils;
* @since 1.1.2
* @see AbstractGenericPointcutAdvisor
*/
@SuppressWarnings("serial")
public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordered, Serializable {
private Integer order;

View File

@@ -47,6 +47,7 @@ import org.springframework.util.StringUtils;
* @since 1.1
* @see JdkRegexpMethodPointcut
*/
@SuppressWarnings("serial")
public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPointcut
implements Serializable {

View File

@@ -87,6 +87,7 @@ public abstract class ClassFilters {
/**
* ClassFilter implementation for a union of the given ClassFilters.
*/
@SuppressWarnings("serial")
private static class UnionClassFilter implements ClassFilter, Serializable {
private ClassFilter[] filters;
@@ -120,6 +121,7 @@ public abstract class ClassFilters {
/**
* ClassFilter implementation for an intersection of the given ClassFilters.
*/
@SuppressWarnings("serial")
private static class IntersectionClassFilter implements ClassFilter, Serializable {
private ClassFilter[] filters;

View File

@@ -36,6 +36,7 @@ import org.springframework.util.ObjectUtils;
* @author Rob Harrop
* @see org.springframework.core.ControlFlow
*/
@SuppressWarnings("serial")
public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher, Serializable {
private Class clazz;

View File

@@ -32,6 +32,7 @@ import org.springframework.aop.Pointcut;
* @see #setPointcut
* @see #setAdviceBeanName
*/
@SuppressWarnings("serial")
public class DefaultBeanFactoryPointcutAdvisor extends AbstractBeanFactoryPointcutAdvisor {
private Pointcut pointcut = Pointcut.TRUE;

View File

@@ -34,6 +34,7 @@ import org.springframework.aop.Pointcut;
* @see #setPointcut
* @see #setAdvice
*/
@SuppressWarnings("serial")
public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor implements Serializable {
private Pointcut pointcut = Pointcut.TRUE;

View File

@@ -50,6 +50,7 @@ import org.springframework.aop.ProxyMethodInvocation;
* @see #suppressInterface
* @see DelegatingIntroductionInterceptor
*/
@SuppressWarnings("serial")
public class DelegatePerTargetObjectIntroductionInterceptor extends IntroductionInfoSupport
implements IntroductionInterceptor {

View File

@@ -48,6 +48,7 @@ import org.springframework.util.Assert;
* @see #suppressInterface
* @see DelegatePerTargetObjectIntroductionInterceptor
*/
@SuppressWarnings("serial")
public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport
implements IntroductionInterceptor {

View File

@@ -40,6 +40,7 @@ import org.springframework.util.ClassUtils;
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
protected final Set<Class> publishedInterfaces = new HashSet<Class>();

View File

@@ -37,6 +37,7 @@ import java.util.regex.PatternSyntaxException;
* @author Rob Harrop
* @since 1.1
*/
@SuppressWarnings("serial")
public class JdkRegexpMethodPointcut extends AbstractRegexpMethodPointcut {
/**

View File

@@ -99,6 +99,7 @@ public abstract class MethodMatchers {
/**
* MethodMatcher implementation for a union of two given MethodMatchers.
*/
@SuppressWarnings("serial")
private static class UnionMethodMatcher implements IntroductionAwareMethodMatcher, Serializable {
private MethodMatcher mm1;
@@ -163,6 +164,7 @@ public abstract class MethodMatchers {
* MethodMatcher implementation for a union of two given MethodMatchers,
* supporting an associated ClassFilter per MethodMatcher.
*/
@SuppressWarnings("serial")
private static class ClassFilterAwareUnionMethodMatcher extends UnionMethodMatcher {
private final ClassFilter cf1;
@@ -201,6 +203,7 @@ public abstract class MethodMatchers {
/**
* MethodMatcher implementation for an intersection of two given MethodMatchers.
*/
@SuppressWarnings("serial")
private static class IntersectionMethodMatcher implements IntroductionAwareMethodMatcher, Serializable {
private MethodMatcher mm1;

View File

@@ -35,6 +35,7 @@ import org.springframework.util.PatternMatchUtils;
* @since 11.02.2004
* @see #isMatch
*/
@SuppressWarnings("serial")
public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut implements Serializable {
private List<String> mappedNames = new LinkedList<String>();

View File

@@ -29,6 +29,7 @@ import org.springframework.aop.Pointcut;
* @author Rob Harrop
* @see NameMatchMethodPointcut
*/
@SuppressWarnings("serial")
public class NameMatchMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor {
private final NameMatchMethodPointcut pointcut = new NameMatchMethodPointcut();

View File

@@ -91,6 +91,7 @@ public abstract class Pointcuts {
/**
* Pointcut implementation that matches bean property setters.
*/
@SuppressWarnings("serial")
private static class SetterPointcut extends StaticMethodMatcherPointcut implements Serializable {
public static SetterPointcut INSTANCE = new SetterPointcut();
@@ -110,6 +111,7 @@ public abstract class Pointcuts {
/**
* Pointcut implementation that matches bean property getters.
*/
@SuppressWarnings("serial")
private static class GetterPointcut extends StaticMethodMatcherPointcut implements Serializable {
public static GetterPointcut INSTANCE = new GetterPointcut();

View File

@@ -41,6 +41,7 @@ import org.springframework.util.ObjectUtils;
* @see #setPatterns
* @see JdkRegexpMethodPointcut
*/
@SuppressWarnings("serial")
public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor {
private String[] patterns;

View File

@@ -24,6 +24,7 @@ import org.springframework.aop.ClassFilter;
* Simple ClassFilter implementation that passes classes (and optionally subclasses)
* @author Rod Johnson
*/
@SuppressWarnings("serial")
public class RootClassFilter implements ClassFilter, Serializable {
private Class clazz;

View File

@@ -58,6 +58,8 @@ import org.springframework.core.Constants;
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
implements PoolableObjectFactory {
private static final long serialVersionUID = 1L;
private static final Constants constants = new Constants(GenericObjectPool.class);

View File

@@ -56,6 +56,7 @@ import org.springframework.beans.BeansException;
* @see org.springframework.beans.factory.BeanFactory#getBean
* @see #postProcessTargetObject
*/
@SuppressWarnings("serial")
public class LazyInitTargetSource extends AbstractBeanFactoryBasedTargetSource {
private Object target;

View File

@@ -31,6 +31,8 @@ import org.springframework.beans.BeansException;
*/
public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource {
private static final long serialVersionUID = 1L;
/**
* Obtain a new prototype instance for every call.
* @see #newPrototypeInstance()

View File

@@ -27,6 +27,7 @@ package org.springframework.aop.target;
* @author Juergen Hoeller
* @since 2.0.3
*/
@SuppressWarnings("serial")
public class SimpleBeanTargetSource extends AbstractBeanFactoryBasedTargetSource {
public Object getTarget() throws Exception {

View File

@@ -50,6 +50,8 @@ import org.springframework.core.NamedThreadLocal;
public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
implements ThreadLocalTargetSourceStats, DisposableBean {
private static final long serialVersionUID = 1L;
/**
* ThreadLocal holding the target associated with the current
* thread. Unlike most ThreadLocals, which are static, this variable