}
}
public CompileResult compile(Map<String,String> templates){
try {
MemoryClassLoader memClassLoader = new MemoryClassLoader();
GeneratedSource source = generateJavaCode();
String _className = getClassName();
List<SourceCode> sources = new ArrayList<SourceCode>();
sources.add(new MemoryJavaSource(_className, source.getSource()));
Iterable<? extends ByteCode> byteCodes = getCompiler().compile(sources);
memClassLoader.addByteCode(byteCodes);
// MemoryJavaSource memSrc = new MemoryJavaSource(_className, source.getSource());
// List<MemoryJavaSource> sources = new ArrayList<MemoryJavaSource>();
// sources.add(memSrc);
//
// if( !compileFiles(memClassLoader.getClassDataMap(), sources) ){
// throw new Error("Ошибка компиляции");
// }
Class clazz = memClassLoader.loadClass(_className);
Constructor constructor = clazz.getConstructor(Map.class);
Object instance = constructor.newInstance(templates);
return new CompileResult(memClassLoader, sources, instance, source.getDefaultTemplates());
} catch (InstantiationException ex) {