diff options
| author | 2016-07-02 20:13:13 +1000 | |
|---|---|---|
| committer | 2016-07-02 20:13:13 +1000 | |
| commit | 74edc74c2c7b3236f00bf92499bb884837673b7d (patch) | |
| tree | 155556b4d6e390574f16082583f2853e35e3c716 /src/main/java/cuchaz/enigma/mapping | |
| parent | Renamed Fields (diff) | |
| download | enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.gz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.xz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.zip | |
Reformatting code
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping')
13 files changed, 52 insertions, 88 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java b/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java index 886e7be..c89f7e3 100644 --- a/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/ArgumentEntry.java | |||
| @@ -97,10 +97,7 @@ public class ArgumentEntry implements Entry, Serializable { | |||
| 97 | 97 | ||
| 98 | @Override | 98 | @Override |
| 99 | public boolean equals(Object other) { | 99 | public boolean equals(Object other) { |
| 100 | if (other instanceof ArgumentEntry) { | 100 | return other instanceof ArgumentEntry && equals((ArgumentEntry) other); |
| 101 | return equals((ArgumentEntry) other); | ||
| 102 | } | ||
| 103 | return false; | ||
| 104 | } | 101 | } |
| 105 | 102 | ||
| 106 | public boolean equals(ArgumentEntry other) { | 103 | public boolean equals(ArgumentEntry other) { |
diff --git a/src/main/java/cuchaz/enigma/mapping/ClassMapping.java b/src/main/java/cuchaz/enigma/mapping/ClassMapping.java index 84fb6dd..99e463d 100644 --- a/src/main/java/cuchaz/enigma/mapping/ClassMapping.java +++ b/src/main/java/cuchaz/enigma/mapping/ClassMapping.java | |||
| @@ -444,10 +444,7 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping> { | |||
| 444 | 444 | ||
| 445 | public boolean containsArgument(BehaviorEntry obfBehaviorEntry, String name) { | 445 | public boolean containsArgument(BehaviorEntry obfBehaviorEntry, String name) { |
| 446 | MethodMapping methodMapping = m_methodsByObf.get(getMethodKey(obfBehaviorEntry.getName(), obfBehaviorEntry.getSignature())); | 446 | MethodMapping methodMapping = m_methodsByObf.get(getMethodKey(obfBehaviorEntry.getName(), obfBehaviorEntry.getSignature())); |
| 447 | if (methodMapping != null) { | 447 | return methodMapping != null && methodMapping.containsArgument(name); |
| 448 | return methodMapping.containsArgument(name); | ||
| 449 | } | ||
| 450 | return false; | ||
| 451 | } | 448 | } |
| 452 | 449 | ||
| 453 | public static boolean isSimpleClassName(String name) { | 450 | public static boolean isSimpleClassName(String name) { |
diff --git a/src/main/java/cuchaz/enigma/mapping/ConstructorEntry.java b/src/main/java/cuchaz/enigma/mapping/ConstructorEntry.java index 907bd4c..ac1a7f2 100644 --- a/src/main/java/cuchaz/enigma/mapping/ConstructorEntry.java +++ b/src/main/java/cuchaz/enigma/mapping/ConstructorEntry.java | |||
| @@ -87,10 +87,7 @@ public class ConstructorEntry implements BehaviorEntry, Serializable { | |||
| 87 | 87 | ||
| 88 | @Override | 88 | @Override |
| 89 | public boolean equals(Object other) { | 89 | public boolean equals(Object other) { |
| 90 | if (other instanceof ConstructorEntry) { | 90 | return other instanceof ConstructorEntry && equals((ConstructorEntry) other); |
| 91 | return equals((ConstructorEntry) other); | ||
| 92 | } | ||
| 93 | return false; | ||
| 94 | } | 91 | } |
| 95 | 92 | ||
| 96 | public boolean equals(ConstructorEntry other) { | 93 | public boolean equals(ConstructorEntry other) { |
diff --git a/src/main/java/cuchaz/enigma/mapping/FieldMapping.java b/src/main/java/cuchaz/enigma/mapping/FieldMapping.java index 3f5a382..19d68a9 100644 --- a/src/main/java/cuchaz/enigma/mapping/FieldMapping.java +++ b/src/main/java/cuchaz/enigma/mapping/FieldMapping.java | |||
| @@ -16,67 +16,64 @@ public class FieldMapping implements Serializable, Comparable<FieldMapping>, Mem | |||
| 16 | 16 | ||
| 17 | private static final long serialVersionUID = 8610742471440861315L; | 17 | private static final long serialVersionUID = 8610742471440861315L; |
| 18 | 18 | ||
| 19 | private String m_obfName; | 19 | private String obfName; |
| 20 | private String m_deobfName; | 20 | private String deobfName; |
| 21 | private Type m_obfType; | 21 | private Type obfType; |
| 22 | 22 | ||
| 23 | public FieldMapping(String obfName, Type obfType, String deobfName) { | 23 | public FieldMapping(String obfName, Type obfType, String deobfName) { |
| 24 | m_obfName = obfName; | 24 | this.obfName = obfName; |
| 25 | m_deobfName = NameValidator.validateFieldName(deobfName); | 25 | this.deobfName = NameValidator.validateFieldName(deobfName); |
| 26 | m_obfType = obfType; | 26 | this.obfType = obfType; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | public FieldMapping(FieldMapping other, ClassNameReplacer obfClassNameReplacer) { | 29 | public FieldMapping(FieldMapping other, ClassNameReplacer obfClassNameReplacer) { |
| 30 | m_obfName = other.m_obfName; | 30 | this.obfName = other.obfName; |
| 31 | m_deobfName = other.m_deobfName; | 31 | this.deobfName = other.deobfName; |
| 32 | m_obfType = new Type(other.m_obfType, obfClassNameReplacer); | 32 | this.obfType = new Type(other.obfType, obfClassNameReplacer); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | @Override | 35 | @Override |
| 36 | public String getObfName() { | 36 | public String getObfName() { |
| 37 | return m_obfName; | 37 | return this.obfName; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | public void setObfName(String val) { | 40 | public void setObfName(String val) { |
| 41 | m_obfName = NameValidator.validateFieldName(val); | 41 | this.obfName = NameValidator.validateFieldName(val); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public String getDeobfName() { | 44 | public String getDeobfName() { |
| 45 | return m_deobfName; | 45 | return this.deobfName; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | public void setDeobfName(String val) { | 48 | public void setDeobfName(String val) { |
| 49 | m_deobfName = NameValidator.validateFieldName(val); | 49 | this.deobfName = NameValidator.validateFieldName(val); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | public Type getObfType() { | 52 | public Type getObfType() { |
| 53 | return m_obfType; | 53 | return this.obfType; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | public void setObfType(Type val) { | 56 | public void setObfType(Type val) { |
| 57 | m_obfType = val; | 57 | this.obfType = val; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | @Override | 60 | @Override |
| 61 | public int compareTo(FieldMapping other) { | 61 | public int compareTo(FieldMapping other) { |
| 62 | return (m_obfName + m_obfType).compareTo(other.m_obfName + other.m_obfType); | 62 | return (this.obfName + this.obfType).compareTo(other.obfName + other.obfType); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | public boolean renameObfClass(final String oldObfClassName, final String newObfClassName) { | 65 | public boolean renameObfClass(final String oldObfClassName, final String newObfClassName) { |
| 66 | 66 | ||
| 67 | // rename obf classes in the type | 67 | // rename obf classes in the type |
| 68 | Type newType = new Type(m_obfType, new ClassNameReplacer() { | 68 | Type newType = new Type(this.obfType, className -> { |
| 69 | @Override | 69 | if (className.equals(oldObfClassName)) { |
| 70 | public String replace(String className) { | 70 | return newObfClassName; |
| 71 | if (className.equals(oldObfClassName)) { | ||
| 72 | return newObfClassName; | ||
| 73 | } | ||
| 74 | return null; | ||
| 75 | } | 71 | } |
| 72 | return null; | ||
| 76 | }); | 73 | }); |
| 77 | 74 | ||
| 78 | if (!newType.equals(m_obfType)) { | 75 | if (!newType.equals(this.obfType)) { |
| 79 | m_obfType = newType; | 76 | this.obfType = newType; |
| 80 | return true; | 77 | return true; |
| 81 | } | 78 | } |
| 82 | return false; | 79 | return false; |
| @@ -84,6 +81,6 @@ public class FieldMapping implements Serializable, Comparable<FieldMapping>, Mem | |||
| 84 | 81 | ||
| 85 | @Override | 82 | @Override |
| 86 | public FieldEntry getObfEntry(ClassEntry classEntry) { | 83 | public FieldEntry getObfEntry(ClassEntry classEntry) { |
| 87 | return new FieldEntry(classEntry, m_obfName, new Type(m_obfType)); | 84 | return new FieldEntry(classEntry, this.obfName, new Type(this.obfType)); |
| 88 | } | 85 | } |
| 89 | } | 86 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsChecker.java b/src/main/java/cuchaz/enigma/mapping/MappingsChecker.java index 5e2b40b..d850787 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsChecker.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsChecker.java | |||
| @@ -16,13 +16,11 @@ import com.google.common.collect.Maps; | |||
| 16 | import java.util.Map; | 16 | import java.util.Map; |
| 17 | 17 | ||
| 18 | import cuchaz.enigma.analysis.JarIndex; | 18 | import cuchaz.enigma.analysis.JarIndex; |
| 19 | import cuchaz.enigma.analysis.RelatedMethodChecker; | ||
| 20 | 19 | ||
| 21 | 20 | ||
| 22 | public class MappingsChecker { | 21 | public class MappingsChecker { |
| 23 | 22 | ||
| 24 | private JarIndex m_index; | 23 | private JarIndex m_index; |
| 25 | private RelatedMethodChecker m_relatedMethodChecker; | ||
| 26 | private Map<ClassEntry, ClassMapping> m_droppedClassMappings; | 24 | private Map<ClassEntry, ClassMapping> m_droppedClassMappings; |
| 27 | private Map<ClassEntry, ClassMapping> m_droppedInnerClassMappings; | 25 | private Map<ClassEntry, ClassMapping> m_droppedInnerClassMappings; |
| 28 | private Map<FieldEntry, FieldMapping> m_droppedFieldMappings; | 26 | private Map<FieldEntry, FieldMapping> m_droppedFieldMappings; |
| @@ -30,17 +28,12 @@ public class MappingsChecker { | |||
| 30 | 28 | ||
| 31 | public MappingsChecker(JarIndex index) { | 29 | public MappingsChecker(JarIndex index) { |
| 32 | m_index = index; | 30 | m_index = index; |
| 33 | m_relatedMethodChecker = new RelatedMethodChecker(m_index); | ||
| 34 | m_droppedClassMappings = Maps.newHashMap(); | 31 | m_droppedClassMappings = Maps.newHashMap(); |
| 35 | m_droppedInnerClassMappings = Maps.newHashMap(); | 32 | m_droppedInnerClassMappings = Maps.newHashMap(); |
| 36 | m_droppedFieldMappings = Maps.newHashMap(); | 33 | m_droppedFieldMappings = Maps.newHashMap(); |
| 37 | m_droppedMethodMappings = Maps.newHashMap(); | 34 | m_droppedMethodMappings = Maps.newHashMap(); |
| 38 | } | 35 | } |
| 39 | 36 | ||
| 40 | public RelatedMethodChecker getRelatedMethodChecker() { | ||
| 41 | return m_relatedMethodChecker; | ||
| 42 | } | ||
| 43 | |||
| 44 | public Map<ClassEntry, ClassMapping> getDroppedClassMappings() { | 37 | public Map<ClassEntry, ClassMapping> getDroppedClassMappings() { |
| 45 | return m_droppedClassMappings; | 38 | return m_droppedClassMappings; |
| 46 | } | 39 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsReader.java b/src/main/java/cuchaz/enigma/mapping/MappingsReader.java index b2c3a5c..d1edb9b 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsReader.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsReader.java | |||
| @@ -31,19 +31,21 @@ public class MappingsReader { | |||
| 31 | public void readDirectory(Mappings mappings, File in) throws IOException, MappingParseException { | 31 | public void readDirectory(Mappings mappings, File in) throws IOException, MappingParseException { |
| 32 | 32 | ||
| 33 | File[] fList = in.listFiles(); | 33 | File[] fList = in.listFiles(); |
| 34 | for (File file : fList) { | 34 | if (fList != null) { |
| 35 | if (file.isFile()) { | 35 | for (File file : fList) { |
| 36 | readFile(mappings, new BufferedReader(new FileReader(file))); | 36 | if (file.isFile()) { |
| 37 | } else if (file.isDirectory()) { | 37 | readFile(mappings, new BufferedReader(new FileReader(file))); |
| 38 | readDirectory(mappings, file.getAbsoluteFile()); | 38 | } else if (file.isDirectory()) { |
| 39 | readDirectory(mappings, file.getAbsoluteFile()); | ||
| 40 | } | ||
| 39 | } | 41 | } |
| 40 | } | 42 | } |
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | public void readFile(Mappings mappings, BufferedReader in) throws IOException, MappingParseException { | 45 | public void readFile(Mappings mappings, BufferedReader in) throws IOException, MappingParseException { |
| 44 | 46 | ||
| 45 | StringBuffer buf = new StringBuffer(); | 47 | StringBuilder buf = new StringBuilder(); |
| 46 | String line = null; | 48 | String line; |
| 47 | while ((line = in.readLine()) != null) { | 49 | while ((line = in.readLine()) != null) { |
| 48 | buf.append(line); | 50 | buf.append(line); |
| 49 | } | 51 | } |
| @@ -63,10 +65,10 @@ public class MappingsReader { | |||
| 63 | jsonClass.getField().forEach(jsonField -> classMapping.addFieldMapping(readField(jsonField.getObf(), jsonField.getName(), jsonField.getType()))); | 65 | jsonClass.getField().forEach(jsonField -> classMapping.addFieldMapping(readField(jsonField.getObf(), jsonField.getName(), jsonField.getType()))); |
| 64 | 66 | ||
| 65 | jsonClass.getConstructors().forEach(jsonConstructor -> { | 67 | jsonClass.getConstructors().forEach(jsonConstructor -> { |
| 66 | MethodMapping methodMapping = readMethod(jsonConstructor.isStatics() ? "<clinit>" : "<init>", null, jsonConstructor.getSignature()); | 68 | MethodMapping methodMapping = readMethod(jsonConstructor.isStatics() ? "<clinit>" : "<init>", null, jsonConstructor.getSignature()); |
| 67 | jsonConstructor.getArgs().forEach(jsonArgument -> methodMapping.addArgumentMapping(readArgument(jsonArgument.getIndex(), jsonArgument.getName()))); | 69 | jsonConstructor.getArgs().forEach(jsonArgument -> methodMapping.addArgumentMapping(readArgument(jsonArgument.getIndex(), jsonArgument.getName()))); |
| 68 | classMapping.addMethodMapping(methodMapping); | 70 | classMapping.addMethodMapping(methodMapping); |
| 69 | }); | 71 | }); |
| 70 | 72 | ||
| 71 | jsonClass.getMethod().forEach(jsonMethod -> { | 73 | jsonClass.getMethod().forEach(jsonMethod -> { |
| 72 | MethodMapping methodMapping = readMethod(jsonMethod.getObf(), jsonMethod.getName(), jsonMethod.getSignature()); | 74 | MethodMapping methodMapping = readMethod(jsonMethod.getObf(), jsonMethod.getName(), jsonMethod.getSignature()); |
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsReaderOld.java b/src/main/java/cuchaz/enigma/mapping/MappingsReaderOld.java index 1a93604..a23a33f 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsReaderOld.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsReaderOld.java | |||
| @@ -18,7 +18,7 @@ public class MappingsReaderOld { | |||
| 18 | Deque<Object> mappingStack = Queues.newArrayDeque(); | 18 | Deque<Object> mappingStack = Queues.newArrayDeque(); |
| 19 | 19 | ||
| 20 | int lineNumber = 0; | 20 | int lineNumber = 0; |
| 21 | String line = null; | 21 | String line; |
| 22 | while ((line = in.readLine()) != null) { | 22 | while ((line = in.readLine()) != null) { |
| 23 | lineNumber++; | 23 | lineNumber++; |
| 24 | 24 | ||
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java b/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java index de1635a..2b112a2 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java | |||
| @@ -129,9 +129,7 @@ public class MappingsRenamer { | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | public void removeMethodTreeMapping(MethodEntry obf) { | 131 | public void removeMethodTreeMapping(MethodEntry obf) { |
| 132 | for (MethodEntry implementation : m_index.getRelatedMethodImplementations(obf)) { | 132 | m_index.getRelatedMethodImplementations(obf).forEach(this::removeMethodMapping); |
| 133 | removeMethodMapping(implementation); | ||
| 134 | } | ||
| 135 | } | 133 | } |
| 136 | 134 | ||
| 137 | public void removeMethodMapping(MethodEntry obf) { | 135 | public void removeMethodMapping(MethodEntry obf) { |
| @@ -140,9 +138,7 @@ public class MappingsRenamer { | |||
| 140 | } | 138 | } |
| 141 | 139 | ||
| 142 | public void markMethodTreeAsDeobfuscated(MethodEntry obf) { | 140 | public void markMethodTreeAsDeobfuscated(MethodEntry obf) { |
| 143 | for (MethodEntry implementation : m_index.getRelatedMethodImplementations(obf)) { | 141 | m_index.getRelatedMethodImplementations(obf).forEach(this::markMethodAsDeobfuscated); |
| 144 | markMethodAsDeobfuscated(implementation); | ||
| 145 | } | ||
| 146 | } | 142 | } |
| 147 | 143 | ||
| 148 | public void markMethodAsDeobfuscated(MethodEntry obf) { | 144 | public void markMethodAsDeobfuscated(MethodEntry obf) { |
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsWriter.java b/src/main/java/cuchaz/enigma/mapping/MappingsWriter.java index aaab22f..bfd6063 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsWriter.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsWriter.java | |||
| @@ -76,7 +76,7 @@ public class MappingsWriter { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | private <T extends Comparable<T>> List<T> sorted(Iterable<T> classes) { | 78 | private <T extends Comparable<T>> List<T> sorted(Iterable<T> classes) { |
| 79 | List<T> out = new ArrayList<T>(); | 79 | List<T> out = new ArrayList<>(); |
| 80 | for (T t : classes) { | 80 | for (T t : classes) { |
| 81 | out.add(t); | 81 | out.add(t); |
| 82 | } | 82 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/Signature.java b/src/main/java/cuchaz/enigma/mapping/Signature.java index 117018a..e2f9f09 100644 --- a/src/main/java/cuchaz/enigma/mapping/Signature.java +++ b/src/main/java/cuchaz/enigma/mapping/Signature.java | |||
| @@ -91,10 +91,7 @@ public class Signature implements Serializable { | |||
| 91 | 91 | ||
| 92 | @Override | 92 | @Override |
| 93 | public boolean equals(Object other) { | 93 | public boolean equals(Object other) { |
| 94 | if (other instanceof Signature) { | 94 | return other instanceof Signature && equals((Signature) other); |
| 95 | return equals((Signature) other); | ||
| 96 | } | ||
| 97 | return false; | ||
| 98 | } | 95 | } |
| 99 | 96 | ||
| 100 | public boolean equals(Signature other) { | 97 | public boolean equals(Signature other) { |
diff --git a/src/main/java/cuchaz/enigma/mapping/SignatureUpdater.java b/src/main/java/cuchaz/enigma/mapping/SignatureUpdater.java index dac692e..9864333 100644 --- a/src/main/java/cuchaz/enigma/mapping/SignatureUpdater.java +++ b/src/main/java/cuchaz/enigma/mapping/SignatureUpdater.java | |||
| @@ -28,7 +28,7 @@ public class SignatureUpdater { | |||
| 28 | 28 | ||
| 29 | // read the signature character-by-character | 29 | // read the signature character-by-character |
| 30 | StringReader reader = new StringReader(signature); | 30 | StringReader reader = new StringReader(signature); |
| 31 | int i = -1; | 31 | int i; |
| 32 | while ((i = reader.read()) != -1) { | 32 | while ((i = reader.read()) != -1) { |
| 33 | char c = (char) i; | 33 | char c = (char) i; |
| 34 | 34 | ||
| @@ -60,7 +60,7 @@ public class SignatureUpdater { | |||
| 60 | // remember to treat generics correctly | 60 | // remember to treat generics correctly |
| 61 | StringBuilder buf = new StringBuilder(); | 61 | StringBuilder buf = new StringBuilder(); |
| 62 | int depth = 0; | 62 | int depth = 0; |
| 63 | int i = -1; | 63 | int i; |
| 64 | while ((i = reader.read()) != -1) { | 64 | while ((i = reader.read()) != -1) { |
| 65 | char c = (char) i; | 65 | char c = (char) i; |
| 66 | 66 | ||
| @@ -82,12 +82,9 @@ public class SignatureUpdater { | |||
| 82 | 82 | ||
| 83 | public static List<String> getClasses(String signature) { | 83 | public static List<String> getClasses(String signature) { |
| 84 | final List<String> classNames = Lists.newArrayList(); | 84 | final List<String> classNames = Lists.newArrayList(); |
| 85 | update(signature, new ClassNameUpdater() { | 85 | update(signature, className -> { |
| 86 | @Override | 86 | classNames.add(className); |
| 87 | public String update(String className) { | 87 | return className; |
| 88 | classNames.add(className); | ||
| 89 | return className; | ||
| 90 | } | ||
| 91 | }); | 88 | }); |
| 92 | return classNames; | 89 | return classNames; |
| 93 | } | 90 | } |
diff --git a/src/main/java/cuchaz/enigma/mapping/Translator.java b/src/main/java/cuchaz/enigma/mapping/Translator.java index 2829a75..1947d1c 100644 --- a/src/main/java/cuchaz/enigma/mapping/Translator.java +++ b/src/main/java/cuchaz/enigma/mapping/Translator.java | |||
| @@ -24,12 +24,7 @@ public class Translator { | |||
| 24 | private Map<String, ClassMapping> m_classes; | 24 | private Map<String, ClassMapping> m_classes; |
| 25 | private TranslationIndex m_index; | 25 | private TranslationIndex m_index; |
| 26 | 26 | ||
| 27 | private ClassNameReplacer m_classNameReplacer = new ClassNameReplacer() { | 27 | private ClassNameReplacer m_classNameReplacer = className -> translateEntry(new ClassEntry(className)).getName(); |
| 28 | @Override | ||
| 29 | public String replace(String className) { | ||
| 30 | return translateEntry(new ClassEntry(className)).getName(); | ||
| 31 | } | ||
| 32 | }; | ||
| 33 | 28 | ||
| 34 | public Translator() { | 29 | public Translator() { |
| 35 | m_direction = null; | 30 | m_direction = null; |
| @@ -76,7 +71,7 @@ public class Translator { | |||
| 76 | } else if (entry instanceof MethodEntry) { | 71 | } else if (entry instanceof MethodEntry) { |
| 77 | return translate((MethodEntry) entry); | 72 | return translate((MethodEntry) entry); |
| 78 | } else if (entry instanceof ConstructorEntry) { | 73 | } else if (entry instanceof ConstructorEntry) { |
| 79 | return translate((ConstructorEntry) entry); | 74 | return translate(entry); |
| 80 | } else if (entry instanceof ArgumentEntry) { | 75 | } else if (entry instanceof ArgumentEntry) { |
| 81 | return translate((ArgumentEntry) entry); | 76 | return translate((ArgumentEntry) entry); |
| 82 | } else { | 77 | } else { |
diff --git a/src/main/java/cuchaz/enigma/mapping/Type.java b/src/main/java/cuchaz/enigma/mapping/Type.java index bfd836c..f2fd34d 100644 --- a/src/main/java/cuchaz/enigma/mapping/Type.java +++ b/src/main/java/cuchaz/enigma/mapping/Type.java | |||
| @@ -205,10 +205,7 @@ public class Type implements Serializable { | |||
| 205 | 205 | ||
| 206 | @Override | 206 | @Override |
| 207 | public boolean equals(Object other) { | 207 | public boolean equals(Object other) { |
| 208 | if (other instanceof Type) { | 208 | return other instanceof Type && equals((Type) other); |
| 209 | return equals((Type) other); | ||
| 210 | } | ||
| 211 | return false; | ||
| 212 | } | 209 | } |
| 213 | 210 | ||
| 214 | public boolean equals(Type other) { | 211 | public boolean equals(Type other) { |
| @@ -222,7 +219,6 @@ public class Type implements Serializable { | |||
| 222 | private static int countArrayDimension(String in) { | 219 | private static int countArrayDimension(String in) { |
| 223 | int i = 0; | 220 | int i = 0; |
| 224 | for (; i < in.length() && in.charAt(i) == '['; i++) { | 221 | for (; i < in.length() && in.charAt(i) == '['; i++) { |
| 225 | ; | ||
| 226 | } | 222 | } |
| 227 | return i; | 223 | return i; |
| 228 | } | 224 | } |