Skip to content

Commit 2ef39a5

Browse files
committed
Consistently declare @SuppressWarnings("serial") instead of dummy serialVersionUID
(cherry picked from commit 56b7d7a)
1 parent 1a2033e commit 2ef39a5

File tree

8 files changed

+44
-44
lines changed

8 files changed

+44
-44
lines changed

spring-aop/src/main/java/org/springframework/aop/target/AbstractPoolingTargetSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@
5050
* @see #releaseTarget
5151
* @see #destroy
5252
*/
53+
@SuppressWarnings("serial")
5354
public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBasedTargetSource
5455
implements PoolingConfig, DisposableBean {
5556

spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@
4343
* @see ThreadLocalTargetSource
4444
* @see CommonsPoolTargetSource
4545
*/
46+
@SuppressWarnings("serial")
4647
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource {
4748

4849
@Override

spring-aop/src/main/java/org/springframework/aop/target/CommonsPoolTargetSource.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,8 +24,8 @@
2424
import org.springframework.core.Constants;
2525

2626
/**
27-
* TargetSource implementation that holds objects in a configurable
28-
* Jakarta Commons Pool.
27+
* {@link org.springframework.aop.TargetSource} implementation that holds
28+
* objects in a configurable Apache Commons Pool.
2929
*
3030
* <p>By default, an instance of {@code GenericObjectPool} is created.
3131
* Subclasses may change the type of {@code ObjectPool} used by
@@ -38,10 +38,12 @@
3838
* of configuration properties that are relevant to your chosen implementation.
3939
*
4040
* <p>The {@code testOnBorrow}, {@code testOnReturn} and {@code testWhileIdle}
41-
* properties are explictly not mirrored because the implementation of
41+
* properties are explicitly not mirrored because the implementation of
4242
* {@code PoolableObjectFactory} used by this class does not implement
43-
* meaningful validation. All exposed Commons Pool properties use the corresponding
44-
* Commons Pool defaults: for example,
43+
* meaningful validation. All exposed Commons Pool properties use the
44+
* corresponding Commons Pool defaults.
45+
*
46+
* <p>Compatible with Apache Commons Pool 1.5.x and 1.6.
4547
*
4648
* @author Rod Johnson
4749
* @author Rob Harrop
@@ -55,10 +57,8 @@
5557
* @see #setTimeBetweenEvictionRunsMillis
5658
* @see #setMinEvictableIdleTimeMillis
5759
*/
58-
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
59-
implements PoolableObjectFactory {
60-
61-
private static final long serialVersionUID = 1L;
60+
@SuppressWarnings("serial")
61+
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource implements PoolableObjectFactory {
6262

6363
private static final Constants constants = new Constants(GenericObjectPool.class);
6464

spring-aop/src/main/java/org/springframework/aop/target/PrototypeTargetSource.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,20 +19,21 @@
1919
import org.springframework.beans.BeansException;
2020

2121
/**
22-
* TargetSource that creates a new instance of the target bean for each
23-
* request, destroying each instance on release (after each request).
24-
* Obtains bean instances from its containing
22+
* {@link org.springframework.aop.TargetSource} implementation that
23+
* creates a new instance of the target bean for each request,
24+
* destroying each instance on release (after each request).
25+
*
26+
* <p>Obtains bean instances from its containing
2527
* {@link org.springframework.beans.factory.BeanFactory}.
2628
*
2729
* @author Rod Johnson
2830
* @author Juergen Hoeller
2931
* @see #setBeanFactory
3032
* @see #setTargetBeanName
3133
*/
34+
@SuppressWarnings("serial")
3235
public class PrototypeTargetSource extends AbstractPrototypeBasedTargetSource {
3336

34-
private static final long serialVersionUID = 1L;
35-
3637
/**
3738
* Obtain a new prototype instance for every call.
3839
* @see #newPrototypeInstance()

spring-aop/src/main/java/org/springframework/aop/target/ThreadLocalTargetSource.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,9 +27,10 @@
2727
import org.springframework.core.NamedThreadLocal;
2828

2929
/**
30-
* Alternative to an object pool. This TargetSource uses a threading model in which
31-
* every thread has its own copy of the target. There's no contention for targets.
32-
* Target object creation is kept to a minimum on the running server.
30+
* Alternative to an object pool. This {@link org.springframework.aop.TargetSource}
31+
* uses a threading model in which every thread has its own copy of the target.
32+
* There's no contention for targets. Target object creation is kept to a minimum
33+
* on the running server.
3334
*
3435
* <p>Application code is written as to a normal pool; callers can't assume they
3536
* will be dealing with the same instance in invocations in different threads.
@@ -47,11 +48,10 @@
4748
* @see ThreadLocalTargetSourceStats
4849
* @see org.springframework.beans.factory.DisposableBean#destroy()
4950
*/
51+
@SuppressWarnings("serial")
5052
public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
5153
implements ThreadLocalTargetSourceStats, DisposableBean {
5254

53-
private static final long serialVersionUID = 1L;
54-
5555
/**
5656
* ThreadLocal holding the target associated with the current
5757
* thread. Unlike most ThreadLocals, which are static, this variable
@@ -80,10 +80,8 @@ public Object getTarget() throws BeansException {
8080
Object target = this.targetInThread.get();
8181
if (target == null) {
8282
if (logger.isDebugEnabled()) {
83-
logger.debug("No target for prototype '" + getTargetBeanName() +
84-
"' bound to thread: " +
85-
"creating one and binding it to thread '" +
86-
Thread.currentThread().getName() + "'");
83+
logger.debug("No target for prototype '" + getTargetBeanName() + "' bound to thread: " +
84+
"creating one and binding it to thread '" + Thread.currentThread().getName() + "'");
8785
}
8886
// Associate target with ThreadLocal.
8987
target = newPrototypeInstance();

spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -78,11 +78,10 @@
7878
* @see org.springframework.orm.jpa.support.SharedEntityManagerBean
7979
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory
8080
*/
81+
@SuppressWarnings("serial")
8182
public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean
8283
implements ResourceLoaderAware, LoadTimeWeaverAware {
8384

84-
private static final long serialVersionUID = 1L;
85-
8685
private PersistenceUnitManager persistenceUnitManager;
8786

8887
private final DefaultPersistenceUnitManager internalPersistenceUnitManager =
@@ -129,6 +128,7 @@ public void setPersistenceXmlLocation(String persistenceXmlLocation) {
129128
* Uses the specified persistence unit name as the name of the default
130129
* persistence unit, if applicable.
131130
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
131+
* @see DefaultPersistenceUnitManager#setDefaultPersistenceUnitName
132132
*/
133133
@Override
134134
public void setPersistenceUnitName(String persistenceUnitName) {
@@ -148,6 +148,7 @@ public void setPersistenceUnitName(String persistenceUnitName) {
148148
* @param packagesToScan one or more base packages to search, analogous to
149149
* Spring's component-scan configuration for regular Spring components
150150
* @see #setPersistenceUnitManager
151+
* @see DefaultPersistenceUnitManager#setPackagesToScan
151152
*/
152153
public void setPackagesToScan(String... packagesToScan) {
153154
this.internalPersistenceUnitManager.setPackagesToScan(packagesToScan);
@@ -163,6 +164,7 @@ public void setPackagesToScan(String... packagesToScan) {
163164
* so that they can be loaded through {@code ClassLoader.getResource}.
164165
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
165166
* @see #setPersistenceUnitManager
167+
* @see DefaultPersistenceUnitManager#setMappingResources
166168
*/
167169
public void setMappingResources(String... mappingResources) {
168170
this.internalPersistenceUnitManager.setMappingResources(mappingResources);

spring-orm/src/main/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBean.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,18 +57,16 @@
5757
* @since 2.0
5858
* @see #setJpaProperties
5959
* @see #setJpaVendorAdapter
60-
* @see JpaTemplate#setEntityManagerFactory
6160
* @see JpaTransactionManager#setEntityManagerFactory
6261
* @see LocalContainerEntityManagerFactoryBean
6362
* @see org.springframework.jndi.JndiObjectFactoryBean
6463
* @see org.springframework.orm.jpa.support.SharedEntityManagerBean
6564
* @see javax.persistence.Persistence#createEntityManagerFactory
6665
* @see javax.persistence.spi.PersistenceProvider#createEntityManagerFactory
6766
*/
67+
@SuppressWarnings("serial")
6868
public class LocalEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean {
6969

70-
private static final long serialVersionUID = 1L;
71-
7270
/**
7371
* Initialize the EntityManagerFactory for the given configuration.
7472
* @throws javax.persistence.PersistenceException in case of JPA initialization errors

spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,13 +42,11 @@
4242
*
4343
* @author Rossen Stoyanchev
4444
* @since 3.1
45-
*
4645
* @see FlashMapManager
4746
*/
47+
@SuppressWarnings("serial")
4848
public final class FlashMap extends HashMap<String, Object> implements Comparable<FlashMap> {
4949

50-
private static final long serialVersionUID = 1L;
51-
5250
private String targetRequestPath;
5351

5452
private final MultiValueMap<String, String> targetRequestParams = new LinkedMultiValueMap<String, String>();
@@ -57,6 +55,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
5755

5856
private int timeToLive;
5957

58+
6059
/**
6160
* Provide a URL path to help identify the target request for this FlashMap.
6261
* The path may be absolute (e.g. /application/resource) or relative to the
@@ -71,7 +70,7 @@ public void setTargetRequestPath(String path) {
7170
* Return the target URL path or {@code null}.
7271
*/
7372
public String getTargetRequestPath() {
74-
return targetRequestPath;
73+
return this.targetRequestPath;
7574
}
7675

7776
/**
@@ -123,7 +122,7 @@ public void startExpirationPeriod(int timeToLive) {
123122
*/
124123
public boolean isExpired() {
125124
if (this.expirationStartTime != 0) {
126-
return (System.currentTimeMillis() - this.expirationStartTime) > this.timeToLive * 1000;
125+
return (System.currentTimeMillis() - this.expirationStartTime > this.timeToLive * 1000);
127126
}
128127
else {
129128
return false;
@@ -136,8 +135,8 @@ public boolean isExpired() {
136135
* instances ensure that they match a given request.
137136
*/
138137
public int compareTo(FlashMap other) {
139-
int thisUrlPath = (this.targetRequestPath != null) ? 1 : 0;
140-
int otherUrlPath = (other.targetRequestPath != null) ? 1 : 0;
138+
int thisUrlPath = (this.targetRequestPath != null ? 1 : 0);
139+
int otherUrlPath = (other.targetRequestPath != null ? 1 : 0);
141140
if (thisUrlPath != otherUrlPath) {
142141
return otherUrlPath - thisUrlPath;
143142
}
@@ -149,7 +148,7 @@ public int compareTo(FlashMap other) {
149148
@Override
150149
public String toString() {
151150
StringBuilder sb = new StringBuilder();
152-
sb.append("[Attributes=").append(super.toString());
151+
sb.append("FlashMap [attributes=").append(super.toString());
153152
sb.append(", targetRequestPath=").append(this.targetRequestPath);
154153
sb.append(", targetRequestParams=").append(this.targetRequestParams).append("]");
155154
return sb.toString();

0 commit comments

Comments
 (0)