compilerFactory = CompilerFactoryFactory.getDefaultCompilerFactory();
} catch (Exception e) {
throw new IllegalStateException(
"Unable to instantiate java compiler", e);
}
IClassBodyEvaluator cbe = compilerFactory.newClassBodyEvaluator();
cbe.setClassName(expr.name);
cbe.setExtendedClass(Utilities.class);
cbe.setImplementedInterfaces(new Class[]{Bindable.class, Typed.class});
cbe.setParentClassLoader(getClass().getClassLoader());
if (DEBUG) {
// Add line numbers to the generated janino class
cbe.setDebuggingInformation(true, true, true);
}
return (Bindable) cbe.createInstance(new StringReader(s));
}