diff options
Diffstat (limited to 'src/main/java/cuchaz')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/EntryFactory.java | 25 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/MethodMapping.java | 17 |
2 files changed, 5 insertions, 37 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/EntryFactory.java b/src/main/java/cuchaz/enigma/mapping/EntryFactory.java index 0ac739c..3584ebb 100644 --- a/src/main/java/cuchaz/enigma/mapping/EntryFactory.java +++ b/src/main/java/cuchaz/enigma/mapping/EntryFactory.java | |||
| @@ -74,38 +74,23 @@ public class EntryFactory { | |||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | public static MethodEntry getMethodEntry(MethodCall call) { | 76 | public static MethodEntry getMethodEntry(MethodCall call) { |
| 77 | return new MethodEntry( | 77 | return new MethodEntry(new ClassEntry(Descriptor.toJvmName(call.getClassName())), call.getMethodName(), new Signature(call.getSignature())); |
| 78 | new ClassEntry(Descriptor.toJvmName(call.getClassName())), | ||
| 79 | call.getMethodName(), | ||
| 80 | new Signature(call.getSignature()) | ||
| 81 | ); | ||
| 82 | } | 78 | } |
| 83 | 79 | ||
| 84 | public static ConstructorEntry getConstructorEntry(CtConstructor constructor) { | 80 | public static ConstructorEntry getConstructorEntry(CtConstructor constructor) { |
| 85 | if (constructor.isClassInitializer()) { | 81 | if (constructor.isClassInitializer()) { |
| 86 | return new ConstructorEntry( | 82 | return new ConstructorEntry(getClassEntry(constructor.getDeclaringClass())); |
| 87 | getClassEntry(constructor.getDeclaringClass()) | ||
| 88 | ); | ||
| 89 | } else { | 83 | } else { |
| 90 | return new ConstructorEntry( | 84 | return new ConstructorEntry(getClassEntry(constructor.getDeclaringClass()), new Signature(constructor.getMethodInfo().getDescriptor())); |
| 91 | getClassEntry(constructor.getDeclaringClass()), | ||
| 92 | new Signature(constructor.getMethodInfo().getDescriptor()) | ||
| 93 | ); | ||
| 94 | } | 85 | } |
| 95 | } | 86 | } |
| 96 | 87 | ||
| 97 | public static ConstructorEntry getConstructorEntry(ConstructorCall call) { | 88 | public static ConstructorEntry getConstructorEntry(ConstructorCall call) { |
| 98 | return new ConstructorEntry( | 89 | return new ConstructorEntry(new ClassEntry(Descriptor.toJvmName(call.getClassName())), new Signature(call.getSignature())); |
| 99 | new ClassEntry(Descriptor.toJvmName(call.getClassName())), | ||
| 100 | new Signature(call.getSignature()) | ||
| 101 | ); | ||
| 102 | } | 90 | } |
| 103 | 91 | ||
| 104 | public static ConstructorEntry getConstructorEntry(NewExpr call) { | 92 | public static ConstructorEntry getConstructorEntry(NewExpr call) { |
| 105 | return new ConstructorEntry( | 93 | return new ConstructorEntry(new ClassEntry(Descriptor.toJvmName(call.getClassName())), new Signature(call.getSignature())); |
| 106 | new ClassEntry(Descriptor.toJvmName(call.getClassName())), | ||
| 107 | new Signature(call.getSignature()) | ||
| 108 | ); | ||
| 109 | } | 94 | } |
| 110 | 95 | ||
| 111 | public static BehaviorEntry getBehaviorEntry(CtBehavior behavior) { | 96 | public static BehaviorEntry getBehaviorEntry(CtBehavior behavior) { |
diff --git a/src/main/java/cuchaz/enigma/mapping/MethodMapping.java b/src/main/java/cuchaz/enigma/mapping/MethodMapping.java index ff14ccd..fbd97bd 100644 --- a/src/main/java/cuchaz/enigma/mapping/MethodMapping.java +++ b/src/main/java/cuchaz/enigma/mapping/MethodMapping.java | |||
| @@ -151,23 +151,6 @@ public class MethodMapping implements Serializable, Comparable<MethodMapping>, M | |||
| 151 | return (this.m_obfName + this.m_obfSignature).compareTo(other.m_obfName + other.m_obfSignature); | 151 | return (this.m_obfName + this.m_obfSignature).compareTo(other.m_obfName + other.m_obfSignature); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | public boolean renameObfClass(final String oldObfClassName, final String newObfClassName) { | ||
| 155 | |||
| 156 | // rename obf classes in the signature | ||
| 157 | Signature newSignature = new Signature(this.m_obfSignature, className -> { | ||
| 158 | if (className.equals(oldObfClassName)) { | ||
| 159 | return newObfClassName; | ||
| 160 | } | ||
| 161 | return null; | ||
| 162 | }); | ||
| 163 | |||
| 164 | if (!newSignature.equals(this.m_obfSignature)) { | ||
| 165 | this.m_obfSignature = newSignature; | ||
| 166 | return true; | ||
| 167 | } | ||
| 168 | return false; | ||
| 169 | } | ||
| 170 | |||
| 171 | public boolean containsArgument(String name) { | 154 | public boolean containsArgument(String name) { |
| 172 | for (ArgumentMapping argumentMapping : this.m_arguments.values()) { | 155 | for (ArgumentMapping argumentMapping : this.m_arguments.values()) { |
| 173 | if (argumentMapping.getName().equals(name)) { | 156 | if (argumentMapping.getName().equals(name)) { |