Refactor tool for Java



  • I'm working in a decompiled java jar, that was obfuscated with Pro Guard.
    The class names are gone, the methods names are gone, the variable names are gone.
    Now, does anyone knows of a tool that, after I load all the classes (~2K files), let me change the names of the classes, methods, and this change, gets passed and updated to every file in the project?

    For example, class BLI descends from AUX, and after I change the AUX name to MyClassThatDoesThis, BLI is descendant from MyClassThatDoesThis, instead of AUX.




  • Eclipse.  Load the code into a new project, right click on whatever you need to change then select "refactor".



  • Ok, thanks.

    I'm not a java programmer, neither never tried Eclipse, but I'll get it.

    Thanks.



  • @Savior said:

    Ok, thanks.

    I'm not a java programmer, neither never tried Eclipse, but I'll get it.

    Thanks.


    Eclipse is a pretty good IDE.  You can install plugins for it so that it can compile more than just Java projects. For your purposes, you'll just need to click on the class name where it says "public class <classname>" in the file, it'll highlight the class name in grey, then right click and select refactor.  It'll ask you want you want the new name to be.  I don't remember if it will rename the file as well or not.  I think you can also do it by right clicking on the file in the project explorer window and selecting refactor.  IIRC, if you refactor the name of the file, it will go ahead and refactor the name of the public class that's in the file.



  • I got it, and it's exactly what I need.

    ALT+SHIFT+R does the same, and, when renaming the class, it also renames the file.

    Very good tool, indeed.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.