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

@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public abstract class AttributeAccessorSupport implements AttributeAccessor, Serializable {
/** Map with String keys and Object values */

View File

@@ -334,6 +334,7 @@ public abstract class CollectionFactory {
* ConcurrentMap adapter for the JDK ConcurrentHashMap class.
*/
@Deprecated
@SuppressWarnings("serial")
private static class JdkConcurrentHashMap extends ConcurrentHashMap implements ConcurrentMap {
private JdkConcurrentHashMap(int initialCapacity) {

View File

@@ -24,6 +24,7 @@ package org.springframework.core;
* @since 28.04.2003
* @see org.springframework.core.Constants
*/
@SuppressWarnings("serial")
public class ConstantException extends IllegalArgumentException {
/**

View File

@@ -35,6 +35,7 @@ import java.io.IOException;
* @see org.springframework.core.NestedCheckedException
* @see org.springframework.core.NestedRuntimeException
*/
@SuppressWarnings("serial")
public class NestedIOException extends IOException {
static {

View File

@@ -99,6 +99,7 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR
/**
* Inner cache class that implements lazy building of LabeledEnum Maps.
*/
@SuppressWarnings("serial")
private class LabeledEnumCache extends CachingMapDecorator<Class, Map<Comparable, LabeledEnum>> {
public LabeledEnumCache() {

View File

@@ -23,6 +23,7 @@ package org.springframework.core.enums;
* @since 1.2.6
* @deprecated as of Spring 3.0, in favor of Java 5 enums.
*/
@SuppressWarnings("serial")
public abstract class AbstractGenericLabeledEnum extends AbstractLabeledEnum {
/**

View File

@@ -26,6 +26,7 @@ package org.springframework.core.enums;
* @deprecated as of Spring 3.0, in favor of Java 5 enums.
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class AbstractLabeledEnum implements LabeledEnum {
/**

View File

@@ -30,6 +30,7 @@ import org.springframework.util.Assert;
* @deprecated as of Spring 3.0, in favor of Java 5 enums.
*/
@Deprecated
@SuppressWarnings("serial")
public class LetterCodedLabeledEnum extends AbstractGenericLabeledEnum {
/**

View File

@@ -30,6 +30,8 @@ package org.springframework.core.enums;
@Deprecated
public class ShortCodedLabeledEnum extends AbstractGenericLabeledEnum {
private static final long serialVersionUID = 1L;
/**
* The unique code of this enum.
*/

View File

@@ -44,6 +44,7 @@ package org.springframework.core.enums;
* @deprecated as of Spring 3.0, in favor of Java 5 enums.
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class StaticLabeledEnum extends AbstractLabeledEnum {
/**

View File

@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
* @deprecated as of Spring 3.0, in favor of Java 5 enums.
*/
@Deprecated
@SuppressWarnings("serial")
public class StringCodedLabeledEnum extends AbstractGenericLabeledEnum {
/**

View File

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

View File

@@ -44,6 +44,7 @@ import org.springframework.util.CustomizableThreadCreator;
* @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
* @see org.springframework.scheduling.commonj.WorkManagerTaskExecutor
*/
@SuppressWarnings("serial")
public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implements AsyncTaskExecutor, Serializable {
/**

View File

@@ -36,6 +36,7 @@ import org.springframework.util.Assert;
* @since 2.0
* @see SimpleAsyncTaskExecutor
*/
@SuppressWarnings("serial")
public class SyncTaskExecutor implements TaskExecutor, Serializable {
/**

View File

@@ -27,6 +27,7 @@ import java.util.concurrent.RejectedExecutionException;
* @see TaskExecutor#execute(Runnable)
* @see TaskTimeoutException
*/
@SuppressWarnings("serial")
public class TaskRejectedException extends RejectedExecutionException {
/**

View File

@@ -25,6 +25,7 @@ package org.springframework.core.task;
* @see AsyncTaskExecutor#execute(Runnable, long)
* @see TaskRejectedException
*/
@SuppressWarnings("serial")
public class TaskTimeoutException extends TaskRejectedException {
/**

View File

@@ -40,6 +40,7 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory {
private volatile int cacheLimit = DEFAULT_CACHE_LIMIT;
@SuppressWarnings("serial")
private final Map<Resource, MetadataReader> metadataReaderCache =
new LinkedHashMap<Resource, MetadataReader>(DEFAULT_CACHE_LIMIT, 0.75f, true) {
@Override

View File

@@ -39,6 +39,7 @@ import java.util.ListIterator;
* @author Juergen Hoeller
* @since 2.0
*/
@SuppressWarnings("serial")
public class AutoPopulatingList<E> implements List<E>, Serializable {
/**

View File

@@ -44,6 +44,7 @@ import java.util.WeakHashMap;
* @deprecated as of Spring 3.2, to be removed along with LabeledEnum support
*/
@Deprecated
@SuppressWarnings("serial")
public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializable {
private static Object NULL_VALUE = new Object();

View File

@@ -386,6 +386,7 @@ public abstract class CollectionUtils {
/**
* Adapts a Map to the MultiValueMap contract.
*/
@SuppressWarnings("serial")
private static class MultiValueMapAdapter<K, V> implements MultiValueMap<K, V>, Serializable {
private final Map<K, List<V>> map;

View File

@@ -43,6 +43,7 @@ import org.apache.commons.logging.LogFactory;
* @see org.springframework.aop.interceptor.ConcurrencyThrottleInterceptor
* @see java.io.Serializable
*/
@SuppressWarnings("serial")
public abstract class ConcurrencyThrottleSupport implements Serializable {
/**

View File

@@ -29,6 +29,7 @@ import java.io.Serializable;
* @since 2.0.3
* @see org.springframework.scheduling.concurrent.CustomizableThreadFactory
*/
@SuppressWarnings("serial")
public class CustomizableThreadCreator implements Serializable {
private String threadNamePrefix;

View File

@@ -33,6 +33,7 @@ import java.util.Map;
* @author Juergen Hoeller
* @since 3.0
*/
@SuppressWarnings("serial")
public class LinkedCaseInsensitiveMap<V> extends LinkedHashMap<String, V> {
private final Map<String, String> caseInsensitiveKeys;

View File

@@ -25,6 +25,7 @@ import java.util.Comparator;
* @author Keith Donald
* @since 1.2.2
*/
@SuppressWarnings("serial")
public final class BooleanComparator implements Comparator<Boolean>, Serializable {
/**