public class CodeLoader {
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
public MethodHandle golo(String file, String func, int argCount) {
GoloClassLoader classLoader = new GoloClassLoader();
String filename = "snippets/golo/" + file + ".golo";
Class<?> module = classLoader.load(filename, CodeLoader.class.getResourceAsStream("/" + filename));
try {
return LOOKUP.findStatic(module, func, MethodType.genericMethodType(argCount));
} catch (Exception e) {
throw new RuntimeException(e);
}