클래스의 이름을 얻을 수있는 것처럼 메소드의 이름을 얻는 방법은 무엇입니까? (RandomClass.class.getName())class.getDeclaredMethod를 사용하지 않고 메소드의 이름을 얻는 방법
난독 화가가 손상시켜 하드 코딩이 작동하지 않습니다.
이유 :이 같은 내가 주입하고있어 방법 : 나는 메소드 이름을 알고 같은 종류의 사 바르 같이가 없기 때문에
MethodNode getLocalPlayer = GetterAdapter.insert(false, true, "getLocalPlayer", "Lvanquish/accessors/Player;", "client", "yD", "LQZ;");
classNode.methods.add(getLocalPlayer);
//class client implements my interface which contains the method getLocalPlayer
public interface Client {
public int[] getPlayerIndices();
public Player getLocalPlayer();
public Player[] getPlayers();
public int getBaseX();
public int getBaseY();
public int getCameraX();
public int getCameraY();
}
//when I obfuscate my files getLocalPlayer get's a name like a2
//when you look above you see that the method name was hard code and so
// will it create an error
선언 방법은 늘 여기에 작동합니다.
이 것이 작동할까요, 아니면 엉망이 될까요?
@DataMap.varDetails(name = "getPlayerIndices")
public int[] getPlayerIndices();
예외를 throw하고 catch하여 스택 추적을 확인할 수 있습니다. 농담하는 것만으로도 ... – 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)와 비슷합니다.) –