From 56b7d7a94a888057aba276e3b4896fe9a93351ec Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 26 Jan 2014 00:11:11 +0100 Subject: [PATCH] Consistently declare @SuppressWarnings("serial") instead of dummy serialVersionUID --- .../target/AbstractPoolingTargetSource.java | 6 ++---- .../AbstractPrototypeBasedTargetSource.java | 6 ++---- .../aop/target/CommonsPoolTargetSource.java | 20 ++++++++++--------- .../aop/target/PrototypeTargetSource.java | 13 ++++++------ .../aop/target/ThreadLocalTargetSource.java | 18 ++++++++--------- ...ocalContainerEntityManagerFactoryBean.java | 3 +-- .../jpa/LocalEntityManagerFactoryBean.java | 5 ++--- .../springframework/web/servlet/FlashMap.java | 6 ++---- 8 files changed, 35 insertions(+), 42 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java index 7fafe60c0a5..63d8d6d2066 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,12 +50,10 @@ import org.springframework.beans.factory.DisposableBean; * @see #releaseTarget * @see #destroy */ +@SuppressWarnings("serial") public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBasedTargetSource implements PoolingConfig, DisposableBean { - private static final long serialVersionUID = 1L; - - /** The maximum size of the pool */ private int maxSize = -1; diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java index 2dd7ed7987b..24e0286e97f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,11 +43,9 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; * @see ThreadLocalTargetSource * @see CommonsPoolTargetSource */ +@SuppressWarnings("serial") public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource { - private static final long serialVersionUID = 1L; - - @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setBeanFactory(beanFactory); diff --git a/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java index 9b44df62174..5392d3c2997 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import org.springframework.beans.BeansException; import org.springframework.core.Constants; /** - * TargetSource implementation that holds objects in a configurable - * Jakarta Commons Pool. + * {@link org.springframework.aop.TargetSource} implementation that holds + * objects in a configurable Apache Commons Pool. * *

By default, an instance of {@code GenericObjectPool} is created. * Subclasses may change the type of {@code ObjectPool} used by @@ -40,8 +40,12 @@ import org.springframework.core.Constants; *

The {@code testOnBorrow}, {@code testOnReturn} and {@code testWhileIdle} * properties are explicitly not mirrored because the implementation of * {@code PoolableObjectFactory} used by this class does not implement - * meaningful validation. All exposed Commons Pool properties use the corresponding - * Commons Pool defaults: for example, + * meaningful validation. All exposed Commons Pool properties use the + * corresponding Commons Pool defaults. + * + *

Compatible with Apache Commons Pool 1.5.x and 1.6. + * Note that this class doesn't declare Commons Pool 1.6's generic type + * in order to remain compatible with Commons Pool 1.5.x at runtime. * * @author Rod Johnson * @author Rob Harrop @@ -55,10 +59,8 @@ import org.springframework.core.Constants; * @see #setTimeBetweenEvictionRunsMillis * @see #setMinEvictableIdleTimeMillis */ -public class CommonsPoolTargetSource extends AbstractPoolingTargetSource - implements PoolableObjectFactory { - - private static final long serialVersionUID = 1L; +@SuppressWarnings({"rawtypes", "unchecked", "serial"}) +public class CommonsPoolTargetSource extends AbstractPoolingTargetSource implements PoolableObjectFactory { private static final Constants constants = new Constants(GenericObjectPool.class); diff --git a/spring-aop/src/main/java/org/springframework/aop/target/PrototypeTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/PrototypeTargetSource.java index a404a932349..4dac18b73df 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/PrototypeTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/PrototypeTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,11 @@ package org.springframework.aop.target; import org.springframework.beans.BeansException; /** - * TargetSource that creates a new instance of the target bean for each - * request, destroying each instance on release (after each request). - * Obtains bean instances from its containing + * {@link org.springframework.aop.TargetSource} implementation that + * creates a new instance of the target bean for each request, + * destroying each instance on release (after each request). + * + *

Obtains bean instances from its containing * {@link org.springframework.beans.factory.BeanFactory}. * * @author Rod Johnson @@ -29,10 +31,9 @@ import org.springframework.beans.BeansException; * @see #setBeanFactory * @see #setTargetBeanName */ +@SuppressWarnings("serial") public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource { - private static final long serialVersionUID = 1L; - /** * Obtain a new prototype instance for every call. * @see #newPrototypeInstance() diff --git a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java index af22df411d0..eae3199356b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java +++ b/spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,10 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.core.NamedThreadLocal; /** - * Alternative to an object pool. This TargetSource uses a threading model in which - * every thread has its own copy of the target. There's no contention for targets. - * Target object creation is kept to a minimum on the running server. + * Alternative to an object pool. This {@link org.springframework.aop.TargetSource} + * uses a threading model in which every thread has its own copy of the target. + * There's no contention for targets. Target object creation is kept to a minimum + * on the running server. * *

Application code is written as to a normal pool; callers can't assume they * will be dealing with the same instance in invocations in different threads. @@ -47,11 +48,10 @@ import org.springframework.core.NamedThreadLocal; * @see ThreadLocalTargetSourceStats * @see org.springframework.beans.factory.DisposableBean#destroy() */ +@SuppressWarnings("serial") 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 @@ -81,10 +81,8 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource Object target = this.targetInThread.get(); if (target == null) { if (logger.isDebugEnabled()) { - logger.debug("No target for prototype '" + getTargetBeanName() + - "' bound to thread: " + - "creating one and binding it to thread '" + - Thread.currentThread().getName() + "'"); + logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " + + "creating one and binding it to thread '" + Thread.currentThread().getName() + "'"); } // Associate target with ThreadLocal. target = newPrototypeInstance(); diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java index 6e1758e30dd..f08be25ac70 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java @@ -83,11 +83,10 @@ import org.springframework.util.ClassUtils; * @see org.springframework.orm.jpa.support.SharedEntityManagerBean * @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory */ +@SuppressWarnings("serial") public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean implements ResourceLoaderAware, LoadTimeWeaverAware { - private static final long serialVersionUID = 1L; - private PersistenceUnitManager persistenceUnitManager; private final DefaultPersistenceUnitManager internalPersistenceUnitManager = diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBean.java index 19784eb9347..9df7e08ef97 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,10 +66,9 @@ import javax.persistence.spi.PersistenceProvider; * @see javax.persistence.Persistence#createEntityManagerFactory * @see javax.persistence.spi.PersistenceProvider#createEntityManagerFactory */ +@SuppressWarnings("serial") public class LocalEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean { - private static final long serialVersionUID = 1L; - /** * Initialize the EntityManagerFactory for the given configuration. * @throws javax.persistence.PersistenceException in case of JPA initialization errors diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java index 1e5d4ec88b1..f6287256877 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,13 +42,11 @@ import org.springframework.util.StringUtils; * * @author Rossen Stoyanchev * @since 3.1 - * * @see FlashMapManager */ +@SuppressWarnings("serial") public final class FlashMap extends HashMap implements Comparable { - private static final long serialVersionUID = 1L; - private String targetRequestPath; private final MultiValueMap targetRequestParams = new LinkedMultiValueMap();