如何才能获取方法的名称,就像我可以获取类的名称一样? (RandomClass.class.getName())如何在不使用class.getDeclaredMethod的情况下获取方法的名称
因为混淆器会破坏它,所以硬编码将不起作用。
原因: 我注射的方法是这样的:
声明的方法不会在这里工作,因为我不知道的方法名称和有像4个瓦尔相同类型的。
这个工作还是会是一团糟?
@DataMap.varDetails(name = "getPlayerIndices")
public int[] getPlayerIndices();
您可以抛出一个异常,抓住它并查看堆栈跟踪。只是在开玩笑,不要... – eran
http://stackoverflow.com/questions/3864175/how-to-get-the-name-of-method-in-current-class?rq=1 – MGorgon
为什么你需要至? (这听起来像一个[XY问题](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem)。) –