From d8ef666764def12db6c14a8f5d1f777f3438ecce Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 9 Dec 2014 21:29:05 +0100 Subject: [PATCH] Suppress "rawtypes" warnings in CollectionFactory This commit also adds links to the newly created Eclipse bug that was raised for this issue. --- .../java/org/springframework/core/CollectionFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java index f9cd5082d3..368a2e9dd3 100644 --- a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java @@ -105,7 +105,7 @@ public abstract class CollectionFactory { * @see java.util.ArrayList * @see java.util.LinkedList */ - @SuppressWarnings({ "unchecked", "cast" }) + @SuppressWarnings({ "unchecked", "cast", "rawtypes" }) public static Collection createApproximateCollection(Object collection, int capacity) { if (collection instanceof LinkedList) { return new LinkedList(); @@ -115,6 +115,7 @@ public abstract class CollectionFactory { } else if (collection instanceof EnumSet) { // superfluous cast necessary for bug in Eclipse 4.4.1. + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=454644 return (Collection) EnumSet.copyOf((EnumSet) collection); } else if (collection instanceof SortedSet) { @@ -150,7 +151,7 @@ public abstract class CollectionFactory { * @see java.util.EnumSet * @see java.util.ArrayList */ - @SuppressWarnings({ "unchecked", "cast" }) + @SuppressWarnings({ "unchecked", "cast", "rawtypes" }) public static Collection createCollection(Class collectionClass, Class elementType, int capacity) { if (collectionClass.isInterface()) { if (Set.class.equals(collectionClass) || Collection.class.equals(collectionClass)) { @@ -169,6 +170,7 @@ public abstract class CollectionFactory { else if (EnumSet.class.equals(collectionClass)) { Assert.notNull(elementType, "Cannot create EnumSet for unknown element type"); // superfluous cast necessary for bug in Eclipse 4.4.1. + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=454644 return (Collection) EnumSet.noneOf((Class) elementType); } else {