commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r896991 - /commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/CompositeFileComparator.java
Date Thu, 07 Jan 2010 20:03:42 GMT
Author: sebb
Date: Thu Jan  7 20:03:42 2010
New Revision: 896991

URL: http://svn.apache.org/viewvc?rev=896991&view=rev
Log:
Fix raw types for private variables

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/CompositeFileComparator.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/CompositeFileComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/CompositeFileComparator.java?rev=896991&r1=896990&r2=896991&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/CompositeFileComparator.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/comparator/CompositeFileComparator.java
Thu Jan  7 20:03:42 2010
@@ -44,7 +44,7 @@
  */
 public class CompositeFileComparator extends AbstractFileComparator implements Serializable
{
 
-    private static final Comparator[] NO_COMPARATORS = {};
+    private static final Comparator<?>[] NO_COMPARATORS = {};
     private final Comparator<File>[] delegates;
 
     /**
@@ -52,11 +52,12 @@
      *
      * @param delegates The delegate file comparators
      */
+    @SuppressWarnings("unchecked") // casts 1 & 2 must be OK because types are already
correct
     public CompositeFileComparator(Comparator<File>... delegates) {
         if (delegates == null) {
-            this.delegates = NO_COMPARATORS;
+            this.delegates = (Comparator<File>[]) NO_COMPARATORS;//1
         } else {
-            this.delegates = new Comparator[delegates.length];
+            this.delegates = (Comparator<File>[]) new Comparator<?>[delegates.length];//2
             System.arraycopy(delegates, 0, this.delegates, 0, delegates.length);
         }
     }
@@ -66,15 +67,16 @@
      *
      * @param delegates The delegate file comparators
      */
+    @SuppressWarnings("unchecked") // casts 1 & 2 must be OK because types are already
correct
     public CompositeFileComparator(Iterable<Comparator<File>> delegates) {
         if (delegates == null) {
-            this.delegates = NO_COMPARATORS;
+            this.delegates = (Comparator<File>[]) NO_COMPARATORS; //1
         } else {
             List<Comparator<File>> list = new ArrayList<Comparator<File>>();
             for (Comparator<File> comparator : delegates) {
                 list.add(comparator);
             }
-            this.delegates = list.toArray(new Comparator[list.size()]);
+            this.delegates = (Comparator<File>[]) list.toArray(new Comparator<?>[list.size()]);
//2
         }
     }
 



Mime
View raw message