From 96ba0ab422d7f9747e93461524991cf5ceeb48c4 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 19 Mar 2015 02:20:32 -0400 Subject: fix issue with naming method arguments and the local variable tables --- src/cuchaz/enigma/bytecode/MethodParameterWriter.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/cuchaz/enigma/bytecode/MethodParameterWriter.java') diff --git a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java index f64ca02..87c9196 100644 --- a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java +++ b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java @@ -15,6 +15,8 @@ import java.util.List; import javassist.CtBehavior; import javassist.CtClass; +import javassist.bytecode.CodeAttribute; +import javassist.bytecode.LocalVariableAttribute; import cuchaz.enigma.mapping.ArgumentEntry; import cuchaz.enigma.mapping.BehaviorEntry; import cuchaz.enigma.mapping.EntryFactory; @@ -33,6 +35,15 @@ public class MethodParameterWriter { // Procyon will read method arguments from the "MethodParameters" attribute, so write those for (CtBehavior behavior : c.getDeclaredBehaviors()) { + + // if there's a local variable table here, don't write a MethodParameters attribute + // let the local variable writer deal with it instead + // procyon starts doing really weird things if we give it both attributes + CodeAttribute codeAttribute = behavior.getMethodInfo().getCodeAttribute(); + if (codeAttribute != null && codeAttribute.getAttribute(LocalVariableAttribute.tag) != null) { + continue; + } + BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); // get the number of arguments @@ -53,6 +64,9 @@ public class MethodParameterWriter { } // save the mappings to the class + for (String name : names) { + System.out.println("\t" + name); + } MethodParametersAttribute.updateClass(behavior.getMethodInfo(), names); } } -- cgit v1.2.3