PlugFace icon indicating copy to clipboard operation
PlugFace copied to clipboard

Custom class loaders

Open mateuszjarzyna opened this issue 5 years ago • 1 comments

Hi, I've created method to use own, custom class loader. This change can resolve https://github.com/MatteoJoliveau/PlugFace/issues/19 by creating new class loader

`@RequiredArgsConstructor public class PluginClassLoaderCreator implements ClassLoaderCreator {

private final ClassLoader parentClassLoader;

@Override
public ClassLoader createClassLoader(URL[] jars) {
    return new URLClassLoader(jars, parentClassLoader);
}

}`

new PluginClassLoaderCreator(this.getClass().getClassLoader());

This code of course can break all security feature, but programmes should known the consequentness of passing no-default class loader.

mateuszjarzyna avatar Apr 23 '19 09:04 mateuszjarzyna

Could this also resolve the casting error from #24 ? I know loaders can do funny things with something that would normally seem trivial like casting.

Col-E avatar Jan 01 '21 00:01 Col-E