From a63a3b6bae7c2419f66dfbfa4e3141d802ad3042 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 28 Jul 2017 19:36:34 -0700 Subject: [PATCH] Make ClassFinder return generic List objects. --- src/org/nwapw/abacus/plugin/ClassFinder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/nwapw/abacus/plugin/ClassFinder.java b/src/org/nwapw/abacus/plugin/ClassFinder.java index a266ea8..cfd26f6 100644 --- a/src/org/nwapw/abacus/plugin/ClassFinder.java +++ b/src/org/nwapw/abacus/plugin/ClassFinder.java @@ -8,6 +8,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Enumeration; +import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.stream.Collectors; @@ -24,7 +25,7 @@ public class ClassFinder { * @throws IOException thrown if an error occurred scanning the plugin folder. * @throws ClassNotFoundException thrown if the class listed in the file doesn't get loaded. */ - public static ArrayList> loadJars(String filePath) throws IOException, ClassNotFoundException { + public static List> loadJars(String filePath) throws IOException, ClassNotFoundException { return loadJars(new File(filePath)); } @@ -35,7 +36,7 @@ public class ClassFinder { * @throws IOException thrown if an error occurred scanning the plugin folder. * @throws ClassNotFoundException thrown if the class listed in the file doesn't get loaded. */ - public static ArrayList> loadJars(File pluginFolderPath) throws IOException, ClassNotFoundException { + public static List> loadJars(File pluginFolderPath) throws IOException, ClassNotFoundException { ArrayList> toReturn = new ArrayList<>(); if(!pluginFolderPath.exists()) return toReturn; ArrayList files = Files.walk(pluginFolderPath.toPath()) @@ -55,7 +56,7 @@ public class ClassFinder { * @throws IOException thrown if there was an error reading the file * @throws ClassNotFoundException thrown if the class could not be loaded. */ - public static ArrayList> loadJar(File jarLocation) throws IOException, ClassNotFoundException { + public static List> loadJar(File jarLocation) throws IOException, ClassNotFoundException { ArrayList> loadedClasses = new ArrayList<>(); String path = jarLocation.getPath(); URL[] urls = new URL[]{new URL("jar:file:" + path + "!/")};