Search in sources :

Example 1 with MemoryOutputManager

use of kalang.tool.MemoryOutputManager in project kalang by kasonyang.

the class KalangClassLoader method generate.

@Override
public void generate(ClassNode classNode) {
    final MemoryOutputManager outputManager = new MemoryOutputManager();
    Ast2Class ast2Class = new Ast2Class(outputManager);
    ast2Class.generate(classNode);
    String[] names = outputManager.getClassNames();
    for (String name : names) {
        byte[] bs = outputManager.getBytes(name);
        if (bs != null) {
            Class<?> clazz = defineClass(name, bs, 0, bs.length);
            loadedClasses.put(name, clazz);
        }
    }
}
Also used : MemoryOutputManager(kalang.tool.MemoryOutputManager) Ast2Class(kalang.compiler.codegen.Ast2Class)

Aggregations

Ast2Class (kalang.compiler.codegen.Ast2Class)1 MemoryOutputManager (kalang.tool.MemoryOutputManager)1