Don't declare parameter of type Iterable<Path>
java.file.nio.Path implements Iterable<Path>, and provides an iterator over the name elements of the path. Declaring a parameter of type Iterable<Path> is not recommended as it allows callers to pass either an Iterable of Paths, or a single Path. Using Collection<Path> prevents callers from accidentally passing a single Path. Change-Id: Iade69324698adaac7f2f50e1c97f956397cf11e4
This commit is contained in:
@@ -26,6 +26,7 @@ import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -54,7 +55,7 @@ public final class IoUtil {
|
||||
}.start();
|
||||
}
|
||||
|
||||
public static void loadJARs(Iterable<Path> jars) {
|
||||
public static void loadJARs(Collection<Path> jars) {
|
||||
ClassLoader cl = IoUtil.class.getClassLoader();
|
||||
if (!(cl instanceof URLClassLoader)) {
|
||||
throw noAddURL("Not loaded by URLClassLoader", null);
|
||||
|
||||
Reference in New Issue
Block a user