diff options
Diffstat (limited to 'src/cuchaz/enigma/bytecode/ClassTranslator.java')
| -rw-r--r-- | src/cuchaz/enigma/bytecode/ClassTranslator.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cuchaz/enigma/bytecode/ClassTranslator.java b/src/cuchaz/enigma/bytecode/ClassTranslator.java index 4167731..94ab2c4 100644 --- a/src/cuchaz/enigma/bytecode/ClassTranslator.java +++ b/src/cuchaz/enigma/bytecode/ClassTranslator.java | |||
| @@ -26,7 +26,6 @@ import cuchaz.enigma.mapping.BehaviorEntry; | |||
| 26 | import cuchaz.enigma.mapping.ClassEntry; | 26 | import cuchaz.enigma.mapping.ClassEntry; |
| 27 | import cuchaz.enigma.mapping.EntryFactory; | 27 | import cuchaz.enigma.mapping.EntryFactory; |
| 28 | import cuchaz.enigma.mapping.FieldEntry; | 28 | import cuchaz.enigma.mapping.FieldEntry; |
| 29 | import cuchaz.enigma.mapping.MethodEntry; | ||
| 30 | import cuchaz.enigma.mapping.Signature; | 29 | import cuchaz.enigma.mapping.Signature; |
| 31 | import cuchaz.enigma.mapping.Translator; | 30 | import cuchaz.enigma.mapping.Translator; |
| 32 | import cuchaz.enigma.mapping.Type; | 31 | import cuchaz.enigma.mapping.Type; |
| @@ -101,26 +100,30 @@ public class ClassTranslator { | |||
| 101 | } | 100 | } |
| 102 | 101 | ||
| 103 | // translate the type | 102 | // translate the type |
| 104 | Type translatedType = m_translator.translateType(new Type(field.getFieldInfo().getDescriptor())); | 103 | Type translatedType = m_translator.translateType(entry.getType()); |
| 105 | field.getFieldInfo().setDescriptor(translatedType.toString()); | 104 | field.getFieldInfo().setDescriptor(translatedType.toString()); |
| 106 | } | 105 | } |
| 107 | 106 | ||
| 108 | // translate all the methods and constructors | 107 | // translate all the methods and constructors |
| 109 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { | 108 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { |
| 109 | |||
| 110 | BehaviorEntry entry = EntryFactory.getBehaviorEntry(behavior); | ||
| 111 | |||
| 110 | if (behavior instanceof CtMethod) { | 112 | if (behavior instanceof CtMethod) { |
| 111 | CtMethod method = (CtMethod)behavior; | 113 | CtMethod method = (CtMethod)behavior; |
| 112 | 114 | ||
| 113 | // translate the name | 115 | // translate the name |
| 114 | MethodEntry entry = EntryFactory.getMethodEntry(method); | ||
| 115 | String translatedName = m_translator.translate(entry); | 116 | String translatedName = m_translator.translate(entry); |
| 116 | if (translatedName != null) { | 117 | if (translatedName != null) { |
| 117 | method.setName(translatedName); | 118 | method.setName(translatedName); |
| 118 | } | 119 | } |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | // translate the type | 122 | if (entry.getSignature() != null) { |
| 122 | Signature translatedSignature = m_translator.translateSignature(new Signature(behavior.getMethodInfo().getDescriptor())); | 123 | // translate the type |
| 123 | behavior.getMethodInfo().setDescriptor(translatedSignature.toString()); | 124 | Signature translatedSignature = m_translator.translateSignature(entry.getSignature()); |
| 125 | behavior.getMethodInfo().setDescriptor(translatedSignature.toString()); | ||
| 126 | } | ||
| 124 | } | 127 | } |
| 125 | 128 | ||
| 126 | // translate all the class names referenced in the code | 129 | // translate all the class names referenced in the code |
| @@ -137,7 +140,7 @@ public class ClassTranslator { | |||
| 137 | // translate the source file attribute too | 140 | // translate the source file attribute too |
| 138 | ClassEntry deobfClassEntry = map.get(classEntry); | 141 | ClassEntry deobfClassEntry = map.get(classEntry); |
| 139 | if (deobfClassEntry != null) { | 142 | if (deobfClassEntry != null) { |
| 140 | String sourceFile = Descriptor.toJvmName(deobfClassEntry.getOuterClassName()) + ".java"; | 143 | String sourceFile = Descriptor.toJvmName(deobfClassEntry.getOutermostClassName()) + ".java"; |
| 141 | c.getClassFile().addAttribute(new SourceFileAttribute(constants, sourceFile)); | 144 | c.getClassFile().addAttribute(new SourceFileAttribute(constants, sourceFile)); |
| 142 | } | 145 | } |
| 143 | } | 146 | } |