package sample; import groovy.lang.GroovyClassLoader; import java.io.InputStream; import junit.framework.TestCase; import org.codehaus.groovy.control.CompilationFailedException; public class StackOverflowTest extends TestCase { public void testStackOverflow() throws CompilationFailedException, InstantiationException, IllegalAccessException, ClassNotFoundException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); GroovyClassLoader groovyClassLoader = new GroovyClassLoader(cl); InputStream scriptStream = cl.getResourceAsStream("other/SomeInterface.groovy"); groovyClassLoader.parseClass(scriptStream); } }