Skip to content

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

Open
anandghegde wants to merge 1 commit into
skylot:masterfrom
anandghegde:feat/gui-copy-smali-reference
Open

anandghegde wants to merge 1 commit into
skylot:masterfrom
anandghegde:feat/gui-copy-smali-reference

Conversation

@anandghegde

Copy link
Copy Markdown

❗ 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
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.

1 participant