commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1686826 - in /commons/proper/collections/trunk/src: changes/changes.xml main/java/org/apache/commons/collections4/CollectionUtils.java test/java/org/apache/commons/collections4/CollectionUtilsTest.java
Date Mon, 22 Jun 2015 10:17:20 GMT
Author: tn
Date: Mon Jun 22 10:17:20 2015
New Revision: 1686826

URL: http://svn.apache.org/r1686826
Log:
[COLLECTIONS-571] Deprecate CollectionUtils.{synchronized,unmodifiable}Collection.

Modified:
    commons/proper/collections/trunk/src/changes/changes.xml
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java

Modified: commons/proper/collections/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/changes/changes.xml?rev=1686826&r1=1686825&r2=1686826&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/changes/changes.xml (original)
+++ commons/proper/collections/trunk/src/changes/changes.xml Mon Jun 22 10:17:20 2015
@@ -22,6 +22,10 @@
   <body>
 
   <release version="4.1" date="TBD" description="">
+    <action issue="COLLECTIONS-571" dev="tn" type="update">
+      Deprecated methods "synchronizedCollection(Collection)" and "unmodifiableCollection(Collection)"
+      in class "CollectionUtils", the corresponding methods in "java.util.Collections" should
be used instead.
+    </action>
     <action issue="COLLECTIONS-566" dev="tn" type="fix">
       "IteratorUtils#collate(...)" methods did not use natural ordering when a
       null comparator was provided.

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java?rev=1686826&r1=1686825&r2=1686826&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
Mon Jun 22 10:17:20 2015
@@ -1808,7 +1808,9 @@ public class CollectionUtils {
      * @param collection  the collection to synchronize, must not be null
      * @return a synchronized collection backed by the given collection
      * @throws IllegalArgumentException  if the collection is null
+     * @deprecated since 4.1, use {@link java.util.Collections#synchronizedCollection(Collection)}
instead
      */
+    @Deprecated
     public static <C> Collection<C> synchronizedCollection(final Collection<C>
collection) {
         return SynchronizedCollection.synchronizedCollection(collection);
     }
@@ -1822,7 +1824,9 @@ public class CollectionUtils {
      * @param collection  the collection to make unmodifiable, must not be null
      * @return an unmodifiable collection backed by the given collection
      * @throws IllegalArgumentException  if the collection is null
+     * @deprecated since 4.1, use {@link java.util.Collections#unmodifiableCollection(Collection)}
instead
      */
+    @Deprecated
     public static <C> Collection<C> unmodifiableCollection(final Collection<?
extends C> collection) {
         return UnmodifiableCollection.unmodifiableCollection(collection);
     }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java?rev=1686826&r1=1686825&r2=1686826&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
Mon Jun 22 10:17:20 2015
@@ -1524,18 +1524,20 @@ public class CollectionUtilsTest extends
     }
 
     @Test
+    @Deprecated
     public void testSynchronizedCollection() {
         Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<Object>());
         assertTrue("Returned object should be a SynchronizedCollection.", col instanceof
SynchronizedCollection);
         try {
             CollectionUtils.synchronizedCollection(null);
-            fail("Expecting IllegalArgumentException for null collection.");
-        } catch (final IllegalArgumentException ex) {
+            fail("Expecting NullPointerException for null collection.");
+        } catch (final NullPointerException ex) {
             // expected
         }
     }
 
     @Test
+    @Deprecated
     public void testUnmodifiableCollection() {
         Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<Object>());
         assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof
UnmodifiableCollection);



Mime
View raw message