This is not OpenAPI-specific, but it is an attempt to allow my plugin to see jars located in IDEA/lib/ant.
ClassLoader classLoader = new URLClassLoader(/*urls of files from lib/ant*/);
final Class consoleClass = classLoader.loadClass(AntConsole.class.getName());
console = (AntConsole) consoleClass.newInstance();
//now some checking:
classLoader.loadClass("org.apache.tools.ant.launch.Locator"); //<-- works
consoleClass.getClassLoader().loadClass("org.apache.tools.ant.launch.Locator"); //<-- throws NoClassDefFound
I suspect that AntConsole class has been already loaded and cached by some of classLoader's parents, with antConsole.class.getClassLoader() == this parent ClassLoader. As far as this parent loader doesn't see Locator class, I'm getting an exception. But is there some way to overcome this?