Java compiler automatically renaming parameters (obfuscating)

纵然是瞬间 提交于 2020-02-23 11:30:31

问题


When I compile the code I am writing, then look at in a a JD Gui, methods show up with headers such as the following:

public void growSurface(Random paramRandom, int paramInt1, int paramInt2){

I am compiling through a .bat file. Is there a way to specify that I don't want to obfuscate the code.


回答1:


By default javac is not including debug information in generated class files. This information is e.g. method parameter names (but method and field names are always stored to allow reflection). When the parameter names are not known, JD-GUI and other decompilers are making up some reasonable names. They are not obfuscated - simply they aren't there.

Compile your code with -g flag:

javac -g SomeClass.java

Just checked JD-GUI - it shows correct parameter names then.



来源:https://stackoverflow.com/questions/11041506/java-compiler-automatically-renaming-parameters-obfuscating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!