summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/bytecode/MethodParameterWriter.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cuchaz/enigma/bytecode/MethodParameterWriter.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java
index a8d3983..adea7ea 100644
--- a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java
+++ b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java
@@ -15,9 +15,13 @@ import java.util.List;
15 15
16import javassist.CtBehavior; 16import javassist.CtBehavior;
17import javassist.CtClass; 17import javassist.CtClass;
18import javassist.CtConstructor;
19import javassist.CtMethod;
18import javassist.bytecode.Descriptor; 20import javassist.bytecode.Descriptor;
19import cuchaz.enigma.mapping.ArgumentEntry; 21import cuchaz.enigma.mapping.ArgumentEntry;
22import cuchaz.enigma.mapping.BehaviorEntry;
20import cuchaz.enigma.mapping.ClassEntry; 23import cuchaz.enigma.mapping.ClassEntry;
24import cuchaz.enigma.mapping.ConstructorEntry;
21import cuchaz.enigma.mapping.MethodEntry; 25import cuchaz.enigma.mapping.MethodEntry;
22import cuchaz.enigma.mapping.Translator; 26import cuchaz.enigma.mapping.Translator;
23 27
@@ -42,12 +46,26 @@ public class MethodParameterWriter
42 continue; 46 continue;
43 } 47 }
44 48
49 // get the behavior entry
50 BehaviorEntry behaviorEntry;
51 if( behavior instanceof CtMethod )
52 {
53 behaviorEntry = new MethodEntry( classEntry, behavior.getMethodInfo().getName(), behavior.getSignature() );
54 }
55 else if( behavior instanceof CtConstructor )
56 {
57 behaviorEntry = new ConstructorEntry( classEntry, behavior.getSignature() );
58 }
59 else
60 {
61 throw new Error( "Unsupported behavior type: " + behavior.getClass().getName() );
62 }
63
45 // get the list of parameter names 64 // get the list of parameter names
46 MethodEntry methodEntry = new MethodEntry( classEntry, behavior.getMethodInfo().getName(), behavior.getSignature() );
47 List<String> names = new ArrayList<String>( numParams ); 65 List<String> names = new ArrayList<String>( numParams );
48 for( int i=0; i<numParams; i++ ) 66 for( int i=0; i<numParams; i++ )
49 { 67 {
50 names.add( m_translator.translate( new ArgumentEntry( methodEntry, i, "" ) ) ); 68 names.add( m_translator.translate( new ArgumentEntry( behaviorEntry, i, "" ) ) );
51 } 69 }
52 70
53 // save the mappings to the class 71 // save the mappings to the class