[COLLECTIONS-502] remove generic parameters from static INSTANCE fields.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1543950 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ca8d6823b
commit
07d54f1676
|
@ -46,7 +46,7 @@ public class ComparableComparator<E extends Comparable<? super E>> implements Co
|
|||
|
||||
/** The singleton instance. */
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final ComparableComparator<?> INSTANCE = new ComparableComparator();
|
||||
public static final ComparableComparator INSTANCE = new ComparableComparator();
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,8 @@ public class CloneTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
private static final long serialVersionUID = -8188742709499652567L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Transformer<Object, Object> INSTANCE = new CloneTransformer<Object>();
|
||||
@SuppressWarnings("rawtypes") // the singleton instance works for all types
|
||||
public static final Transformer INSTANCE = new CloneTransformer<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -36,7 +36,8 @@ public class ConstantFactory<T> implements Factory<T>, Serializable {
|
|||
private static final long serialVersionUID = -3520677225766901240L;
|
||||
|
||||
/** Returns null each time */
|
||||
public static final Factory<Object> NULL_INSTANCE = new ConstantFactory<Object>(null);
|
||||
@SuppressWarnings("rawtypes") // The null factory works for all object types
|
||||
public static final Factory NULL_INSTANCE = new ConstantFactory<Object>(null);
|
||||
|
||||
/** The closures to call in turn */
|
||||
private final T iConstant;
|
||||
|
|
|
@ -36,7 +36,8 @@ public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializabl
|
|||
private static final long serialVersionUID = 6374440726369055124L;
|
||||
|
||||
/** Returns null each time */
|
||||
public static final Transformer<Object, Object> NULL_INSTANCE = new ConstantTransformer<Object, Object>(null);
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Transformer NULL_INSTANCE = new ConstantTransformer<Object, Object>(null);
|
||||
|
||||
/** The closures to call in turn */
|
||||
private final O iConstant;
|
||||
|
|
|
@ -33,7 +33,8 @@ public class DefaultEquator<T> implements Equator<T>, Serializable {
|
|||
private static final long serialVersionUID = 825802648423525485L;
|
||||
|
||||
/** Static instance */
|
||||
public static final DefaultEquator<Object> INSTANCE = new DefaultEquator<Object>();
|
||||
@SuppressWarnings("rawtypes") // the static instance works for all types
|
||||
public static final DefaultEquator INSTANCE = new DefaultEquator<Object>();
|
||||
|
||||
/**
|
||||
* Hashcode used for <code>null</code> objects.
|
||||
|
|
|
@ -33,7 +33,8 @@ public final class ExceptionClosure<E> implements Closure<E>, Serializable {
|
|||
private static final long serialVersionUID = 7179106032121985545L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Closure<Object> INSTANCE = new ExceptionClosure<Object>();
|
||||
@SuppressWarnings("rawtypes") // the static instance works for all types
|
||||
public static final Closure INSTANCE = new ExceptionClosure<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -33,7 +33,8 @@ public final class ExceptionFactory<T> implements Factory<T>, Serializable {
|
|||
private static final long serialVersionUID = 7179106032121985545L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Factory<Object> INSTANCE = new ExceptionFactory<Object>();
|
||||
@SuppressWarnings("rawtypes") // the static instance works for all types
|
||||
public static final Factory INSTANCE = new ExceptionFactory<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -33,7 +33,8 @@ public final class ExceptionPredicate<T> implements Predicate<T>, Serializable {
|
|||
private static final long serialVersionUID = 7179106032121985545L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Predicate<Object> INSTANCE = new ExceptionPredicate<Object>();
|
||||
@SuppressWarnings("rawtypes") // the static instance works for all types
|
||||
public static final Predicate INSTANCE = new ExceptionPredicate<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -33,7 +33,8 @@ public final class ExceptionTransformer<I, O> implements Transformer<I, O>, Seri
|
|||
private static final long serialVersionUID = 7179106032121985545L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Transformer<Object, Object> INSTANCE = new ExceptionTransformer<Object, Object>();
|
||||
@SuppressWarnings("rawtypes") // the static instance works for all types
|
||||
public static final Transformer INSTANCE = new ExceptionTransformer<Object, Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -32,7 +32,8 @@ public final class FalsePredicate<T> implements Predicate<T>, Serializable {
|
|||
private static final long serialVersionUID = 7533784454832764388L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Predicate<Object> INSTANCE = new FalsePredicate<Object>();
|
||||
@SuppressWarnings("rawtypes") // the static instance works for all types
|
||||
public static final Predicate INSTANCE = new FalsePredicate<Object>();
|
||||
|
||||
/**
|
||||
* Get a typed instance.
|
||||
|
|
|
@ -91,7 +91,7 @@ public class IfClosure<E> implements Closure<E>, Serializable {
|
|||
* @since 3.2
|
||||
*/
|
||||
public IfClosure(final Predicate<? super E> predicate, final Closure<? super E> trueClosure) {
|
||||
this(predicate, trueClosure, NOPClosure.INSTANCE);
|
||||
this(predicate, trueClosure, NOPClosure.nopClosure());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,8 @@ public class InstantiateTransformer<T> implements Transformer<Class<? extends T>
|
|||
private static final long serialVersionUID = 3786388740793356347L;
|
||||
|
||||
/** Singleton instance that uses the no arg constructor */
|
||||
public static final Transformer<Class<?>, ?> NO_ARG_INSTANCE = new InstantiateTransformer<Object>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Transformer NO_ARG_INSTANCE = new InstantiateTransformer<Object>();
|
||||
|
||||
/** The constructor parameter types */
|
||||
private final Class<?>[] iParamTypes;
|
||||
|
@ -48,8 +49,9 @@ public class InstantiateTransformer<T> implements Transformer<Class<? extends T>
|
|||
* @param <T> the type of the objects to be created
|
||||
* @return Transformer<Class<? extends T>, T>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Transformer<Class<? extends T>, T> instantiateTransformer() {
|
||||
return new InstantiateTransformer<T>();
|
||||
return (Transformer<Class<? extends T>, T>) NO_ARG_INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,8 @@ public final class NOPClosure<E> implements Closure<E>, Serializable {
|
|||
private static final long serialVersionUID = 3518477308466486130L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Closure<Object> INSTANCE = new NOPClosure<Object>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Closure INSTANCE = new NOPClosure<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -32,7 +32,8 @@ public class NOPTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
private static final long serialVersionUID = 2133891748318574490L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Transformer<Object, Object> INSTANCE = new NOPTransformer<Object>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Transformer INSTANCE = new NOPTransformer<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -32,7 +32,8 @@ public final class NotNullPredicate<T> implements Predicate<T>, Serializable {
|
|||
private static final long serialVersionUID = 7533784454832764388L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Predicate<Object> INSTANCE = new NotNullPredicate<Object>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Predicate INSTANCE = new NotNullPredicate<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -32,7 +32,8 @@ public final class NullPredicate<T> implements Predicate<T>, Serializable {
|
|||
private static final long serialVersionUID = 7533784454832764388L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Predicate<?> INSTANCE = new NullPredicate<Object>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Predicate INSTANCE = new NullPredicate<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
|
@ -32,7 +32,8 @@ public final class TruePredicate<T> implements Predicate<T>, Serializable {
|
|||
private static final long serialVersionUID = 3374767158756189740L;
|
||||
|
||||
/** Singleton predicate instance */
|
||||
public static final Predicate<?> INSTANCE = new TruePredicate<Object>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Predicate INSTANCE = new TruePredicate<Object>();
|
||||
|
||||
/**
|
||||
* Factory returning the singleton instance.
|
||||
|
|
Loading…
Reference in New Issue