Disable linked method remapping if the option is not active.
@@ -16,6 +16,7 @@ import me.coley.event.Bus;
import me.coley.event.Listener;
import me.coley.recaf.Input;
import me.coley.recaf.Logging;
+import me.coley.recaf.config.impl.ConfASM;
import me.coley.recaf.event.ClassRenameEvent;
import me.coley.recaf.event.MethodRenameEvent;
import me.coley.recaf.event.NewInputEvent;
@@ -31,8 +32,34 @@ public class Hierarchy {
private final Map<String, MethodWrapper> methodMap = new HashMap<>();
private Hierarchy() {
+ // If the option is not enabled, this feature is disabled until a
+ // restart occurs.
+ if (ConfASM.instance().useLinkedMethodRenaming()) {
Bus.subscribe(this);
}
+ }
+
+ @Listener
+ private void onNewInput(NewInputEvent input) {
+ try {
+ // clear old values
+ classMap.clear();
+ methodMap.clear();
+ // generate new maps
+ Logging.info("Generating inheritence hierarchy");
+ Map<String, ClassNode> classes = input.get().getClasses();
+ for (String name : input.get().classes) {
+ addClass(name, classes);
+ }
+ Logging.info("Adding method hierarchy");
+ for (ClassWrapper wrapper : classMap.values()) {
+ wrapper.linkMethods();
+ }
+ Logging.info("Finished generating inheritence hierarchy");
+ } catch (Exception e) {
+ Logging.error(e);
+ }
+ }
@Listener
private void onClassRename(ClassRenameEvent rename) {
@@ -65,28 +92,6 @@ public class Hierarchy {
methodMap.put(keyReplace, cw);
}
- @Listener
- private void onNewInput(NewInputEvent input) {
- try {
- // clear old values
- classMap.clear();
- methodMap.clear();
- // generate new maps
- Logging.info("Generating inheritence hierarchy");
- Map<String, ClassNode> classes = input.get().getClasses();
- for (String name : input.get().classes) {
- addClass(name, classes);
- }
- Logging.info("Adding method hierarchy");
- for (ClassWrapper wrapper : classMap.values()) {
- wrapper.linkMethods();
- }
- Logging.info("Finished generating inheritence hierarchy");
- } catch (Exception e) {
- Logging.error(e);
- }
- }
-
/**
* Add class to class-map.
*
