Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java compiler automatically renaming parameters (obfuscating)

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.

like image 693
Jeff Demanche Avatar asked Jun 14 '12 21:06

Jeff Demanche


1 Answers

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.

like image 123
Tomasz Nurkiewicz Avatar answered Oct 13 '22 01:10

Tomasz Nurkiewicz