add_comment
Add persistent comments to decompiled classes, methods, fields, or source lines in JADX-GUI to document reverse-engineering findings and make annotations searchable later.
Instructions
Add a comment to decompiled code, shown in JADX-GUI and saved with the project.
Comment a class by passing only class_name, a method by also passing method_name (use method_signature such as '(I)V' to pick between overloads), or a field by passing field_name.
To comment a code line, pass line=N, the 1-based line number in the decompiled source of that class; get it from get_class_source(with_line_numbers=True) rather than counting lines. The comment is appended to the end of that line, and on a class, method or field declaration line it comments that declaration instead, matching what the comment shortcut does in JADX-GUI. Braces and blank lines have nothing to comment and are rejected, listing the nearest lines that work. Line numbers shift once a comment is added above, so re-read the source before addressing another line.
Every write is verified against the freshly decompiled code and the response echoes the rendered line, so there is no need to read the class back to check. A comment that does not render is rolled back and returns an error rather than being silently stored, which JADX itself does not detect.
A new comment on the same target replaces the previous one, so annotations can be refined without creating duplicates, and passing an empty comment removes it. style is one of LINE, BLOCK, BLOCK_CONDENSED, JAVADOC or JAVADOC_CONDENSED (default: LINE).
Use this to record what a class or method actually does while reverse engineering: the comments persist in the JADX project and are searchable later with search_classes_by_keyword(search_in="comment").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | ||
| style | No | LINE | |
| comment | Yes | ||
| class_name | Yes | ||
| field_name | No | ||
| method_name | No | ||
| method_signature | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||