Java compiler automatically renames parameters (obfuscation)

When I compile the code that I write and then look in JD Gui, the methods are displayed with headers such as:

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

I am compiling through a .bat file. Is there a way to indicate that I do not want to confuse the code.

+5
source share
1 answer

By default, javac does not contain debugging information in generated class files. This information, for example, the names of the method parameters (but the names of the methods and fields are always stored for resolution). When parameter names are unknown, the JD-GUI and other decompilers make up a few sensible names. They do not get confused - they just are not there.

Compile your code using the -g flag:

 javac -g SomeClass.java 

Just checked the JD-GUI - it displays the correct parameter names.

+7
source

Source: https://habr.com/ru/post/922492/


All Articles