MethodTree java 6 编译器树 API

发布于 2024-09-03 10:19:09 字数 172 浏览 4 评论 0原文

给定方法名和定义该方法的类名,是否可以在不创建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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除会话 2024-09-10 10:19:09

发现如果没有类树,就不可能为特定方法生成方法树。需要生成类树并获取必要的方法树。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文