diff options
| author | 2015-02-09 22:23:45 -0500 | |
|---|---|---|
| committer | 2015-02-09 22:23:45 -0500 | |
| commit | af1041731c8c0ce1846ff7e7b6052ed7327a5dbc (patch) | |
| tree | e781b93f526a6c1ba7b6f5e14c319450199aa1df /src/cuchaz/enigma/bytecode | |
| parent | Don't automatically move mappings around. We're more interested in stability ... (diff) | |
| download | enigma-fork-af1041731c8c0ce1846ff7e7b6052ed7327a5dbc.tar.gz enigma-fork-af1041731c8c0ce1846ff7e7b6052ed7327a5dbc.tar.xz enigma-fork-af1041731c8c0ce1846ff7e7b6052ed7327a5dbc.zip | |
fix translation issues, particularly with fields
Diffstat (limited to 'src/cuchaz/enigma/bytecode')
| -rw-r--r-- | src/cuchaz/enigma/bytecode/ClassTranslator.java | 9 | ||||
| -rw-r--r-- | src/cuchaz/enigma/bytecode/MethodParameterWriter.java | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/cuchaz/enigma/bytecode/ClassTranslator.java b/src/cuchaz/enigma/bytecode/ClassTranslator.java index 4dba0d8..4167731 100644 --- a/src/cuchaz/enigma/bytecode/ClassTranslator.java +++ b/src/cuchaz/enigma/bytecode/ClassTranslator.java | |||
| @@ -23,10 +23,9 @@ import javassist.bytecode.SourceFileAttribute; | |||
| 23 | import com.google.common.collect.Maps; | 23 | import com.google.common.collect.Maps; |
| 24 | 24 | ||
| 25 | import cuchaz.enigma.mapping.BehaviorEntry; | 25 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 26 | import cuchaz.enigma.mapping.BehaviorEntryFactory; | ||
| 27 | import cuchaz.enigma.mapping.ClassEntry; | 26 | import cuchaz.enigma.mapping.ClassEntry; |
| 27 | import cuchaz.enigma.mapping.EntryFactory; | ||
| 28 | import cuchaz.enigma.mapping.FieldEntry; | 28 | import cuchaz.enigma.mapping.FieldEntry; |
| 29 | import cuchaz.enigma.mapping.JavassistUtil; | ||
| 30 | import cuchaz.enigma.mapping.MethodEntry; | 29 | import cuchaz.enigma.mapping.MethodEntry; |
| 31 | import cuchaz.enigma.mapping.Signature; | 30 | import cuchaz.enigma.mapping.Signature; |
| 32 | import cuchaz.enigma.mapping.Translator; | 31 | import cuchaz.enigma.mapping.Translator; |
| @@ -74,7 +73,7 @@ public class ClassTranslator { | |||
| 74 | case ConstPool.CONST_InterfaceMethodref: { | 73 | case ConstPool.CONST_InterfaceMethodref: { |
| 75 | 74 | ||
| 76 | // translate the name and type | 75 | // translate the name and type |
| 77 | BehaviorEntry entry = BehaviorEntryFactory.create( | 76 | BehaviorEntry entry = EntryFactory.getBehaviorEntry( |
| 78 | Descriptor.toJvmName(editor.getMemberrefClassname(i)), | 77 | Descriptor.toJvmName(editor.getMemberrefClassname(i)), |
| 79 | editor.getMemberrefName(i), | 78 | editor.getMemberrefName(i), |
| 80 | editor.getMemberrefType(i) | 79 | editor.getMemberrefType(i) |
| @@ -95,7 +94,7 @@ public class ClassTranslator { | |||
| 95 | for (CtField field : c.getDeclaredFields()) { | 94 | for (CtField field : c.getDeclaredFields()) { |
| 96 | 95 | ||
| 97 | // translate the name | 96 | // translate the name |
| 98 | FieldEntry entry = JavassistUtil.getFieldEntry(field); | 97 | FieldEntry entry = EntryFactory.getFieldEntry(field); |
| 99 | String translatedName = m_translator.translate(entry); | 98 | String translatedName = m_translator.translate(entry); |
| 100 | if (translatedName != null) { | 99 | if (translatedName != null) { |
| 101 | field.setName(translatedName); | 100 | field.setName(translatedName); |
| @@ -112,7 +111,7 @@ public class ClassTranslator { | |||
| 112 | CtMethod method = (CtMethod)behavior; | 111 | CtMethod method = (CtMethod)behavior; |
| 113 | 112 | ||
| 114 | // translate the name | 113 | // translate the name |
| 115 | MethodEntry entry = JavassistUtil.getMethodEntry(method); | 114 | MethodEntry entry = EntryFactory.getMethodEntry(method); |
| 116 | String translatedName = m_translator.translate(entry); | 115 | String translatedName = m_translator.translate(entry); |
| 117 | if (translatedName != null) { | 116 | if (translatedName != null) { |
| 118 | method.setName(translatedName); | 117 | method.setName(translatedName); |
diff --git a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java index 853928c..f64ca02 100644 --- a/src/cuchaz/enigma/bytecode/MethodParameterWriter.java +++ b/src/cuchaz/enigma/bytecode/MethodParameterWriter.java | |||
| @@ -17,7 +17,7 @@ import javassist.CtBehavior; | |||
| 17 | import javassist.CtClass; | 17 | import javassist.CtClass; |
| 18 | import cuchaz.enigma.mapping.ArgumentEntry; | 18 | import cuchaz.enigma.mapping.ArgumentEntry; |
| 19 | import cuchaz.enigma.mapping.BehaviorEntry; | 19 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 20 | import cuchaz.enigma.mapping.BehaviorEntryFactory; | 20 | import cuchaz.enigma.mapping.EntryFactory; |
| 21 | import cuchaz.enigma.mapping.Signature; | 21 | import cuchaz.enigma.mapping.Signature; |
| 22 | import cuchaz.enigma.mapping.Translator; | 22 | import cuchaz.enigma.mapping.Translator; |
| 23 | 23 | ||
| @@ -33,7 +33,7 @@ public class MethodParameterWriter { | |||
| 33 | 33 | ||
| 34 | // Procyon will read method arguments from the "MethodParameters" attribute, so write those | 34 | // Procyon will read method arguments from the "MethodParameters" attribute, so write those |
| 35 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { | 35 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { |
| 36 | BehaviorEntry behaviorEntry = BehaviorEntryFactory.create(behavior); | 36 | BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); |
| 37 | 37 | ||
| 38 | // get the number of arguments | 38 | // get the number of arguments |
| 39 | Signature signature = behaviorEntry.getSignature(); | 39 | Signature signature = behaviorEntry.getSignature(); |