Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for renaming methods, classes and fields #794

Merged
merged 3 commits into from
Dec 10, 2019
Merged

Add support for renaming methods, classes and fields #794

merged 3 commits into from
Dec 10, 2019

Conversation

S-trace
Copy link
Contributor

@S-trace S-trace commented Dec 10, 2019

This request adds a Rename popup menu item that allows the user to rename classes, methods and fields.
It is useful for obfuscated code, it makes it much easier to read.
The implementation is very basic and perhaps not optimal, but it works.

I'm working for a better implementation which will not reload whole file at every rename, but it's still in progress.

This request is related to issue #791 but does not completely closes it - there is a place for improving this implementation,
However, no feature is worse than slow, but working feature - so, it's will be good to merge current implementation and then improve it.

…yRealName() to JadxWrapper

Those methods is like getFullName() and searchJavaClassByClassName(), but for class names without aliases.
It is necessary for renaming classes/methods/fields.
This is necessary for renaming functionality
…ields)

It allows user to rename classes, methods and fields.
It updates deobfuscation map and reload file.
This may be suboptimal, and maybe some RenameVisitor should be added.
Deobfuscation should be enabled in order to allow this.
@skylot skylot merged commit e3055b9 into skylot:master Dec 10, 2019
@S-trace S-trace deleted the rename branch December 10, 2019 20:05
@ppwwyyxx
Copy link

ppwwyyxx commented Jun 29, 2020

Hi, thanks for adding this feature!
However, when I clicked rename, a window like this popup:
0629-04:09:22
and nothing happened after I clicked rename in the window. Looks like something isn't working well.
(I built jadx from master)

@jpstotz
Copy link
Collaborator

jpstotz commented Jun 30, 2020

@ppwwyyxx That seems to be a problem with the GUI of the rename dialog. The dialog itself can be resized. If you do so and increase the height the text field where you can change the name becomes visible.

The problem source seems to be this line: setSize(800, 80);
https://github.com/skylot/jadx/blob/rename/jadx-gui/src/main/java/jadx/gui/ui/RenameDialog.java#L367

Comment it out and the dialog is usable.

@S-trace
Copy link
Contributor Author

S-trace commented Jul 2, 2020

Just for anyone interested in the advanced rename feature - please check out the https://github.com/skylot/jadx/tree/rename branch to test it.

Please report any issues to the #791 issue (if any).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants