@@ -99,10 +99,14 @@ public SortAnalyzer(ArrayVisualizer arrayVisualizer) {
9999 private boolean compileSingle (String name , ClassLoader loader ) {
100100 try {
101101 Class <?> sortClass ;
102- if (loader == null )
103- sortClass = Class .forName (name );
104- else
105- sortClass = Class .forName (name , true , loader );
102+ try {
103+ if (loader == null )
104+ sortClass = Class .forName (name );
105+ else
106+ sortClass = Class .forName (name , true , loader );
107+ } catch (ClassNotFoundException e ) {
108+ return true ;
109+ }
106110 // System.out.println(sortClass.getConstructors()[0].getParameterTypes()[0].hashCode());
107111 Constructor <?> newSort = sortClass .getConstructor (new Class [] {ArrayVisualizer .class });
108112 // Constructor<?> newSort = sortClass.getConstructors()[0];
@@ -138,11 +142,11 @@ private boolean compileSingle(String name, ClassLoader loader) {
138142 return true ;
139143 }
140144
141- @ SuppressWarnings ("unused" )
142145 public void analyzeSorts () {
143146 ClassGraph classGraph = new ClassGraph ();
144147 classGraph .whitelistPackages ("sorts" );
145148 classGraph .blacklistPackages ("sorts.templates" );
149+ classGraph .blacklistPaths ("cache/*" );
146150
147151 try (ScanResult scanResult = classGraph .scan ()) {
148152 List <ClassInfo > sortFiles ;
@@ -175,7 +179,7 @@ public boolean importSort(File file, boolean showConfirmation) {
175179 }
176180 String packageName = matcher .group (1 );
177181 String name = packageName + "." + file .getName ().split ("\\ ." )[0 ];
178- File tempPath = new File (String .join ("/" , packageName .split ("\\ ." )));
182+ File tempPath = new File ("./cache/" + String .join ("/" , packageName .split ("\\ ." )));
179183 tempPath .mkdirs ();
180184 File destPath = new File (tempPath .getAbsolutePath () + "/" + file .getName ());
181185 try {
@@ -194,7 +198,7 @@ public boolean importSort(File file, boolean showConfirmation) {
194198 }
195199
196200 try {
197- if (!compileSingle (name , URLClassLoader .newInstance (new URL [] { new File ("." ).toURI ().toURL () })))
201+ if (!compileSingle (name , URLClassLoader .newInstance (new URL [] { new File ("./cache/ " ).toURI ().toURL () })))
198202 return false ;
199203 }
200204 catch (Exception e ) {
0 commit comments