如何检查注解的方法的参考 [英] How to Check References of Annotated Methods

查看:171
本文介绍了如何检查注解的方法的参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法来检查我的类与特定注释方法的引用(认为德precated)。

I'm trying to find a way to check my classes for references of methods with a particular annotation (think "Deprecated").

据我看到它,分析的字节code 的将无法工作,因为它不包含任何注释。结果
使用的 APT 的并没有真正帮助,因为我需要的引用的到的方法,而不是注解的方法本身。

As far as i see it, analysing byte code won't work because it doesn't contain any annotations.
Using APT doesn't really help because i need the references to the methods, not the annotated methods themselves.

那么,什么选择呢,我有?

So, what options do i have?

我能想出正在编制的注解的方法后跟一个完整的code分析列表,检查对列表中的每个方法调用的最好的。结果
有没有办法做到这一点有效在Eclipse插件或一个Ant任务?

The best i can come up with is compiling a list of the annotated methods followed by a full code analysis, checking every method call against the list.
Is there a way to do that efficiently in an eclipse plug-in or an ant task?

推荐答案

字节浅析code将作品!
ASM 一个例子是处理标注得非常好

Analysing bytecode will works! ASM for an example is handling annotation very well.

这篇关于如何检查注解的方法的参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆