Fix canonical service fetcher method, updates #210

This commit is contained in:
Mumfrey committed 2017-09-26 15:40:11 +01:00
1 parent 164e471dcd
commit 03d1ad54f8
1 file changed
+5 -2
@@ -65,9 +65,12 @@ public final class MixinService {
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
if (MixinService.class.getClassLoader() != systemClassLoader) {
try {
String self = Thread.currentThread().getStackTrace()[1].getMethodName();
Class<?> contextServiceClass = Class.forName(MixinService.class.getName(), true, systemClassLoader);
Method mdGetInstance = contextServiceClass.getMethod("getInstance");
MixinService.instance = (MixinService)mdGetInstance.invoke(null);
if (contextServiceClass != MixinService.class) {
Method mdGetInstance = contextServiceClass.getDeclaredMethod(self);
MixinService.instance = (MixinService)mdGetInstance.invoke(null);
}
} catch (Exception ex) {
ex.printStackTrace();
}