diff --git a/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java b/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java index 1d82514d8..9a2715ba5 100644 --- a/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java +++ b/src/main/java/org/apache/commons/collections4/comparators/ComparableComparator.java @@ -46,7 +46,7 @@ public class ComparableComparator> implements Co /** The singleton instance. */ @SuppressWarnings("rawtypes") - public static final ComparableComparator INSTANCE = new ComparableComparator(); + public static final ComparableComparator INSTANCE = new ComparableComparator(); //----------------------------------------------------------------------- /** diff --git a/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java b/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java index cfc7514fd..d99d492ba 100644 --- a/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/CloneTransformer.java @@ -34,7 +34,8 @@ public class CloneTransformer implements Transformer, Serializable { private static final long serialVersionUID = -8188742709499652567L; /** Singleton predicate instance */ - public static final Transformer INSTANCE = new CloneTransformer(); + @SuppressWarnings("rawtypes") // the singleton instance works for all types + public static final Transformer INSTANCE = new CloneTransformer(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java b/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java index 0b05586a3..76a45796d 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/ConstantFactory.java @@ -36,7 +36,8 @@ public class ConstantFactory implements Factory, Serializable { private static final long serialVersionUID = -3520677225766901240L; /** Returns null each time */ - public static final Factory NULL_INSTANCE = new ConstantFactory(null); + @SuppressWarnings("rawtypes") // The null factory works for all object types + public static final Factory NULL_INSTANCE = new ConstantFactory(null); /** The closures to call in turn */ private final T iConstant; diff --git a/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java index d1ffdadeb..bc3c4d9ca 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ConstantTransformer.java @@ -36,7 +36,8 @@ public class ConstantTransformer implements Transformer, Serializabl private static final long serialVersionUID = 6374440726369055124L; /** Returns null each time */ - public static final Transformer NULL_INSTANCE = new ConstantTransformer(null); + @SuppressWarnings("rawtypes") + public static final Transformer NULL_INSTANCE = new ConstantTransformer(null); /** The closures to call in turn */ private final O iConstant; diff --git a/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java b/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java index d6acdde4a..1111e2ee1 100644 --- a/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java +++ b/src/main/java/org/apache/commons/collections4/functors/DefaultEquator.java @@ -33,7 +33,8 @@ public class DefaultEquator implements Equator, Serializable { private static final long serialVersionUID = 825802648423525485L; /** Static instance */ - public static final DefaultEquator INSTANCE = new DefaultEquator(); + @SuppressWarnings("rawtypes") // the static instance works for all types + public static final DefaultEquator INSTANCE = new DefaultEquator(); /** * Hashcode used for null objects. diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java index 9f131740e..87bfbde3d 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionClosure.java @@ -33,7 +33,8 @@ public final class ExceptionClosure implements Closure, Serializable { private static final long serialVersionUID = 7179106032121985545L; /** Singleton predicate instance */ - public static final Closure INSTANCE = new ExceptionClosure(); + @SuppressWarnings("rawtypes") // the static instance works for all types + public static final Closure INSTANCE = new ExceptionClosure(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java index 4512eb773..7889f92ce 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionFactory.java @@ -33,7 +33,8 @@ public final class ExceptionFactory implements Factory, Serializable { private static final long serialVersionUID = 7179106032121985545L; /** Singleton predicate instance */ - public static final Factory INSTANCE = new ExceptionFactory(); + @SuppressWarnings("rawtypes") // the static instance works for all types + public static final Factory INSTANCE = new ExceptionFactory(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java index c661b3407..d899c4ad3 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionPredicate.java @@ -33,7 +33,8 @@ public final class ExceptionPredicate implements Predicate, Serializable { private static final long serialVersionUID = 7179106032121985545L; /** Singleton predicate instance */ - public static final Predicate INSTANCE = new ExceptionPredicate(); + @SuppressWarnings("rawtypes") // the static instance works for all types + public static final Predicate INSTANCE = new ExceptionPredicate(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java b/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java index 2c4ad591b..e7658a1e5 100644 --- a/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/ExceptionTransformer.java @@ -33,7 +33,8 @@ public final class ExceptionTransformer implements Transformer, Seri private static final long serialVersionUID = 7179106032121985545L; /** Singleton predicate instance */ - public static final Transformer INSTANCE = new ExceptionTransformer(); + @SuppressWarnings("rawtypes") // the static instance works for all types + public static final Transformer INSTANCE = new ExceptionTransformer(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java b/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java index 1061b9a60..005379309 100644 --- a/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/FalsePredicate.java @@ -32,7 +32,8 @@ public final class FalsePredicate implements Predicate, Serializable { private static final long serialVersionUID = 7533784454832764388L; /** Singleton predicate instance */ - public static final Predicate INSTANCE = new FalsePredicate(); + @SuppressWarnings("rawtypes") // the static instance works for all types + public static final Predicate INSTANCE = new FalsePredicate(); /** * Get a typed instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/IfClosure.java b/src/main/java/org/apache/commons/collections4/functors/IfClosure.java index 4d9aafee4..4b39c9457 100644 --- a/src/main/java/org/apache/commons/collections4/functors/IfClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/IfClosure.java @@ -91,7 +91,7 @@ public class IfClosure implements Closure, Serializable { * @since 3.2 */ public IfClosure(final Predicate predicate, final Closure trueClosure) { - this(predicate, trueClosure, NOPClosure.INSTANCE); + this(predicate, trueClosure, NOPClosure.nopClosure()); } /** diff --git a/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java b/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java index 4961f3234..8d947e3bb 100644 --- a/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java @@ -35,7 +35,8 @@ public class InstantiateTransformer implements Transformer private static final long serialVersionUID = 3786388740793356347L; /** Singleton instance that uses the no arg constructor */ - public static final Transformer, ?> NO_ARG_INSTANCE = new InstantiateTransformer(); + @SuppressWarnings("rawtypes") + private static final Transformer NO_ARG_INSTANCE = new InstantiateTransformer(); /** The constructor parameter types */ private final Class[] iParamTypes; @@ -48,8 +49,9 @@ public class InstantiateTransformer implements Transformer * @param the type of the objects to be created * @return Transformer, T> */ + @SuppressWarnings("unchecked") public static Transformer, T> instantiateTransformer() { - return new InstantiateTransformer(); + return (Transformer, T>) NO_ARG_INSTANCE; } /** diff --git a/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java b/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java index 5026088f5..de9447a7a 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java +++ b/src/main/java/org/apache/commons/collections4/functors/NOPClosure.java @@ -32,7 +32,8 @@ public final class NOPClosure implements Closure, Serializable { private static final long serialVersionUID = 3518477308466486130L; /** Singleton predicate instance */ - public static final Closure INSTANCE = new NOPClosure(); + @SuppressWarnings("rawtypes") + public static final Closure INSTANCE = new NOPClosure(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java b/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java index f530c3f5b..3d831eb29 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/NOPTransformer.java @@ -32,7 +32,8 @@ public class NOPTransformer implements Transformer, Serializable { private static final long serialVersionUID = 2133891748318574490L; /** Singleton predicate instance */ - public static final Transformer INSTANCE = new NOPTransformer(); + @SuppressWarnings("rawtypes") + public static final Transformer INSTANCE = new NOPTransformer(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java index f7a1d5214..5697cfbf4 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NotNullPredicate.java @@ -32,7 +32,8 @@ public final class NotNullPredicate implements Predicate, Serializable { private static final long serialVersionUID = 7533784454832764388L; /** Singleton predicate instance */ - public static final Predicate INSTANCE = new NotNullPredicate(); + @SuppressWarnings("rawtypes") + public static final Predicate INSTANCE = new NotNullPredicate(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java b/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java index 3609a0faf..097b4312a 100644 --- a/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/NullPredicate.java @@ -32,7 +32,8 @@ public final class NullPredicate implements Predicate, Serializable { private static final long serialVersionUID = 7533784454832764388L; /** Singleton predicate instance */ - public static final Predicate INSTANCE = new NullPredicate(); + @SuppressWarnings("rawtypes") + public static final Predicate INSTANCE = new NullPredicate(); /** * Factory returning the singleton instance. diff --git a/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java b/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java index 466dcd03b..61b6563da 100644 --- a/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java +++ b/src/main/java/org/apache/commons/collections4/functors/TruePredicate.java @@ -32,7 +32,8 @@ public final class TruePredicate implements Predicate, Serializable { private static final long serialVersionUID = 3374767158756189740L; /** Singleton predicate instance */ - public static final Predicate INSTANCE = new TruePredicate(); + @SuppressWarnings("rawtypes") + public static final Predicate INSTANCE = new TruePredicate(); /** * Factory returning the singleton instance.