File tree Expand file tree Collapse file tree 4 files changed +61
-1
lines changed
src/main/java/club/bytecode/the/jda Expand file tree Collapse file tree 4 files changed +61
-1
lines changed Original file line number Diff line number Diff line change 44import club .bytecode .the .jda .api .JDANamespace ;
55import club .bytecode .the .jda .api .JDAPlugin ;
66import club .bytecode .the .jda .api .PluginLoader ;
7+ import club .bytecode .the .jda .decompilers .filter .DecompileFilters ;
8+ import club .bytecode .the .jda .decompilers .filter .DropLocalVariableTableFilter ;
9+ import club .bytecode .the .jda .decompilers .filter .IllegalAnnotationFilter ;
710import club .bytecode .the .jda .gui .MainViewerGUI ;
811import club .bytecode .the .jda .gui .fileviewer .BytecodeFoldParser ;
912import club .bytecode .the .jda .gui .fileviewer .BytecodeTokenizer ;
@@ -73,6 +76,7 @@ public static void main(String[] args) {
7376 System .out .println ("JDA v" + version );
7477 getJDADirectory ();
7578
79+ registerModules ();
7680 loadPlugins ();
7781
7882 Settings .loadGUI ();
@@ -102,7 +106,12 @@ public static void unloadPlugin(JDAPlugin plugin) {
102106 public static List <JDAPlugin > getLoadedPlugins () {
103107 return Collections .unmodifiableList (plugins );
104108 }
105-
109+
110+ private static void registerModules () {
111+ DecompileFilters .registerFilter (new IllegalAnnotationFilter ());
112+ DecompileFilters .registerFilter (new DropLocalVariableTableFilter ());
113+ }
114+
106115 private static void loadPlugins () throws MalformedURLException {
107116 if (autoloadPlugin != null ) {
108117 JDAPlugin plugin = autoloadPlugin .get ();
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ public class DecompileFilters {
1010
1111 public static void registerFilter (DecompileFilter filter ) {
1212 BY_NAME .put (filter .getFullName (), filter );
13+ System .out .println ("Decompile filter registered: " + filter .getFullName ());
1314 }
1415
1516 public static Collection <DecompileFilter > getAllFilters () {
Original file line number Diff line number Diff line change 1+ package club .bytecode .the .jda .decompilers .filter ;
2+
3+ import club .bytecode .the .jda .JDA ;
4+ import club .bytecode .the .jda .api .JDANamespace ;
5+ import org .objectweb .asm .tree .ClassNode ;
6+
7+ public class DropLocalVariableTableFilter implements DecompileFilter {
8+ @ Override
9+ public void process (ClassNode cn ) {
10+ cn .methods .forEach (methodNode -> methodNode .localVariables .clear ());
11+ }
12+
13+ @ Override
14+ public String getName () {
15+ return "Drop local variable table" ;
16+ }
17+
18+ @ Override
19+ public JDANamespace getNamespace () {
20+ return JDA .namespace ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package club .bytecode .the .jda .decompilers .filter ;
2+
3+ import club .bytecode .the .jda .JDA ;
4+ import club .bytecode .the .jda .api .JDANamespace ;
5+ import org .objectweb .asm .tree .ClassNode ;
6+
7+ public class IllegalAnnotationFilter implements DecompileFilter {
8+ @ Override
9+ public void process (ClassNode cn ) {
10+ cn .methods .forEach (methodNode -> {
11+ if (methodNode .invisibleAnnotations != null )
12+ methodNode .invisibleAnnotations .removeIf (node -> node .desc .equals ("@" ));
13+ });
14+
15+ if (cn .invisibleAnnotations != null )
16+ cn .invisibleAnnotations .removeIf (node -> node .desc .equals ("@" ));
17+ }
18+
19+ @ Override
20+ public String getName () {
21+ return "Kill illegal annotations" ;
22+ }
23+
24+ @ Override
25+ public JDANamespace getNamespace () {
26+ return JDA .namespace ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments