Is there a Java library to generate class files from an AST?

后端 未结 2 791
孤独总比滥情好
孤独总比滥情好 2021-02-14 07:47

This page describes how I can use the code generator in javac to generate code given that I can build an AST (using a separate parser which I wrote). The technique involves edit

2条回答
  •  走了就别回头了
    2021-02-14 08:12

    Another cool framework is ASM, a bytecode analysis and manipulation framework.

    In case you do not want to use a framework, as of now (2014), it is not possible to generate bytecode from a tree using the arbitrary representations of com.sun.source.tree.* as said here.

提交回复
热议问题