File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
common/src/main/java/com/fox2code/foxloader/loader Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -262,8 +262,13 @@ void loadLanguageTo(String lang, Properties target) {
262262 private Mod initializeMod (String clsName ) throws ReflectiveOperationException {
263263 if (clsName == null ) return null ;
264264 Mod mod ;
265- Class <? extends Mod > cls = Class .forName (clsName , false ,
266- FoxLauncher .getFoxClassLoader ()).asSubclass (Mod .class );
265+ Class <?> cls0 = Class .forName (clsName , false , FoxLauncher .getFoxClassLoader ());
266+ if (cls0 .getClassLoader () == FoxLauncher .class .getClassLoader ()) {
267+ // This would have previously made a vague "ClassCastException" in "cls0.asSubclass(Mod.class)"
268+ throw new ReflectiveOperationException ("Class \" " + clsName +
269+ "\" exist on system class loader, and therefore cannot be properly loaded." );
270+ }
271+ Class <? extends Mod > cls = cls0 .asSubclass (Mod .class );
267272 try {
268273 tmp = this ;
269274 mod = cls .newInstance ();
You can’t perform that action at this time.
0 commit comments