Skip to content

Feat/app scoped gui plugins - #2945

Merged
skylot merged 13 commits into
skylot:masterfrom
mostafaNazari702:feat/app-scoped-gui-plugins
Sep 12, 2026
Merged

skylot merged 13 commits into
skylot:masterfrom
mostafaNazari702:feat/app-scoped-gui-plugins

Conversation

@mostafaNazari702

Copy link
Copy Markdown
Contributor

❗ Please review the guidelines for contributing.

Done.

Description

Initiate GUI plugins on jadx-gui start

Fixes #2913

Right now GUI plugins only start once a project is loaded and they get unloaded again as soon as you close it so a plugin cant do anything on the start page or survive switching between APKs. Added a JadxGuiPlugin interface plugins can opt into: they get initGui(JadxGuiContext) once when the window opens and unload() when jadx-gui exits and they are skipped by the decompiler's plugin manager so they never get a second project-scoped lifecycle.

The GUI plugins context also moves from JadxWrapper to MainWindow´ and now keeps application and project registrations apart so closing a project only clears the project ones. Existing plugins are not affected and they keep using getGuiContext()` exactly as before.

@mostafaNazari702

Copy link
Copy Markdown
Contributor Author

Worth mentioning: Got some help from Kimi Code but it does not have an official/established Co-author trailer. Did however review the code.

@skylot

skylot commented Sep 4, 2026

Copy link
Copy Markdown
Owner

@mostafaNazari702 thanks, looks good 👍
Although, I will make several changes:

  • move gui plugin interface into new jadx-gui-api module
  • will try to merge or extend GuiPluginsManager with JadxPluginManager to reduce code duplication

@mostafaNazari702

Copy link
Copy Markdown
Contributor Author

@mostafaNazari702 thanks, looks good 👍 Although, I will make several changes:

* move gui plugin interface into new `jadx-gui-api` module

* will try to merge or extend `GuiPluginsManager` with `JadxPluginManager` to reduce code duplication

I may be able to make those changes myself and push a commit. Are those the only changes or do you have more stuff that you did not list in your comment?

@skylot

skylot commented Sep 9, 2026

Copy link
Copy Markdown
Owner

@mostafaNazari702 I already start working on this.
But both changes not going well, and I am still trying to figure how to better approach such modules and API split.

@skylot

skylot commented Sep 11, 2026

Copy link
Copy Markdown
Owner

I pushed my changes, still some places looks like workaround.
I will test it a little tomorrow and might apply some more changes.

@mostafaNazari702 meanwhile you can review and check my changes 🙂

@mostafaNazari702

Copy link
Copy Markdown
Contributor Author

@mostafaNazari702 meanwhile you can review and check my changes 🙂

Had a look at your changes and overall approach makes sense to me but i found a few things while going through it and pushed fixes:

  • buildForPlugin always passed projectScope so global plugins' menu entries and popups went into the project registry and got wiped on project close, globalScope was never written to at all.

  • removing allPlugins.clear() from load() breaks reloadPasses(), it throws Duplicate plugin id now. changed it to only drop the plugins coming from the loader so injected globals still survive.

  • jadx-gui-api needs api(project(":jadx-core")), with implementation the published pom has jadx-core at runtime scope and plugin authors can't compile against it. Tried it with a separate project and it fails on cannot access JadxPlugin.

  • smaller stuff: globalDecompiler NPEs on every project open if the global load failed, a global plugin's custom settings page disappears while a project is open and i put final back on JadxDecompiler since the anonymos subclass was only there for a toString.

Added tests for the lifecycle bits too, i highly recommend keeping them but you decide!

Comment thread jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java Outdated
@skylot

skylot commented Sep 12, 2026

Copy link
Copy Markdown
Owner

@mostafaNazari702 thanks for fixes, PR looks ready for merge now 🎉

@mostafaNazari702

Copy link
Copy Markdown
Contributor Author

@mostafaNazari702 thanks for fixes, PR looks ready for merge now 🎉

Wait, how about your TODOs?

@skylot

skylot commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Wait, how about your TODOs?

That will be another big change 🤣

@mostafaNazari702

mostafaNazari702 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Wait, how about your TODOs?

That will be another big change 🤣

Since this PR did not get merged yet i guess a short convo might be okay.

Are you open to actively improving the decompiler itself? When was the last time you worked on improving things like decompilation accuracy?

When decompiling an app, you also often encounter various warnings and errors. While some of these may be false positives, have you considered spending some time researching how open-source compilers and decompilers implement their algorithms? Understanding the techniques they use could potentially help identify ways to improve JADX GUI’s decompilation accuracy and reduce the number of warnings and errors.

@skylot
skylot merged commit 2fb1b16 into skylot:master Sep 12, 2026
2 checks passed
@mostafaNazari702
mostafaNazari702 deleted the feat/app-scoped-gui-plugins branch September 12, 2026 18:26
@skylot

skylot commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Are you open to actively improving the decompiler itself?

Yes. But at this point it super hard, so work on improvements are very slow.

When decompiling an app, you also often encounter various warnings and errors.

It is fine to some extent, because it is impossible to resolve all issues (decompilation is unsolvable in general case).

have you considered spending some time researching how open-source compilers and decompilers implement their algorithms?

I checked several decompilers, didn't notice much difference at core architecture, only implementation details.

@mostafaNazari702

mostafaNazari702 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Are you open to actively improving the decompiler itself?

Yes. But at this point it super hard, so work on improvements are very slow.

When decompiling an app, you also often encounter various warnings and errors.

It is fine to some extent, because it is impossible to resolve all issues (decompilation is unsolvable in general case).

have you considered spending some time researching how open-source compilers and decompilers implement their algorithms?

I checked several decompilers, didn't notice much difference at core architecture, only implementation details.

Can you please add me on Discord? I need to discuss this more with you, this is my username: jizz_y

@skylot

skylot commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Can you please add me on Discord? I need to discuss this more with you

You can open a new issue for discussion.

@mostafaNazari702

mostafaNazari702 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

But at this point, it’s super hard, so work on improvements is very slow.

Why is it “super hard”? And when you say that “work on improvements is very slow,” do you mean that development work by YOU on the decompiler itself is slow, or are you referring more to reviewing PRs and issues related to the decompiler?

@skylot

skylot commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Why is it “super hard”?

Not sure, I am working on this project since 2012 and there are still tons of issues 🤣

I'm always trying to implement some core decompiler improvements, but most of them not finished because it is hard to create a "general enough" algorithms to resolve one more case and don't break others.

@skylot

skylot commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Why is it “super hard”?

Also now I can suggest asking any AI: why java decompilation is hard and it will output tons of reasons why 🤣

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.

[feature] More automation to JADX

2 participants