summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/bytecode/MethodParameterWriter.java
diff options
context:
space:
mode:
authorGravatar jeff2015-03-19 02:20:32 -0400
committerGravatar jeff2015-03-19 02:20:32 -0400
commit96ba0ab422d7f9747e93461524991cf5ceeb48c4 (patch)
treecd9504acae257575e0a354e79386da67acd796c6 /src/cuchaz/enigma/bytecode/MethodParameterWriter.java
parentAdded tag v0.10 beta for changeset 68f12fd9afb0 (diff)
downloadenigma-fork-96ba0ab422d7f9747e93461524991cf5ceeb48c4.tar.gz
enigma-fork-96ba0ab422d7f9747e93461524991cf5ceeb48c4.tar.xz
enigma-fork-96ba0ab422d7f9747e93461524991cf5ceeb48c4.zip
fix issue with naming method arguments and the local variable tables
Diffstat (limited to '')
-rw-r--r--src/cuchaz/enigma/bytecode/MethodParameterWriter.java14
1 files changed, 14 insertions, 0 deletions
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;
15 15
16import javassist.CtBehavior; 16import javassist.CtBehavior;
17import javassist.CtClass; 17import javassist.CtClass;
18import javassist.bytecode.CodeAttribute;
19import javassist.bytecode.LocalVariableAttribute;
18import cuchaz.enigma.mapping.ArgumentEntry; 20import cuchaz.enigma.mapping.ArgumentEntry;
19import cuchaz.enigma.mapping.BehaviorEntry; 21import cuchaz.enigma.mapping.BehaviorEntry;
20import cuchaz.enigma.mapping.EntryFactory; 22import cuchaz.enigma.mapping.EntryFactory;
@@ -33,6 +35,15 @@ public class MethodParameterWriter {
33 35
34 // Procyon will read method arguments from the "MethodParameters" attribute, so write those 36 // Procyon will read method arguments from the "MethodParameters" attribute, so write those
35 for (CtBehavior behavior : c.getDeclaredBehaviors()) { 37 for (CtBehavior behavior : c.getDeclaredBehaviors()) {
38
39 // if there's a local variable table here, don't write a MethodParameters attribute
40 // let the local variable writer deal with it instead
41 // procyon starts doing really weird things if we give it both attributes
42 CodeAttribute codeAttribute = behavior.getMethodInfo().getCodeAttribute();
43 if (codeAttribute != null && codeAttribute.getAttribute(LocalVariableAttribute.tag) != null) {
44 continue;
45 }
46
36 BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); 47 BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior);
37 48
38 // get the number of arguments 49 // get the number of arguments
@@ -53,6 +64,9 @@ public class MethodParameterWriter {
53 } 64 }
54 65
55 // save the mappings to the class 66 // save the mappings to the class
67 for (String name : names) {
68 System.out.println("\t" + name);
69 }
56 MethodParametersAttribute.updateClass(behavior.getMethodInfo(), names); 70 MethodParametersAttribute.updateClass(behavior.getMethodInfo(), names);
57 } 71 }
58 } 72 }