用于代码分析的Java库 [英] Java library for code analysis
本文介绍了用于代码分析的Java库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有任何Java库可以帮助从指定的java源文件构建 AST 反之亦然(从ASTree对象生成代码)?我需要这个,但有了API,允许访问以编程方式生成树。
Is there any Java library, that can help in building AST from the specified java source file and vice versa (generate code from the ASTree object)? I need something like this, but with an API, allowing to access the generated tree programmatically.
推荐答案
Eclipse核心中已经存在所有内容。
这是一个页面,其中包含一个如何使用 org.eclipse.jdt.core.dom.ASTParser
创建所需AST数据结构的小例子。
Everything's already available within the Eclipse core.
Here's a page with a small example of how to use org.eclipse.jdt.core.dom.ASTParser
to create your desired AST datastructure.
这篇关于用于代码分析的Java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文