Consistently declare @SuppressWarnings("serial") instead of dummy serialVersionUID

(cherry picked from commit 56b7d7a)
This commit is contained in:
Juergen Hoeller
2014-01-26 00:11:11 +01:00
parent 1a2033eb41
commit 2ef39a5666
8 changed files with 44 additions and 44 deletions

View File

@@ -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,6 +50,7 @@ import org.springframework.beans.factory.DisposableBean;
* @see #releaseTarget
* @see #destroy
*/
@SuppressWarnings("serial")
public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBasedTargetSource
implements PoolingConfig, DisposableBean {

View File

@@ -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,6 +43,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
* @see ThreadLocalTargetSource
* @see CommonsPoolTargetSource
*/
@SuppressWarnings("serial")
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource {
@Override

View File

@@ -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.
@@ -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.
*
* <p>By default, an instance of {@code GenericObjectPool} is created.
* Subclasses may change the type of {@code ObjectPool} used by
@@ -38,10 +38,12 @@ import org.springframework.core.Constants;
* of configuration properties that are relevant to your chosen implementation.
*
* <p>The {@code testOnBorrow}, {@code testOnReturn} and {@code testWhileIdle}
* properties are explictly not mirrored because the implementation of
* 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.
*
* <p>Compatible with Apache Commons Pool 1.5.x and 1.6.
*
* @author Rod Johnson
* @author Rob Harrop
@@ -55,10 +57,8 @@ import org.springframework.core.Constants;
* @see #setTimeBetweenEvictionRunsMillis
* @see #setMinEvictableIdleTimeMillis
*/
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
implements PoolableObjectFactory {
private static final long serialVersionUID = 1L;
@SuppressWarnings("serial")
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource implements PoolableObjectFactory {
private static final Constants constants = new Constants(GenericObjectPool.class);

View File

@@ -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).
*
* <p>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()

View File

@@ -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.
*
* <p>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
@@ -80,10 +80,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();

View File

@@ -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.
@@ -78,11 +78,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 =
@@ -129,6 +128,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
* Uses the specified persistence unit name as the name of the default
* persistence unit, if applicable.
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
* @see DefaultPersistenceUnitManager#setDefaultPersistenceUnitName
*/
@Override
public void setPersistenceUnitName(String persistenceUnitName) {
@@ -148,6 +148,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
* @param packagesToScan one or more base packages to search, analogous to
* Spring's component-scan configuration for regular Spring components
* @see #setPersistenceUnitManager
* @see DefaultPersistenceUnitManager#setPackagesToScan
*/
public void setPackagesToScan(String... packagesToScan) {
this.internalPersistenceUnitManager.setPackagesToScan(packagesToScan);
@@ -163,6 +164,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
* so that they can be loaded through {@code ClassLoader.getResource}.
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
* @see #setPersistenceUnitManager
* @see DefaultPersistenceUnitManager#setMappingResources
*/
public void setMappingResources(String... mappingResources) {
this.internalPersistenceUnitManager.setMappingResources(mappingResources);

View File

@@ -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.
@@ -57,7 +57,6 @@ import javax.persistence.spi.PersistenceProvider;
* @since 2.0
* @see #setJpaProperties
* @see #setJpaVendorAdapter
* @see JpaTemplate#setEntityManagerFactory
* @see JpaTransactionManager#setEntityManagerFactory
* @see LocalContainerEntityManagerFactoryBean
* @see org.springframework.jndi.JndiObjectFactoryBean
@@ -65,10 +64,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

View File

@@ -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<String, Object> implements Comparable<FlashMap> {
private static final long serialVersionUID = 1L;
private String targetRequestPath;
private final MultiValueMap<String, String> targetRequestParams = new LinkedMultiValueMap<String, String>();
@@ -57,6 +55,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
private int timeToLive;
/**
* Provide a URL path to help identify the target request for this FlashMap.
* The path may be absolute (e.g. /application/resource) or relative to the
@@ -71,7 +70,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
* Return the target URL path or {@code null}.
*/
public String getTargetRequestPath() {
return targetRequestPath;
return this.targetRequestPath;
}
/**
@@ -123,7 +122,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
*/
public boolean isExpired() {
if (this.expirationStartTime != 0) {
return (System.currentTimeMillis() - this.expirationStartTime) > this.timeToLive * 1000;
return (System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000);
}
else {
return false;
@@ -136,8 +135,8 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
* instances ensure that they match a given request.
*/
public int compareTo(FlashMap other) {
int thisUrlPath = (this.targetRequestPath != null) ? 1 : 0;
int otherUrlPath = (other.targetRequestPath != null) ? 1 : 0;
int thisUrlPath = (this.targetRequestPath != null ? 1 : 0);
int otherUrlPath = (other.targetRequestPath != null ? 1 : 0);
if (thisUrlPath != otherUrlPath) {
return otherUrlPath - thisUrlPath;
}
@@ -149,7 +148,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[Attributes=").append(super.toString());
sb.append("FlashMap [attributes=").append(super.toString());
sb.append(", targetRequestPath=").append(this.targetRequestPath);
sb.append(", targetRequestParams=").append(this.targetRequestParams).append("]");
return sb.toString();