File tree Expand file tree Collapse file tree
main/java/jadx/plugins/example
test/java/jadx/plugins/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ root = true
2+
3+ [* ]
4+ end_of_line = lf
5+ insert_final_newline = true
6+
7+ indent_style = tab
8+ tab_width = 4
9+
10+ charset = utf-8
11+ trim_trailing_whitespace = true
12+
13+ [* .java ]
14+ ij_java_continuation_indent_size = 8
15+ ij_java_use_single_class_imports = true
16+ ij_java_class_count_to_use_import_on_demand = 99
17+ ij_java_names_count_to_use_import_on_demand = 99
18+ ij_java_packages_to_use_import_on_demand = *
19+
20+ [* .yml ]
21+ indent_style = space
22+ indent_size = 2
23+
24+ [* .bat ]
25+ end_of_line = crlf
Original file line number Diff line number Diff line change 1010
1111public class AddCommentPass implements JadxDecompilePass {
1212
13+ private String comment ;
14+
1315 @ Override
1416 public JadxPassInfo getInfo () {
1517 return new OrderedJadxPassInfo (
1618 "AddComment" ,
1719 "Add comment for every class" )
18- .before ("RegionMakerVisitor" );
20+ .before ("RegionMakerVisitor" );
1921 }
2022
2123 @ Override
2224 public void init (RootNode root ) {
25+ this .comment = "Class generated by jadx decompiler (" + Jadx .getVersion () + ")" ;
2326 }
2427
2528 @ Override
2629 public boolean visit (ClassNode cls ) {
27- cls .addCodeComment ("Class generated by jadx decompiler" );
30+ cls .addCodeComment (comment );
2831 return false ;
2932 }
3033
Original file line number Diff line number Diff line change 88import static jadx .api .plugins .options .impl .JadxOptionDescription .booleanOption ;
99
1010public class ExampleOptions extends BaseOptionsParser {
11- public static final String ENABLE_OPTION = JadxExamplePlugin .PLUGIN_ID + ".enable" ;
11+ public static final String ENABLE_OPTION = JadxExamplePlugin .PLUGIN_ID + ".enable" ;
1212
13- private boolean enable = true ;
13+ private boolean enable = true ;
1414
15- @ Override
16- public void parseOptions () {
17- enable = getBooleanOption (ENABLE_OPTION , true );
18- }
15+ @ Override
16+ public void parseOptions () {
17+ enable = getBooleanOption (ENABLE_OPTION , true );
18+ }
1919
20- @ Override
21- public List <OptionDescription > getOptionsDescriptions () {
22- return List .of (booleanOption (ENABLE_OPTION , "enable comment" , true ));
23- }
20+ @ Override
21+ public List <OptionDescription > getOptionsDescriptions () {
22+ return List .of (booleanOption (ENABLE_OPTION , "enable comment" , true ));
23+ }
2424
25- public boolean isEnable () {
26- return enable ;
27- }
25+ public boolean isEnable () {
26+ return enable ;
27+ }
28+
29+ @ Override
30+ public String toString () {
31+ return "ExampleOptions{enable=" + enable + '}' ;
32+ }
2833}
Original file line number Diff line number Diff line change @@ -20,5 +20,6 @@ public void init(JadxPluginContext context) {
2020 if (options .isEnable ()) {
2121 context .addPass (new AddCommentPass ());
2222 }
23+ context .registerInputsHashSupplier (options ::toString );
2324 }
2425}
Original file line number Diff line number Diff line change 11package jadx .plugins .example ;
22
3- import java .io .File ;
4- import java .net .URISyntaxException ;
5- import java .net .URL ;
6-
7- import org .junit .jupiter .api .Test ;
8-
93import jadx .api .JadxArgs ;
104import jadx .api .JadxDecompiler ;
115import jadx .api .JavaClass ;
6+ import org .junit .jupiter .api .Test ;
7+
8+ import java .io .File ;
9+ import java .net .URISyntaxException ;
10+ import java .net .URL ;
1211
1312import static org .assertj .core .api .Assertions .assertThat ;
1413
You can’t perform that action at this time.
0 commit comments