71 lines
2.5 KiB
Java
71 lines
2.5 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.sys.module;
|
|
|
|
import com.tridium.asm.Buffer;
|
|
import com.tridium.sys.module.ModuleClassLoader;
|
|
|
|
public class AutoClassLoader {
|
|
public static final SysClassLoader sysClassLoader = new SysClassLoader();
|
|
|
|
public static Class load(Class clazz, String string, Buffer buffer) throws ClassNotFoundException {
|
|
if (!string.startsWith("auto.")) {
|
|
throw new IllegalStateException("class name must begin with auto");
|
|
}
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
if (classLoader instanceof ModuleClassLoader) {
|
|
return ((ModuleClassLoader)classLoader).loadAutoClass(string, buffer);
|
|
}
|
|
return sysClassLoader.loadAutoClass(string, buffer);
|
|
}
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
static class SysClassLoader
|
|
extends ClassLoader {
|
|
private Buffer buffer;
|
|
static /* synthetic */ Class class$com$tridium$sys$module$AutoClassLoader$SysClassLoader;
|
|
|
|
Class loadAutoClass(String string, Buffer buffer) throws ClassNotFoundException {
|
|
this.buffer = buffer;
|
|
return this.loadClass(string);
|
|
}
|
|
|
|
public Class loadClass(String string, boolean bl) throws ClassNotFoundException {
|
|
if (!string.startsWith("auto.")) {
|
|
return super.loadClass(string, bl);
|
|
}
|
|
Class<?> clazz = this.defineClass(string, this.buffer.bytes, 0, this.buffer.count);
|
|
if (bl) {
|
|
this.resolveClass(clazz);
|
|
}
|
|
this.buffer = null;
|
|
return clazz;
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
SysClassLoader() {
|
|
Class clazz = class$com$tridium$sys$module$AutoClassLoader$SysClassLoader;
|
|
if (clazz == null) {
|
|
clazz = class$com$tridium$sys$module$AutoClassLoader$SysClassLoader = SysClassLoader.class("[Lcom.tridium.sys.module.AutoClassLoader$SysClassLoader;", false);
|
|
}
|
|
super(clazz.getClassLoader());
|
|
}
|
|
}
|
|
}
|
|
|