diff --git a/src/main/java/org/apache/commons/collections/BagUtils.java b/src/main/java/org/apache/commons/collections/BagUtils.java index 3299f704d..3c4f3c54d 100644 --- a/src/main/java/org/apache/commons/collections/BagUtils.java +++ b/src/main/java/org/apache/commons/collections/BagUtils.java @@ -47,11 +47,9 @@ public class BagUtils { UnmodifiableSortedBag.unmodifiableSortedBag(new TreeBag()); /** - * Instantiation of BagUtils is not intended or required. However, some - * tools require an instance to operate. + * Instantiation of BagUtils is not intended or required. */ - public BagUtils() { - } + private BagUtils() {} //----------------------------------------------------------------------- /** diff --git a/src/main/java/org/apache/commons/collections/ClosureUtils.java b/src/main/java/org/apache/commons/collections/ClosureUtils.java index b0006bd03..b7ca4e8a4 100644 --- a/src/main/java/org/apache/commons/collections/ClosureUtils.java +++ b/src/main/java/org/apache/commons/collections/ClosureUtils.java @@ -55,9 +55,7 @@ public class ClosureUtils { /** * This class is not normally instantiated. */ - public ClosureUtils() { - super(); - } + private ClosureUtils() {} /** * Gets a Closure that always throws an exception. diff --git a/src/main/java/org/apache/commons/collections/CollectionUtils.java b/src/main/java/org/apache/commons/collections/CollectionUtils.java index 0e68ca013..db94a3714 100644 --- a/src/main/java/org/apache/commons/collections/CollectionUtils.java +++ b/src/main/java/org/apache/commons/collections/CollectionUtils.java @@ -195,8 +195,7 @@ public class CollectionUtils { /** * CollectionUtils should not normally be instantiated. */ - public CollectionUtils() { - } + private CollectionUtils() {} /** * Returns the immutable EMPTY_COLLECTION with generic type safety. diff --git a/src/main/java/org/apache/commons/collections/ComparatorUtils.java b/src/main/java/org/apache/commons/collections/ComparatorUtils.java index 9ecb8d9cf..ab4b30a81 100644 --- a/src/main/java/org/apache/commons/collections/ComparatorUtils.java +++ b/src/main/java/org/apache/commons/collections/ComparatorUtils.java @@ -43,8 +43,7 @@ public class ComparatorUtils { /** * ComparatorUtils should not normally be instantiated. */ - public ComparatorUtils() { - } + private ComparatorUtils() {} /** * Comparator for natural sort order. diff --git a/src/main/java/org/apache/commons/collections/EnumerationUtils.java b/src/main/java/org/apache/commons/collections/EnumerationUtils.java index 07e45feac..d070114e8 100644 --- a/src/main/java/org/apache/commons/collections/EnumerationUtils.java +++ b/src/main/java/org/apache/commons/collections/EnumerationUtils.java @@ -34,9 +34,7 @@ public class EnumerationUtils { /** * EnumerationUtils is not normally instantiated. */ - public EnumerationUtils() { - // no init. - } + private EnumerationUtils() {} /** * Creates a list based on an enumeration. diff --git a/src/main/java/org/apache/commons/collections/FactoryUtils.java b/src/main/java/org/apache/commons/collections/FactoryUtils.java index ea28918f4..a0fddaade 100644 --- a/src/main/java/org/apache/commons/collections/FactoryUtils.java +++ b/src/main/java/org/apache/commons/collections/FactoryUtils.java @@ -41,9 +41,7 @@ public class FactoryUtils { /** * This class is not normally instantiated. */ - public FactoryUtils() { - super(); - } + private FactoryUtils() {} /** * Gets a Factory that always throws an exception. diff --git a/src/main/java/org/apache/commons/collections/IteratorUtils.java b/src/main/java/org/apache/commons/collections/IteratorUtils.java index 94486a866..d6d908450 100644 --- a/src/main/java/org/apache/commons/collections/IteratorUtils.java +++ b/src/main/java/org/apache/commons/collections/IteratorUtils.java @@ -112,8 +112,7 @@ public class IteratorUtils { /** * IteratorUtils is not normally instantiated. */ - public IteratorUtils() { - } + private IteratorUtils() {} // Empty //----------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/collections/ListUtils.java b/src/main/java/org/apache/commons/collections/ListUtils.java index 5735bcd2d..5809b8052 100644 --- a/src/main/java/org/apache/commons/collections/ListUtils.java +++ b/src/main/java/org/apache/commons/collections/ListUtils.java @@ -50,8 +50,7 @@ public class ListUtils { /** * ListUtils should not normally be instantiated. */ - public ListUtils() { - } + private ListUtils() {} //----------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/collections/MapUtils.java b/src/main/java/org/apache/commons/collections/MapUtils.java index f05accd23..1a03a6733 100644 --- a/src/main/java/org/apache/commons/collections/MapUtils.java +++ b/src/main/java/org/apache/commons/collections/MapUtils.java @@ -97,8 +97,7 @@ public class MapUtils { /** * MapUtils should not normally be instantiated. */ - public MapUtils() { - } + private MapUtils() {} // Type safe getters //------------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/collections/PredicateUtils.java b/src/main/java/org/apache/commons/collections/PredicateUtils.java index d8166bb42..19beaa554 100644 --- a/src/main/java/org/apache/commons/collections/PredicateUtils.java +++ b/src/main/java/org/apache/commons/collections/PredicateUtils.java @@ -74,9 +74,7 @@ public class PredicateUtils { /** * This class is not normally instantiated. */ - public PredicateUtils() { - super(); - } + private PredicateUtils() {} // Simple predicates //----------------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/collections/SetUtils.java b/src/main/java/org/apache/commons/collections/SetUtils.java index b0334166e..0e98f89ac 100644 --- a/src/main/java/org/apache/commons/collections/SetUtils.java +++ b/src/main/java/org/apache/commons/collections/SetUtils.java @@ -77,8 +77,7 @@ public class SetUtils { /** * SetUtils should not normally be instantiated. */ - public SetUtils() { - } + private SetUtils() {} //----------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/collections/SplitMapUtils.java b/src/main/java/org/apache/commons/collections/SplitMapUtils.java index 8d0062333..f079147c1 100644 --- a/src/main/java/org/apache/commons/collections/SplitMapUtils.java +++ b/src/main/java/org/apache/commons/collections/SplitMapUtils.java @@ -41,8 +41,9 @@ public class SplitMapUtils { /** * SplitMapUtils should not normally be instantiated. */ - public SplitMapUtils() { - } + private SplitMapUtils() {} + + //----------------------------------------------------------------------- private static class WrappedGet implements IterableMap, Unmodifiable { private final Get get; @@ -193,6 +194,8 @@ public class SplitMapUtils { } } + //----------------------------------------------------------------------- + /** * Get the specified {@link Get} as an instance of {@link IterableMap}. * If get implements {@link IterableMap} directly, no conversion will take place. diff --git a/src/main/java/org/apache/commons/collections/TransformerUtils.java b/src/main/java/org/apache/commons/collections/TransformerUtils.java index 4ba9787f1..bc61c8c75 100644 --- a/src/main/java/org/apache/commons/collections/TransformerUtils.java +++ b/src/main/java/org/apache/commons/collections/TransformerUtils.java @@ -64,9 +64,7 @@ public class TransformerUtils { /** * This class is not normally instantiated. */ - public TransformerUtils() { - super(); - } + private TransformerUtils() {} /** * Gets a transformer that always throws an exception. diff --git a/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java index 858773ef0..0deef7aca 100644 --- a/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java @@ -1523,15 +1523,6 @@ public class CollectionUtilsTest extends MockTestCase { (Object)map, 0)); } - /** - * TODO: Should {@link CollectionUtils} be able to be extended? If it is extended, subclasses must 'override' the static methods with - * call-throughs anyhow, otherwise java compiler warnings will result - */ - @Test - public void ensureCollectionUtilsCanBeExtended() { - new CollectionUtils() {}; - } - @Test public void reverse() { CollectionUtils.reverseArray(new Object[] {});