Skip to content

Commit cf02f0f

Browse files
committed
Fix raw types for private variables
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@896991 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8841ea9 commit cf02f0f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/java/org/apache/commons/io/comparator/CompositeFileComparator.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,20 @@
4444
*/
4545
public class CompositeFileComparator extends AbstractFileComparator implements Serializable {
4646

47-
private static final Comparator[] NO_COMPARATORS = {};
47+
private static final Comparator<?>[] NO_COMPARATORS = {};
4848
private final Comparator<File>[] delegates;
4949

5050
/**
5151
* Create a composite comparator for the set of delegate comparators.
5252
*
5353
* @param delegates The delegate file comparators
5454
*/
55+
@SuppressWarnings("unchecked") // casts 1 & 2 must be OK because types are already correct
5556
public CompositeFileComparator(Comparator<File>... delegates) {
5657
if (delegates == null) {
57-
this.delegates = NO_COMPARATORS;
58+
this.delegates = (Comparator<File>[]) NO_COMPARATORS;//1
5859
} else {
59-
this.delegates = new Comparator[delegates.length];
60+
this.delegates = (Comparator<File>[]) new Comparator<?>[delegates.length];//2
6061
System.arraycopy(delegates, 0, this.delegates, 0, delegates.length);
6162
}
6263
}
@@ -66,15 +67,16 @@ public CompositeFileComparator(Comparator<File>... delegates) {
6667
*
6768
* @param delegates The delegate file comparators
6869
*/
70+
@SuppressWarnings("unchecked") // casts 1 & 2 must be OK because types are already correct
6971
public CompositeFileComparator(Iterable<Comparator<File>> delegates) {
7072
if (delegates == null) {
71-
this.delegates = NO_COMPARATORS;
73+
this.delegates = (Comparator<File>[]) NO_COMPARATORS; //1
7274
} else {
7375
List<Comparator<File>> list = new ArrayList<Comparator<File>>();
7476
for (Comparator<File> comparator : delegates) {
7577
list.add(comparator);
7678
}
77-
this.delegates = list.toArray(new Comparator[list.size()]);
79+
this.delegates = (Comparator<File>[]) list.toArray(new Comparator<?>[list.size()]); //2
7880
}
7981
}
8082

0 commit comments

Comments
 (0)