diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionException.java b/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionException.java index 4ddf15d8390..a30bc9aa1bd 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionException.java @@ -24,6 +24,7 @@ import org.springframework.core.NestedRuntimeException; * @author Keith Donald * @since 3.0 */ +@SuppressWarnings("serial") public abstract class ConversionException extends NestedRuntimeException { /** diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java b/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java index a80957a7f0a..6c6c2e5264a 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/ConversionFailedException.java @@ -22,6 +22,7 @@ package org.springframework.core.convert; * @author Keith Donald * @since 3.0 */ +@SuppressWarnings("serial") public final class ConversionFailedException extends ConversionException { private final TypeDescriptor sourceType; diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java b/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java index 7f87789e4f7..3c166afccf8 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java @@ -22,6 +22,7 @@ package org.springframework.core.convert; * @author Keith Donald * @since 3.0 */ +@SuppressWarnings("serial") public final class ConverterNotFoundException extends ConversionException { private final TypeDescriptor sourceType; diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java index f1bc0121461..6a02f356729 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ArrayToCollectionConverter.java @@ -39,6 +39,7 @@ final class ArrayToCollectionConverter implements GenericConverter { this.conversionService = conversionService; } + @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java index 16a2888802c..639505afa16 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToArrayConverter.java @@ -44,7 +44,7 @@ final class CollectionToArrayConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Collection sourceCollection = (Collection) source; + Collection sourceCollection = (Collection) source; TypeDescriptor sourceElementType = sourceType.getElementTypeDescriptor(); if (sourceElementType == TypeDescriptor.NULL) { sourceElementType = getElementType(sourceCollection); @@ -53,7 +53,7 @@ final class CollectionToArrayConverter implements GenericConverter { Object array = Array.newInstance(targetElementType.getType(), sourceCollection.size()); int i = 0; if (sourceElementType == TypeDescriptor.NULL || sourceElementType.isAssignableTo(targetElementType)) { - for (Iterator it = sourceCollection.iterator(); it.hasNext(); i++) { + for (Iterator it = sourceCollection.iterator(); it.hasNext(); i++) { Array.set(array, i, it.next()); } } @@ -62,7 +62,7 @@ final class CollectionToArrayConverter implements GenericConverter { if (converter == null) { throw new ConverterNotFoundException(sourceElementType, targetElementType); } - for (Iterator it = sourceCollection.iterator(); it.hasNext(); i++) { + for (Iterator it = sourceCollection.iterator(); it.hasNext(); i++) { Object sourceElement = it.next(); Object targetElement = invokeConverter(converter, sourceElement, sourceElementType, targetElementType); Array.set(array, i, targetElement); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java index f093ccb514d..57363b42fe3 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToCollectionConverter.java @@ -44,7 +44,7 @@ final class CollectionToCollectionConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Collection sourceCollection = (Collection) source; + Collection sourceCollection = (Collection) source; TypeDescriptor sourceElementType = sourceType.getElementTypeDescriptor(); if (sourceElementType == TypeDescriptor.NULL) { sourceElementType = getElementType(sourceCollection); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java index bf95fbb90cf..c8b9d9853f7 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToMapConverter.java @@ -42,7 +42,7 @@ final class CollectionToMapConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Collection sourceCollection = (Collection) source; + Collection sourceCollection = (Collection) source; TypeDescriptor sourceElementType = sourceType.getElementTypeDescriptor(); if (sourceElementType == TypeDescriptor.NULL) { sourceElementType = getElementType(sourceCollection); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java index f19aa9f9185..5d0a98ddd88 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/CollectionToObjectConverter.java @@ -44,7 +44,7 @@ final class CollectionToObjectConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Collection sourceCollection = (Collection) source; + Collection sourceCollection = (Collection) source; if (sourceCollection.size() == 0) { if (targetType.typeEquals(String.class)) { return ""; diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ConversionUtils.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ConversionUtils.java index 7494c32c858..ffeb9d47de1 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ConversionUtils.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ConversionUtils.java @@ -35,7 +35,7 @@ final class ConversionUtils { } } - public static TypeDescriptor getElementType(Collection collection) { + public static TypeDescriptor getElementType(Collection collection) { for (Object element : collection) { if (element != null) { return TypeDescriptor.valueOf(element.getClass()); @@ -45,11 +45,12 @@ final class ConversionUtils { } - public static List asList(Object array) { + public static List asList(Object array) { return array != null ? new ArrayList(array) : null; } - private static class ArrayList extends AbstractList implements RandomAccess, java.io.Serializable { + @SuppressWarnings("serial") + private static class ArrayList extends AbstractList implements RandomAccess, java.io.Serializable { private Object array; diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToCollectionConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToCollectionConverter.java index 44b15343a9c..cb4363ae847 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToCollectionConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToCollectionConverter.java @@ -41,7 +41,7 @@ final class MapToCollectionConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Map sourceMap = (Map) source; + Map sourceMap = (Map) source; TypeDescriptor sourceKeyType = sourceType.getMapKeyTypeDescriptor(); TypeDescriptor sourceValueType = sourceType.getMapValueTypeDescriptor(); TypeDescriptor targetElementType = targetType.getElementTypeDescriptor(); @@ -58,7 +58,7 @@ final class MapToCollectionConverter implements GenericConverter { targetElementType, keysCompatible, valuesCompatible, this.conversionService); if (targetElementType.getType().equals(String.class)) { for (Object entry : sourceMap.entrySet()) { - Map.Entry mapEntry = (Map.Entry) entry; + Map.Entry mapEntry = (Map.Entry) entry; String property = converter.convertKey(mapEntry.getKey()) + "=" + converter.convertValue(mapEntry.getValue()); target.add(property); diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java index f963cf87531..27510c1fc91 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToMapConverter.java @@ -40,7 +40,7 @@ final class MapToMapConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Map sourceMap = (Map) source; + Map sourceMap = (Map) source; TypeDescriptor targetKeyType = targetType.getMapKeyTypeDescriptor(); TypeDescriptor targetValueType = targetType.getMapValueTypeDescriptor(); if (targetKeyType == TypeDescriptor.NULL && targetValueType == TypeDescriptor.NULL) { @@ -77,11 +77,11 @@ final class MapToMapConverter implements GenericConverter { return targetMap; } - private TypeDescriptor[] getMapEntryTypes(Map sourceMap) { - Class keyType = null; - Class valueType = null; + private TypeDescriptor[] getMapEntryTypes(Map sourceMap) { + Class keyType = null; + Class valueType = null; for (Object entry : sourceMap.entrySet()) { - Map.Entry mapEntry = (Map.Entry) entry; + Map.Entry mapEntry = (Map.Entry) entry; Object key = mapEntry.getKey(); if (keyType == null && key != null) { keyType = key.getClass(); @@ -98,7 +98,7 @@ final class MapToMapConverter implements GenericConverter { } @SuppressWarnings("unchecked") - private Map compatibleMapWithoutEntryConversion(Map source, TypeDescriptor targetType) { + private Map compatibleMapWithoutEntryConversion(Map source, TypeDescriptor targetType) { if (targetType.getType().isAssignableFrom(source.getClass())) { return source; } else { diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToObjectConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToObjectConverter.java index 55d46e9c180..15cad8bca75 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToObjectConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/MapToObjectConverter.java @@ -40,7 +40,7 @@ final class MapToObjectConverter implements GenericConverter { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType); } - Map sourceMap = (Map) source; + Map sourceMap = (Map) source; if (sourceMap.size() == 0) { if (targetType.typeEquals(String.class)) { return ""; @@ -63,7 +63,7 @@ final class MapToObjectConverter implements GenericConverter { StringBuilder string = new StringBuilder(); int i = 0; for (Object entry : sourceMap.entrySet()) { - Map.Entry mapEntry = (Map.Entry) entry; + Map.Entry mapEntry = (Map.Entry) entry; if (i > 0) { string.append(DELIMITER); } @@ -78,7 +78,7 @@ final class MapToObjectConverter implements GenericConverter { StringBuilder string = new StringBuilder(); int i = 0; for (Object entry : sourceMap.entrySet()) { - Map.Entry mapEntry = (Map.Entry) entry; + Map.Entry mapEntry = (Map.Entry) entry; if (i > 0) { string.append(DELIMITER); } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java index ae719b56195..17ab69e8270 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/ObjectToCollectionConverter.java @@ -39,6 +39,7 @@ final class ObjectToCollectionConverter implements GenericConverter { this.conversionService = conversionService; } + @SuppressWarnings("unchecked") public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return this.conversionService.convertNullSource(sourceType, targetType);