MethodTree java 6 编译器树 API
给定方法名和定义该方法的类名,是否可以在不创建ClassTree的情况下构造MethodTree,我想这样做的原因是,我正在对java源代码进行静态分析,每当我遇到方法调用时,我都需要访问该方法(无论它在哪里定义)并继续,目前我为所有类生成 AST,然后我一次开始访问一个方法,这是不必要的,因为我不想解析所有类及其中的所有方法。
Given a method name and the Class name where the method is defined, is it possible to construct the MethodTree without creating the ClassTree, The reason why I want to do in this way is , I am doing a static analysis on the java source code,whenever I encounter a method invocation I need to visit that method wherever it is defined and proceed on, Currently I generate the AST for all the classes and then I start visiting a method at a time which is kind of not necessary since I don t want to parse all the classes and all the methods within it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现如果没有类树,就不可能为特定方法生成方法树。需要生成类树并获取必要的方法树。
figured out that it is not possible to generate a methodtree for a specific method without the class tree.need to have the class tree generated and obtain the necessary method tree.