Fixed class loading for compiled Java plugins. -Bibl

This commit is contained in:
TheBiblMan 2015-06-01 15:29:56 +01:00
parent ff7bd343fc
commit 6db4dc2500

View file

@ -136,9 +136,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy {
ccache = new HashMap<String, Class<?>>();
for(LoadedNodeData d: set) {
if(d != data) {
cache.put(d.node.name, d);
}
cache.put(d.node.name, d);
}
@SuppressWarnings("unchecked")
@ -152,7 +150,9 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy {
@Override
public Class<?> findClass(String name) throws ClassNotFoundException {
name = name.replace("/", ".");
name = name.replace(".", "/");
System.out.println("finding " + name);
if(ccache.containsKey(name))
return ccache.get(name);
@ -160,7 +160,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy {
LoadedNodeData data = cache.get(name);
if(data != null) {
byte[] bytes = data.bytes;
Class<?> klass = defineClass(data.node.name, bytes, 0, bytes.length);
Class<?> klass = defineClass(data.node.name.replace("/", "."), bytes, 0, bytes.length);
ccache.put(name, klass);
return klass;
}