public JavaBuilder(ExecutorService tasksExecutor) {
myJavacCompiler = new EmbeddedJavac(tasksExecutor);
//add here class processors in the sequence they should be executed
myJavacCompiler.addClassProcessor(new EmbeddedJavac.ClassPostProcessor() {
public void process(CompileContext context, OutputFileObject out) {
final PseudoClassLoader loader = PSEUDO_CLASSLOADER_KEY.get(context);
if (loader != null) {
final String className = out.getClassName();
if (className != null) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (loader) {
loader.defineClass(className.replace('.', '/'), out.getContent().toByteArray());
}
}
}
}
});