Skip to content

feat(gui): add "copy as smali reference" to context menu - #2955

Merged
skylot merged 1 commit into
skylot:masterfrom
anandghegde:feat/gui-copy-smali-reference
Oct 3, 2026
Merged

skylot merged 1 commit into
skylot:masterfrom
anandghegde:feat/gui-copy-smali-reference

Conversation

@anandghegde

Copy link
Copy Markdown
Contributor

❗ Please review the guidelines for contributing

Description

Adds a Copy as smali reference item to the code area context menu (next to "Copy Reference" from #2863). It copies the original (not renamed) Dalvik descriptor of the class, method or field under the caret:

Node Copied text
class Lcom/example/Outer$Inner;
method Lcom/example/Outer$Inner;->method(I[Ljava/lang/String;)V
ctor Lcom/example/Outer$Inner;-><init>(JLjava/lang/Object;)V
field Lcom/example/Outer$Inner;->names:[[Ljava/lang/String;

This is the format used in smali files, apktool/baksmali patching, and hooking tools, and it is what JEB's "copy signature" gives you. Right now in jadx you have to put it together by hand from the smali view, which is slow and easy to get wrong once code is deobfuscated or renamed.

Implementation notes:

  • The formatting reuses the existing core helpers (TypeGen.signature, MethodInfo.getShortId) and reads the raw ClassInfo/MethodInfo/FieldInfo, so user renames and deobfuscation aliases are ignored.
  • The file set follows feat: add "copy reference" to context menu #2863: ActionModel entry, action class, CodeArea popup registration, and the i18n key in all Messages_*.properties files (commented English in the non-English files).
  • No default shortcut is assigned, to avoid taking another single-key binding in the code area. Users can set one in preferences.

Testing

  • New jadx.gui.ui.action.CopySmaliReferenceActionTest (based on IntegrationTest) checks the output for an outer class and a nested $Inner class, a constructor <init>, primitive and array arguments/returns (I, J, [Ljava/lang/String;, [Z), fields (I, [[Ljava/lang/String;), and that a renamed class/method still produces the original descriptor.
  • ./gradlew :jadx-gui:test: 52 tests, 0 failures (2 skipped, same as before), including TestI18n.
  • ./gradlew :jadx-gui:spotlessCheck :jadx-gui:checkstyleMain :jadx-gui:checkstyleTest: passed.

I used Claude Code to help write this change. I reviewed the code and tests myself.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QBWFWqjbUQGS1c9LsM2bxX

Copy original class/method/field reference in smali format,
e.g. `Lcom/example/Cls$Inner;->method(I[Ljava/lang/String;)V`.
@anandghegde
anandghegde force-pushed the feat/gui-copy-smali-reference branch from 8eb0d3c to c3cbc17 Compare September 15, 2026 16:40

@skylot skylot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice, thanks

@skylot
skylot merged commit 4a0ab2c into skylot:master Oct 3, 2026
2 checks passed
@nitanmarcel

Copy link
Copy Markdown
Contributor

Goes perfect with this xD

IMG_20261003_221156_259

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.

3 participants