public static Class<?> parseClass(String source, String packageAndClassName) { if (LOADER == null) { throw new RuntimeException( "Compile fail: no Groovy jar in the classpath", INIT_FAIL_EXCEPTION); } try { Object codeSource = Utils.newInstance("groovy.lang.GroovyCodeSource", source, packageAndClassName + ".groovy", "UTF-8"); Utils.callMethod(codeSource, "setCachable", false); Class<?> clazz = (Class<?>) Utils.callMethod( LOADER, "parseClass", codeSource); return clazz; } catch (Exception e) { throw new RuntimeException(e); } } }