I am trying to loadClass which are compiled during build and placed in classpath as .class files. For this I tried
GroovyClassLoader gos = new GroovyClassLoader();
gos.loadClass("className");
This will successfully load the class file in java code but it uses AppClassLoader to load this not GroovyClassLoader.
I understand that GroovyClassLoader internally finds it using AppClassLoader. But there is a difference :
As gos.parseClass(string)
will give us a class parsed from GroovyClassLoader.
While instantiating class file in second case(parseClass) give us delegate to set Delegate but in the first case(loadClass), we don't have any.
How to set delegate after doing loadClass or any way to load class file through GroovyClassLoader.